Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5218)

Unified Diff: chrome/test/data/webui/bluetooth_internals_browsertest.js

Issue 2563113002: bluetooth: Add tests for Sidebar in bluetooth internals browser test suite. (Closed)
Patch Set: Change to Array#some Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/bluetooth_internals/bluetooth_internals.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « chrome/browser/resources/bluetooth_internals/bluetooth_internals.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698