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

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

Issue 1466433002: Add Settings bluetooth page test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add callback arg Created 5 years, 1 month 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/chrome_tests.gypi ('k') | chrome/test/data/webui/settings/settings_page_browsertest.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 /** @fileoverview Suite of tests for settings-bluetooth-page. */
6
7 GEN_INCLUDE(['settings_page_browsertest.js']);
8
9 /**
10 * @constructor
11 * @extends {SettingsPageBrowserTest}
12 */
13 function SettingsBluetoothPageBrowserTest() {}
14
15 SettingsBluetoothPageBrowserTest.prototype = {
16 __proto__: SettingsPageBrowserTest.prototype,
17 };
18
19 // Runs bluetooth tests.
20 TEST_F('SettingsBluetoothPageBrowserTest', 'Bluetooth', function() {
21 // Assign |self| to |this| instead of binding since 'this' in suite()
22 // and test() will be a Mocha 'Suite' or 'Test' instance.
23 var self = this;
24
25 var enabled_ = false;
dpapad 2015/11/20 18:49:43 Nit: Local vars don't need underscore at the end (
stevenjb 2015/11/23 18:43:07 Done.
26
27 chrome.bluetooth.getAdapterState = function(callback) {
dschuyler 2015/11/20 22:22:36 Is it useful to add a short timeout/delay to simul
stevenjb 2015/11/23 18:43:07 We don't need an actual delay (and should generall
28 callback({
29 address: '00:11:22:33:44:55:66',
30 name: 'Fake Adapter',
31 powered: enabled_,
32 available: true,
33 discovering: false
34 });
35 };
36
37 chrome.bluetoothPrivate.setAdapterState = function(state, callback) {
38 enabled_ = state.powered;
39 callback();
40 };
41
42 suite('SettingsBluetoothPage', function() {
43 test('enable', function() {
44 var bluetoothSection =
45 self.getSection(self.getPage('advanced'), 'bluetooth');
46 assertTrue(!!bluetoothSection);
47 var bluetooth =
48 bluetoothSection.querySelector('settings-bluetooth-page');
49 assertTrue(!!bluetooth);
50 var enable = bluetooth.$.enableBluetooth;
51 assertTrue(!!enable);
52 assertFalse(enabled_);
53 expectFalse(enable.checked);
54 MockInteractions.tap(enable);
55 expectTrue(enable.checked);
dpapad 2015/11/20 18:49:43 What is the difference of expectTrue and assertTru
stevenjb 2015/11/20 18:55:03 asset will fail and stop the test immediately. It
56 expectTrue(enabled_);
57 });
58 });
59
60 // Run all registered tests.
61 mocha.run();
62 });
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/webui/settings/settings_page_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698