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

Side by Side Diff: chrome/test/data/webui/settings/bluetooth_page_browsertest_chromeos.js

Issue 1875413002: MD Settings: polish top-level bluetooth page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fixes Created 4 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/settings/settings_shared_css.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** @fileoverview Suite of tests for settings-bluetooth-page. */ 5 /** @fileoverview Suite of tests for settings-bluetooth-page. */
6 6
7 GEN_INCLUDE(['settings_page_browsertest.js']); 7 GEN_INCLUDE(['settings_page_browsertest.js']);
8 8
9 var bluetoothPage = bluetoothPage || {}; 9 var bluetoothPage = bluetoothPage || {};
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 test('device list', function() { 123 test('device list', function() {
124 var bluetoothSection = self.getSection(advanced, 'bluetooth'); 124 var bluetoothSection = self.getSection(advanced, 'bluetooth');
125 var bluetooth = 125 var bluetooth =
126 bluetoothSection.querySelector('settings-bluetooth-page'); 126 bluetoothSection.querySelector('settings-bluetooth-page');
127 assertTrue(!!bluetooth); 127 assertTrue(!!bluetooth);
128 var deviceList = bluetooth.$.deviceList; 128 var deviceList = bluetooth.$.deviceList;
129 assertTrue(!!deviceList); 129 assertTrue(!!deviceList);
130 // Set enabled, with default (empty) device list. 130 // Set enabled, with default (empty) device list.
131 self.bluetoothApi_.setEnabled(true); 131 self.bluetoothApi_.setEnabled(true);
132 Polymer.dom.flush(); 132 Polymer.dom.flush();
133 // Ensure that initially the 'device list empty' span is visible. 133 // Ensure that initially the 'no devices' element is visible.
134 expectFalse(deviceList.hidden); 134 expectFalse(deviceList.hidden);
135 var noDevices = deviceList.querySelector('span'); 135 var noDevices = deviceList.querySelector('.no-devices');
136 assertTrue(!!noDevices); 136 assertTrue(!!noDevices);
137 expectFalse(noDevices.hidden); 137 expectFalse(noDevices.hidden);
138 // Set some devices (triggers onDeviceAdded events). 'empty' span should 138 // Set some devices (triggers onDeviceAdded events). 'no devices' element
139 // be hidden. 139 // should be hidden.
140 self.bluetoothApi_.setDevicesForTest(fakeDevices_); 140 self.bluetoothApi_.setDevicesForTest(fakeDevices_);
141 Polymer.dom.flush(); 141 Polymer.dom.flush();
142 expectTrue(noDevices.hidden); 142 expectTrue(noDevices.hidden);
143 // Confirm that there are two paired devices in the list. 143 // Confirm that there are two paired devices in the list.
144 var devices = deviceList.querySelectorAll('bluetooth-device-list-item'); 144 var devices = deviceList.querySelectorAll('bluetooth-device-list-item');
145 assertEquals(2, devices.length); 145 assertEquals(2, devices.length);
146 // Check the state of each device. 146 // Check the state of each device.
147 assertTrue(devices[0].device.connected); 147 assertTrue(devices[0].device.connected);
148 assertFalse(devices[1].device.connected); 148 assertFalse(devices[1].device.connected);
149 assertTrue(devices[1].device.connecting); 149 assertTrue(devices[1].device.connecting);
150 }); 150 });
151 151
152 test('device dialog', function() { 152 test('device dialog', function() {
153 var bluetoothSection = self.getSection(advanced, 'bluetooth'); 153 var bluetoothSection = self.getSection(advanced, 'bluetooth');
154 var bluetooth = 154 var bluetooth =
155 bluetoothSection.querySelector('settings-bluetooth-page'); 155 bluetoothSection.querySelector('settings-bluetooth-page');
156 assertTrue(!!bluetooth); 156 assertTrue(!!bluetooth);
157 self.bluetoothApi_.setEnabled(true); 157 self.bluetoothApi_.setEnabled(true);
158 158
159 // Tap the 'add device' button. 159 // Tap the 'add device' button.
160 MockInteractions.tap(bluetooth.$.addDevice); 160 MockInteractions.tap(bluetooth.$$('.primary-button'));
161 Polymer.dom.flush(); 161 Polymer.dom.flush();
162 // Ensure the dialog appears. 162 // Ensure the dialog appears.
163 var dialog = bluetooth.$.deviceDialog; 163 var dialog = bluetooth.$.deviceDialog;
164 assertTrue(!!dialog); 164 assertTrue(!!dialog);
165 assertTrue(dialog.opened); 165 assertTrue(dialog.opened);
166 var addDialog = bluetooth.$$('settings-bluetooth-add-device-dialog'); 166 var addDialog = bluetooth.$$('settings-bluetooth-add-device-dialog');
167 assertTrue(!!addDialog); 167 assertTrue(!!addDialog);
168 // Ensure the dialog has the expected devices. 168 // Ensure the dialog has the expected devices.
169 var devicesDiv = addDialog.$.dialogDeviceList; 169 var devicesDiv = addDialog.$.dialogDeviceList;
170 var devices = devicesDiv.querySelectorAll('bluetooth-device-list-item'); 170 var devices = devicesDiv.querySelectorAll('bluetooth-device-list-item');
(...skipping 17 matching lines...) Expand all
188 var response = self.bluetoothPrivateApi_.pairingResponses_[deviceAddress]; 188 var response = self.bluetoothPrivateApi_.pairingResponses_[deviceAddress];
189 assertTrue(!!response); 189 assertTrue(!!response);
190 expectEquals(chrome.bluetoothPrivate.PairingResponse.CANCEL, 190 expectEquals(chrome.bluetoothPrivate.PairingResponse.CANCEL,
191 response.response); 191 response.response);
192 }); 192 });
193 }); 193 });
194 194
195 // Run all registered tests. 195 // Run all registered tests.
196 mocha.run(); 196 mocha.run();
197 }); 197 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/settings_shared_css.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698