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

Unified 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: More Feedback 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/settings/bluetooth_page_browsertest.js
diff --git a/chrome/test/data/webui/settings/bluetooth_page_browsertest.js b/chrome/test/data/webui/settings/bluetooth_page_browsertest.js
new file mode 100644
index 0000000000000000000000000000000000000000..47debea08a718a450b28c3bd9623e5d0f59a7447
--- /dev/null
+++ b/chrome/test/data/webui/settings/bluetooth_page_browsertest.js
@@ -0,0 +1,62 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/** @fileoverview Suite of tests for settings-bluetooth-page. */
+
+GEN_INCLUDE(['settings_page_browsertest.js']);
+
+/**
+ * @constructor
+ * @extends {SettingsPageBrowserTest}
+*/
+function SettingsBluetoothPageBrowserTest() {}
+
+SettingsBluetoothPageBrowserTest.prototype = {
+ __proto__: SettingsPageBrowserTest.prototype,
+};
+
+// Runs bluetooth tests.
+TEST_F('SettingsBluetoothPageBrowserTest', 'Bluetooth', function() {
+ // Assign |self| to |this| instead of binding since 'this' in suite()
+ // and test() will be a Mocha 'Suite' or 'Test' instance.
+ var self = this;
+
+ var enabled_ = false;
+
+ chrome.bluetooth.getAdapterState = function() {
+ callback({
dpapad 2015/11/20 18:05:22 Where is 'callback' defined? Should be passed as a
stevenjb 2015/11/20 18:28:16 Gah, yes. Done. Need to closure working for tests
+ address: '00:11:22:33:44:55:66',
+ name: 'Fake Adapter',
+ powered: enabled_,
+ available: true,
+ discovering: false
+ });
+ };
+
+ chrome.bluetoothPrivate.setAdapterState = function(state, callback) {
+ enabled_ = state.powered;
+ callback();
+ };
+
+ suite('SettingsBluetoothPage', function() {
+ test('enable', function() {
+ var bluetoothSection =
+ self.getSection(self.getPage('advanced'), 'bluetooth');
+ assertTrue(!!bluetoothSection);
+ var bluetooth =
+ bluetoothSection.querySelector('settings-bluetooth-page');
+ assertTrue(!!bluetooth);
+ var enable = bluetooth.$.enableBluetooth;
+ assertTrue(!!enable);
+ assertFalse(enabled_);
+ expectFalse(enable.checked);
+ MockInteractions.tap(enable);
+ expectTrue(enable.checked);
+ expectTrue(enabled_);
+ });
+ });
+
+ // Run all registered tests.
+ mocha.run();
+});

Powered by Google App Engine
This is Rietveld 408576698