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..c9cb3b34d030268a83906d2375daee3d747fb832 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()); |
| @@ -424,6 +425,40 @@ TEST_F('BluetoothInternalsTest', 'Startup_BluetoothInternals', function() { |
| adapterBroker.adapterClient_.deviceChanged(newDeviceInfo3); |
| expectEquals('-17', rssiColumn.textContent); |
| }); |
| + |
| + /* Sidebar Tests */ |
| + test('SidebarSetup', function() { |
| + var sidebarItems = Array.from( |
| + sidebarNode.querySelectorAll('.sidebar-content li')); |
| + |
| + ['devices'].forEach(function(pageName) { |
| + var foundItem = sidebarItems.find(function(item) { |
| + return item.dataset.pageName === pageName; |
| + }); |
| + |
| + expectTrue(!!foundItem); |
| + }); |
| + }); |
| + |
| + test('SidebarOpenClose', function() { |
|
ortuno
2016/12/12 23:24:48
Would it make sense to split these? That way inste
mbrunson
2016/12/13 01:05:35
Done.
|
| + // Sidebar should be closed by default. |
| + expectFalse(sidebarNode.classList.contains('open')); |
| + |
| + sidebarObj.open(); |
| + expectTrue(sidebarNode.classList.contains('open')); |
| + sidebarObj.close(); |
| + expectFalse(sidebarNode.classList.contains('open')); |
| + |
| + // Multiple calls to open shouldn't change the state. |
| + sidebarObj.open(); |
| + sidebarObj.open(); |
| + expectTrue(sidebarNode.classList.contains('open')); |
| + |
| + // Multiple calls to close shouldn't change the state. |
| + sidebarObj.close(); |
| + sidebarObj.close(); |
| + expectFalse(sidebarNode.classList.contains('open')); |
| + }); |
| }); |
| // Run all registered tests. |