Commit d1833116 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Apps] Improve MusicManagerPrivate test

The MusicManagerPrivate test to exercise getDeviceId() needs to
accommodate an empty device ID; however, this can (and did) mask other
errors that should be caught.

Improve the test by expecting a specific error if the device ID is
empty.

Bug: 923599
Change-Id: I545d36ab87ad263d8d725eeb5a94608dc0381b1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1601739Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658254}
parent f95a65c2
...@@ -2,26 +2,20 @@ ...@@ -2,26 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
function runTests() { chrome.test.runTests([
chrome.test.runTests([ function getDeviceIdTest() {
function test() { chrome.musicManagerPrivate.getDeviceId(function(id) {
chrome.musicManagerPrivate.getDeviceId(function(id) { if (id !== undefined) {
console.log('Device ID=' + id); chrome.test.assertNoLastError();
if (id) { chrome.test.assertEq('string', typeof id);
// This block is not entered in VMs (e.g. the bots) which return chrome.test.assertTrue(id.length >= 8);
// dummy MACs. } else {
chrome.test.assertEq('string', typeof id); // Bots may not support device ID. In this case, we still check that the
chrome.test.assertTrue(id.length >= 8); // error message is what we expect.
} chrome.test.assertLastError(
chrome.test.succeed(); 'Device ID API is not supported on this platform.');
}); }
} chrome.test.succeed();
]); });
} }
]);
window.onload = function() {
chrome.test.getConfig(function(config) {
console.log('customArg=' + config.customArg);
runTests();
});
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment