| 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..c3c85ad29d95afcc145c1aef5538cf086b81c159 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,44 @@ 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) {
|
| + expectTrue(sidebarItems.some(function(item) {
|
| + return item.dataset.pageName === pageName;
|
| + }));
|
| + });
|
| + });
|
| +
|
| + 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.
|
|
|