Chromium Code Reviews| Index: chrome/test/data/webui/bluetooth_internals_browsertest.js |
| diff --git a/chrome/test/data/webui/bluetooth_internals_browsertest.js b/chrome/test/data/webui/bluetooth_internals_browsertest.js |
| index 8d15b7d903e8f80d7f132db183fcf3fe750cbc10..0823b9d1b8dd07c612e562c76a26534cd7326264 100644 |
| --- a/chrome/test/data/webui/bluetooth_internals_browsertest.js |
| +++ b/chrome/test/data/webui/bluetooth_internals_browsertest.js |
| @@ -227,6 +227,7 @@ BluetoothInternalsTest.prototype = { |
| TEST_F('BluetoothInternalsTest', 'Startup_BluetoothInternals', function() { |
| var adapterFactory = null; |
| var deviceTable = null; |
| + var sidebarNode = null; |
| var fakeDeviceInfo1 = this.fakeDeviceInfo1; |
| var fakeDeviceInfo2 = this.fakeDeviceInfo2; |
| @@ -237,7 +238,6 @@ TEST_F('BluetoothInternalsTest', 'Startup_BluetoothInternals', function() { |
| adapterFactory = this.adapterFactory; |
| }.bind(this)); |
| - |
| suite('BluetoothInternalsUITest', function() { |
| var EXPECTED_DEVICES = 2; |
| @@ -254,6 +254,7 @@ TEST_F('BluetoothInternalsTest', 'Startup_BluetoothInternals', function() { |
| setup(function() { |
| deviceTable = document.querySelector('#devices table'); |
| + sidebarNode = document.querySelector('#sidebar'); |
| devices.splice(0, devices.length); |
| adapterBroker.adapterClient_.deviceAdded(fakeDeviceInfo1()); |
| adapterBroker.adapterClient_.deviceAdded(fakeDeviceInfo2()); |
| @@ -261,6 +262,7 @@ TEST_F('BluetoothInternalsTest', 'Startup_BluetoothInternals', function() { |
| teardown(function() { |
| adapterFactory.reset(); |
| + sidebarObj.close(); |
| }); |
| /** |
| @@ -424,6 +426,46 @@ TEST_F('BluetoothInternalsTest', 'Startup_BluetoothInternals', function() { |
| adapterBroker.adapterClient_.deviceChanged(newDeviceInfo3); |
| expectEquals('-17', rssiColumn.textContent); |
| }); |
| + |
| + /* Sidebar Tests */ |
| + test('Sidebar_Setup', function() { |
| + var sidebarItems = Array.from( |
| + sidebarNode.querySelectorAll('.sidebar-content li')); |
| + |
| + ['devices'].forEach(function(pageName) { |
| + var foundItem = sidebarItems.find(function(item) { |
|
dpapad
2016/12/14 00:32:05
Nit: You can use Array#some here, as follows
expe
mbrunson
2016/12/14 02:34:35
Done.
|
| + return item.dataset.pageName === pageName; |
| + }); |
| + |
| + expectTrue(!!foundItem); |
| + }); |
| + }); |
| + |
| + test('Sidebar_DefaultState', function() { |
| + // Sidebar should be closed by default. |
| + expectFalse(sidebarNode.classList.contains('open')); |
| + }); |
| + |
| + test('Sidebar_OpenClose', function() { |
| + sidebarObj.open(); |
| + expectTrue(sidebarNode.classList.contains('open')); |
| + sidebarObj.close(); |
| + expectFalse(sidebarNode.classList.contains('open')); |
| + }); |
| + |
| + test('Sidebar_OpenTwice', function() { |
| + // Multiple calls to open shouldn't change the state. |
| + sidebarObj.open(); |
| + sidebarObj.open(); |
| + expectTrue(sidebarNode.classList.contains('open')); |
| + }); |
| + |
| + test('Sidebar_CloseTwice', function() { |
| + // Multiple calls to close shouldn't change the state. |
| + sidebarObj.close(); |
| + sidebarObj.close(); |
| + expectFalse(sidebarNode.classList.contains('open')); |
| + }); |
| }); |
| // Run all registered tests. |