Commit f7d9d394 authored by Nnamdi Theodore Johnson-Kanu's avatar Nnamdi Theodore Johnson-Kanu Committed by Commit Bot

[CrOS settings] Port bluetooth/ page to Polymer3

- Updates relevant chromeos BUILD.gn files
- Add imports and exports to os_route, os_settings_route and
  os_settings.js
- Update bluetooth test files.

Bug: 1045266
Change-Id: I81e52893befe36b4757283428b7844b2de8fe514
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220218
Commit-Queue: Nnamdi Theodore Johnson-kanu <tjohnsonkanu@google.com>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarRegan Hsu <hsuregan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779949}
parent a0ce87c5
...@@ -175,7 +175,8 @@ group("closure_compile_module") { ...@@ -175,7 +175,8 @@ group("closure_compile_module") {
# TODO: Uncomment as the Polymer3 migration makes progress. # TODO: Uncomment as the Polymer3 migration makes progress.
#":closure_compile_local_module", #":closure_compile_local_module",
#"ambient_mode_page:closure_compile_module", #"ambient_mode_page:closure_compile_module",
#"bluetooth_page:closure_compile_module", "bluetooth_page:closure_compile_module",
#"crostini_page:closure_compile_module", #"crostini_page:closure_compile_module",
#"date_time_page:closure_compile_module", #"date_time_page:closure_compile_module",
#"device_page:closure_compile_module", #"device_page:closure_compile_module",
...@@ -252,9 +253,13 @@ js_library("os_route.m") { ...@@ -252,9 +253,13 @@ js_library("os_route.m") {
"$root_gen_dir/chrome/browser/resources/settings/chromeos/os_route.m.js", "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_route.m.js",
] ]
deps = [ deps = [
# TODO: Fill those in. ":os_settings_routes.m",
"..:router.m",
"//chrome/browser/ui/webui/settings/chromeos/constants:mojom_js_library_for_compile",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:load_time_data",
] ]
extra_deps = [ ":os_route_module" ] extra_deps = [ ":modulize" ]
} }
js_library("os_settings_icons_css.m") { js_library("os_settings_icons_css.m") {
...@@ -267,9 +272,7 @@ js_library("os_settings_icons_css.m") { ...@@ -267,9 +272,7 @@ js_library("os_settings_icons_css.m") {
js_library("os_settings_routes.m") { js_library("os_settings_routes.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_settings_routes.m.js" ] sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_settings_routes.m.js" ]
deps = [ deps = [ "//ui/webui/resources/js:load_time_data.m" ]
# TODO: Fill those in.
]
extra_deps = [ ":modulize" ] extra_deps = [ ":modulize" ]
} }
...@@ -327,11 +330,14 @@ group("polymer3_elements") { ...@@ -327,11 +330,14 @@ group("polymer3_elements") {
":modulize", ":modulize",
":os_icons_module", ":os_icons_module",
":os_page_visibility_module", ":os_page_visibility_module",
":os_route_module",
":os_settings_icons_css_module", ":os_settings_icons_css_module",
"..:modulize", "..:modulize",
"..:settings_shared_css_module", "..:settings_shared_css_module",
"..:settings_vars_css_module", "..:settings_vars_css_module",
"../prefs:modulize",
"../prefs:prefs_module",
"../settings_page:settings_animated_pages_module",
"../settings_page:settings_subpage_module",
] ]
} }
...@@ -347,12 +353,6 @@ polymer_modulizer("os_page_visibility") { ...@@ -347,12 +353,6 @@ polymer_modulizer("os_page_visibility") {
html_type = "dom-module" html_type = "dom-module"
} }
polymer_modulizer("os_route") {
js_file = "os_route.js"
html_file = "os_route.html"
html_type = "dom-module"
}
polymer_modulizer("os_settings_icons_css") { polymer_modulizer("os_settings_icons_css") {
js_file = "os_settings_icons_css.m.js" js_file = "os_settings_icons_css.m.js"
html_file = "os_settings_icons_css.html" html_file = "os_settings_icons_css.html"
...@@ -365,6 +365,7 @@ js_modulizer("modulize") { ...@@ -365,6 +365,7 @@ js_modulizer("modulize") {
"os_settings_routes.js", "os_settings_routes.js",
"route_origin_behavior.js", "route_origin_behavior.js",
"search_handler.js", "search_handler.js",
"os_route.js",
] ]
namespace_rewrites = os_settings_namespace_rewrites namespace_rewrites = os_settings_namespace_rewrites
} }
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
import("//tools/polymer/polymer.gni")
import("../os_settings.gni")
js_type_check("closure_compile") { js_type_check("closure_compile") {
deps = [ deps = [
...@@ -14,11 +16,11 @@ js_type_check("closure_compile") { ...@@ -14,11 +16,11 @@ js_type_check("closure_compile") {
js_library("bluetooth_page") { js_library("bluetooth_page") {
deps = [ deps = [
":bluetooth_system_on_extensions",
"..:os_route", "..:os_route",
"../..:router", "../..:router",
"../../prefs:prefs_behavior", "../../prefs:prefs_behavior",
"../../settings_page:settings_animated_pages", "../../settings_page:settings_animated_pages",
"//services/device/public/mojom:mojom_js_library_for_compile",
"//ui/webui/resources/js:assert", "//ui/webui/resources/js:assert",
"//ui/webui/resources/js:i18n_behavior", "//ui/webui/resources/js:i18n_behavior",
] ]
...@@ -34,10 +36,10 @@ js_library("bluetooth_page") { ...@@ -34,10 +36,10 @@ js_library("bluetooth_page") {
js_library("bluetooth_subpage") { js_library("bluetooth_subpage") {
deps = [ deps = [
":bluetooth_system_on_extensions",
"..:metrics_recorder", "..:metrics_recorder",
"..:os_route", "..:os_route",
"../..:router", "../..:router",
"//services/device/public/mojom:mojom_js_library_for_compile",
"//ui/webui/resources/cr_components/chromeos/bluetooth:bluetooth_dialog", "//ui/webui/resources/cr_components/chromeos/bluetooth:bluetooth_dialog",
"//ui/webui/resources/cr_elements:cr_scrollable_behavior", "//ui/webui/resources/cr_elements:cr_scrollable_behavior",
"//ui/webui/resources/js:assert", "//ui/webui/resources/js:assert",
...@@ -56,7 +58,7 @@ js_library("bluetooth_subpage") { ...@@ -56,7 +58,7 @@ js_library("bluetooth_subpage") {
js_library("bluetooth_device_list_item") { js_library("bluetooth_device_list_item") {
deps = [ deps = [
":bluetooth_system_on_extensions", "//services/device/public/mojom:mojom_js_library_for_compile",
"//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu", "//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu",
"//ui/webui/resources/js:i18n_behavior", "//ui/webui/resources/js:i18n_behavior",
"//ui/webui/resources/js/cr/ui:focus_row_behavior", "//ui/webui/resources/js/cr/ui:focus_row_behavior",
...@@ -64,33 +66,42 @@ js_library("bluetooth_device_list_item") { ...@@ -64,33 +66,42 @@ js_library("bluetooth_device_list_item") {
externs_list = [ "$externs_path/bluetooth.js" ] externs_list = [ "$externs_path/bluetooth.js" ]
} }
js_library("bluetooth_system_on_extensions") { js_type_check("closure_compile_module") {
sources = [] is_polymer3 = true
deps = [ "//services/device/public/mojom:mojom_js_library_for_compile" ] deps = [
":bluetooth_device_list_item.m",
":bluetooth_page.m",
":bluetooth_subpage.m",
]
} }
# TODO: Uncomment as the Polymer3 migration makes progress.
#js_type_check("closure_compile_module") {
# is_polymer3 = true
# deps = [
# ":bluetooth_device_list_item.m",
# ":bluetooth_page.m",
# ":bluetooth_subpage.m"
# ]
#}
js_library("bluetooth_device_list_item.m") { js_library("bluetooth_device_list_item.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_device_list_item.m.js" ] sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_device_list_item.m.js" ]
deps = [ deps = [
# TODO: Fill those in. "//services/device/public/mojom:mojom_js_library_for_compile",
"//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu.m",
"//ui/webui/resources/js:i18n_behavior.m",
"//ui/webui/resources/js/cr/ui:focus_row_behavior.m",
] ]
externs_list = [ "$externs_path/bluetooth.js" ]
extra_deps = [ ":bluetooth_device_list_item_module" ] extra_deps = [ ":bluetooth_device_list_item_module" ]
} }
js_library("bluetooth_page.m") { js_library("bluetooth_page.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_page.m.js" ] sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_page.m.js" ]
deps = [ deps = [
# TODO: Fill those in. ":bluetooth_subpage.m",
"..:os_route.m",
"../..:router.m",
"../../prefs:prefs_behavior.m",
"../../settings_page:settings_animated_pages.m",
"//services/device/public/mojom:mojom_js_library_for_compile",
"//ui/webui/resources/js:assert.m",
"//ui/webui/resources/js:i18n_behavior.m",
]
externs_list = [
"$externs_path/bluetooth.js",
"$externs_path/bluetooth_private.js",
] ]
extra_deps = [ ":bluetooth_page_module" ] extra_deps = [ ":bluetooth_page_module" ]
} }
...@@ -98,13 +109,24 @@ js_library("bluetooth_page.m") { ...@@ -98,13 +109,24 @@ js_library("bluetooth_page.m") {
js_library("bluetooth_subpage.m") { js_library("bluetooth_subpage.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_subpage.m.js" ] sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_subpage.m.js" ]
deps = [ deps = [
# TODO: Fill those in. "..:metrics_recorder.m",
"..:os_route.m",
"../..:router.m",
"//services/device/public/mojom:mojom_js_library_for_compile",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/cr_components/chromeos/bluetooth:bluetooth_dialog.m",
"//ui/webui/resources/cr_elements:cr_scrollable_behavior.m",
"//ui/webui/resources/js:assert.m",
"//ui/webui/resources/js:i18n_behavior.m",
"//ui/webui/resources/js:list_property_update_behavior.m",
]
externs_list = [
"$externs_path/bluetooth.js",
"$externs_path/bluetooth_private.js",
] ]
extra_deps = [ ":bluetooth_subpage_module" ] extra_deps = [ ":bluetooth_subpage_module" ]
} }
import("//tools/polymer/polymer.gni")
group("polymer3_elements") { group("polymer3_elements") {
public_deps = [ public_deps = [
":bluetooth_device_list_item_module", ":bluetooth_device_list_item_module",
...@@ -117,16 +139,25 @@ polymer_modulizer("bluetooth_device_list_item") { ...@@ -117,16 +139,25 @@ polymer_modulizer("bluetooth_device_list_item") {
js_file = "bluetooth_device_list_item.js" js_file = "bluetooth_device_list_item.js"
html_file = "bluetooth_device_list_item.html" html_file = "bluetooth_device_list_item.html"
html_type = "dom-module" html_type = "dom-module"
migrated_imports = os_settings_migrated_imports
namespace_rewrites = os_settings_namespace_rewrites
auto_imports = os_settings_auto_imports
} }
polymer_modulizer("bluetooth_page") { polymer_modulizer("bluetooth_page") {
js_file = "bluetooth_page.js" js_file = "bluetooth_page.js"
html_file = "bluetooth_page.html" html_file = "bluetooth_page.html"
html_type = "dom-module" html_type = "dom-module"
migrated_imports = os_settings_migrated_imports
namespace_rewrites = os_settings_namespace_rewrites
auto_imports = os_settings_auto_imports
} }
polymer_modulizer("bluetooth_subpage") { polymer_modulizer("bluetooth_subpage") {
js_file = "bluetooth_subpage.js" js_file = "bluetooth_subpage.js"
html_file = "bluetooth_subpage.html" html_file = "bluetooth_subpage.html"
html_type = "dom-module" html_type = "dom-module"
migrated_imports = os_settings_migrated_imports
namespace_rewrites = os_settings_namespace_rewrites
auto_imports = os_settings_auto_imports
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* just provodes a summary and link to the subpage. * just provodes a summary and link to the subpage.
*/ */
const bluetoothApis = window['bluetoothApis'] || { /* #export */ const bluetoothApis = window['bluetoothApis'] || {
/** /**
* Set this to provide a fake implementation for testing. * Set this to provide a fake implementation for testing.
* @type {Bluetooth} * @type {Bluetooth}
......
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// #import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'
// #import '../constants/routes.mojom-lite.js';
// #import {OsSettingsRoutes} from './os_settings_routes.m.js'
// #import {Route, Router} from '../router.m.js';
cr.define('settings', function() { cr.define('settings', function() {
/** /**
* @param {!settings.Route} parent * @param {!settings.Route} parent
...@@ -303,7 +309,7 @@ cr.define('settings', function() { ...@@ -303,7 +309,7 @@ cr.define('settings', function() {
// TODO(dpapad): Change to 'get routes() {}' in export when we fix a bug in // TODO(dpapad): Change to 'get routes() {}' in export when we fix a bug in
// ChromePass that limits the syntax of what can be returned from cr.define(). // ChromePass that limits the syntax of what can be returned from cr.define().
const routes = /** @type {!OsSettingsRoutes} */ ( /* #export */ const routes = /** @type {!OsSettingsRoutes} */ (
settings.Router.getInstance().getRoutes()); settings.Router.getInstance().getRoutes());
// #cr_define_end // #cr_define_end
......
...@@ -15,4 +15,10 @@ os_settings_auto_imports = settings_auto_imports + [ ...@@ -15,4 +15,10 @@ os_settings_auto_imports = settings_auto_imports + [
"chrome/browser/resources/settings/chromeos/os_reset_page/os_reset_browser_proxy.html|OsResetBrowserProxy,OsResetBrowserProxyImpl", "chrome/browser/resources/settings/chromeos/os_reset_page/os_reset_browser_proxy.html|OsResetBrowserProxy,OsResetBrowserProxyImpl",
"chrome/browser/resources/settings/chromeos/metrics_recorder.html|recordSettingChange", "chrome/browser/resources/settings/chromeos/metrics_recorder.html|recordSettingChange",
"chrome/browser/resources/settings/lifetime_browser_proxy.html|LifetimeBrowserProxy,LifetimeBrowserProxyImpl", "chrome/browser/resources/settings/lifetime_browser_proxy.html|LifetimeBrowserProxy,LifetimeBrowserProxyImpl",
"chrome/browser/resources/settings/chromeos/os_route.html|routes",
"chrome/browser/resources/settings/route.html|routes",
"chrome/browser/resources/settings/router.html|Router,Route,RouteObserverBehavior",
"ui/webui/resources/html/polymer.html|Polymer,html,flush",
] ]
os_settings_migrated_imports = settings_migrated_imports
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
import './os_reset_page/os_powerwash_dialog.m.js'; import './os_reset_page/os_powerwash_dialog.m.js';
import './os_reset_page/os_reset_page.m.js'; import './os_reset_page/os_reset_page.m.js';
import './localized_link/localized_link.m.js'; import './localized_link/localized_link.m.js';
import './bluetooth_page/bluetooth_page.m.js';
import './bluetooth_page/bluetooth_subpage.m.js';
import './bluetooth_page/bluetooth_device_list_item.m.js';
export {LifetimeBrowserProxy, LifetimeBrowserProxyImpl} from '../lifetime_browser_proxy.m.js';
export {bluetoothApis} from './bluetooth_page/bluetooth_page.m.js';
export {OsResetBrowserProxyImpl} from './os_reset_page/os_reset_browser_proxy.m.js'; export {OsResetBrowserProxyImpl} from './os_reset_page/os_reset_browser_proxy.m.js';
export {LifetimeBrowserProxy, LifetimeBrowserProxyImpl} from '../../lifetime_browser_proxy.m.js';
\ No newline at end of file
...@@ -15,6 +15,21 @@ ...@@ -15,6 +15,21 @@
use_base_dir="false" use_base_dir="false"
compress="false" compress="false"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_OS_SETTINGS_BLUETOOTH_PAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_page.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_BLUETOOTH_SUBPAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_subpage.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_BLUETOOTH_DEVICE_LIST_ITEM_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_device_list_item.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_LOCALIZED_LINK_M_JS" <include name="IDR_OS_SETTINGS_LOCALIZED_LINK_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/localized_link/localized_link.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/localized_link/localized_link.m.js"
use_base_dir="false" use_base_dir="false"
...@@ -25,11 +40,56 @@ ...@@ -25,11 +40,56 @@
use_base_dir="false" use_base_dir="false"
compress="false" compress="false"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_OS_SETTINGS_OS_ICONS_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_icons.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_SETTINGS_OS_ROUTE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_route.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_SETTINGS_OS_SETTINGS_ROUTE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_settings_routes.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_SETTINGS_SUBPAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/settings_page/settings_subpage.m.js"
use_base_dir="false"
compress="false"
type="BINDATA"/>
<include name="IDR_OS_SETTINGS_SETTINGS_ANIMATED_PAGES_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/settings_page/settings_animated_pages.m.js"
use_base_dir="false"
compress="false"
type="BINDATA"/>
<include name="IDR_OS_SETTINGS_LIFETIME_BROWSER_PROXY_M_JS" <include name="IDR_OS_SETTINGS_LIFETIME_BROWSER_PROXY_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/lifetime_browser_proxy.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/lifetime_browser_proxy.m.js"
use_base_dir="false" use_base_dir="false"
compress="false" compress="false"
type="BINDATA"/> type="BINDATA"/>
<include name="IDR_OS_SETTINGS_PREFS_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/prefs/prefs.m.js"
use_base_dir="false"
compress="false"
type="BINDATA"/>
<include name="IDR_OS_SETTINGS_PREFS_TYPES_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/prefs/prefs_types.m.js"
use_base_dir="false"
compress="false"
type="BINDATA"/>
<include name="IDR_OS_SETTINGS_PREFS_BEHAVIOR_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/prefs/prefs_behavior.m.js"
use_base_dir="false"
compress="false"
type="BINDATA"/>
<include name="IDR_OS_SETTINGS_ROUTER_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/router.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_SETTINGS_SHARED_CSS_M_JS" <include name="IDR_OS_SETTINGS_SETTINGS_SHARED_CSS_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/settings_shared_css.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/settings_shared_css.m.js"
use_base_dir="false" use_base_dir="false"
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// #import {Route} from '../router.m.js';
/** /**
* Specifies all possible os routes in settings. * Specifies all possible os routes in settings.
* *
......
...@@ -31,6 +31,9 @@ js_library("fake_settings_search_handler") { ...@@ -31,6 +31,9 @@ js_library("fake_settings_search_handler") {
js_modulizer("modulize") { js_modulizer("modulize") {
input_files = [ input_files = [
"bluetooth_page_tests.js",
"fake_bluetooth.js",
"fake_bluetooth_private.js",
"fake_settings_search_handler.js", "fake_settings_search_handler.js",
"fake_user_action_recorder.js", "fake_user_action_recorder.js",
"localized_link_test.js", "localized_link_test.js",
......
...@@ -2,6 +2,16 @@ ...@@ -2,6 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// #import 'chrome://os-settings/chromeos/os_settings.js';
// #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
// #import {FakeBluetooth} from './fake_bluetooth.m.js'
// #import {FakeBluetoothPrivate} from './fake_bluetooth_private.m.js';
// #import {assertEquals, assertFalse, assertNotEquals, assertTrue} from '../../chai_assert.js';
// #import {eventToPromise, flushTasks} from 'chrome://test/test_util.m.js';
// #import {flush} from'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {bluetoothApis} from 'chrome://os-settings/chromeos/os_settings.js';
function getFakePrefs() { function getFakePrefs() {
return { return {
ash: { ash: {
...@@ -204,7 +214,6 @@ suite('Bluetooth', function() { ...@@ -204,7 +214,6 @@ suite('Bluetooth', function() {
div.click(); div.click();
await flushAsync(); await flushAsync();
subpage = bluetoothPage.$$('settings-bluetooth-subpage'); subpage = bluetoothPage.$$('settings-bluetooth-subpage');
subpage.listUpdateFrequencyMs = 0; subpage.listUpdateFrequencyMs = 0;
assertTrue(!!subpage); assertTrue(!!subpage);
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// #import {FakeChromeEvent} from 'chrome://test/fake_chrome_event.m.js';
// #import {assert} from 'chrome://resources/js/assert.m.js';
/** /**
* @fileoverview Fake implementation of chrome.bluetooth for testing. * @fileoverview Fake implementation of chrome.bluetooth for testing.
*/ */
...@@ -11,7 +14,7 @@ cr.define('settings', function() { ...@@ -11,7 +14,7 @@ cr.define('settings', function() {
* @constructor * @constructor
* @implements {Bluetooth} * @implements {Bluetooth}
*/ */
function FakeBluetooth() { /* #export */ function FakeBluetooth() {
/** @type {!chrome.bluetooth.AdapterState} */ this.adapterState_ = { /** @type {!chrome.bluetooth.AdapterState} */ this.adapterState_ = {
address: '00:11:22:33:44:55:66', address: '00:11:22:33:44:55:66',
name: 'Fake Adapter', name: 'Fake Adapter',
...@@ -155,5 +158,6 @@ cr.define('settings', function() { ...@@ -155,5 +158,6 @@ cr.define('settings', function() {
onDeviceRemoved: new FakeChromeEvent(), onDeviceRemoved: new FakeChromeEvent(),
}; };
// #cr_define_end
return {FakeBluetooth: FakeBluetooth}; return {FakeBluetooth: FakeBluetooth};
}); });
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// #import {FakeChromeEvent} from 'chrome://test/fake_chrome_event.m.js';
/** /**
* @fileoverview Fake implementation of chrome.bluetoothPrivate for testing. * @fileoverview Fake implementation of chrome.bluetoothPrivate for testing.
*/ */
...@@ -12,7 +14,7 @@ cr.define('settings', function() { ...@@ -12,7 +14,7 @@ cr.define('settings', function() {
* @constructor * @constructor
* @implements {BluetoothPrivate} * @implements {BluetoothPrivate}
*/ */
function FakeBluetoothPrivate(bluetoothApi) { /* #export */ function FakeBluetoothPrivate(bluetoothApi) {
/** @private {!Bluetooth} */ this.bluetoothApi_ = bluetoothApi; /** @private {!Bluetooth} */ this.bluetoothApi_ = bluetoothApi;
/** @type {!Set<string>} */ this.connectedDevices_ = new Set(); /** @type {!Set<string>} */ this.connectedDevices_ = new Set();
...@@ -106,5 +108,6 @@ cr.define('settings', function() { ...@@ -106,5 +108,6 @@ cr.define('settings', function() {
onDeviceAddressChanged: new FakeChromeEvent(), onDeviceAddressChanged: new FakeChromeEvent(),
}; };
// #cr_define_end
return {FakeBluetoothPrivate: FakeBluetoothPrivate}; return {FakeBluetoothPrivate: FakeBluetoothPrivate};
}); });
os_test_namespace_rewrites = [ os_test_namespace_rewrites = [
"reset_page.TestOsResetBrowserProxy|TestOsResetBrowserProxy", "reset_page.TestOsResetBrowserProxy|TestOsResetBrowserProxy",
"settings.TestLifetimeBrowserProxy|TestLifetimeBrowserProxy", "settings.TestLifetimeBrowserProxy|TestLifetimeBrowserProxy",
"settings.FakeBluetooth|FakeBluetooth",
"settings.FakeBluetoothPrivate|FakeBluetoothPrivate",
"test_util.flushTasks|flushTasks",
] ]
...@@ -37,6 +37,7 @@ var OSSettingsV3BrowserTest = class extends PolymerTest { ...@@ -37,6 +37,7 @@ var OSSettingsV3BrowserTest = class extends PolymerTest {
[['ResetPage', 'os_reset_page_test.m.js'], [['ResetPage', 'os_reset_page_test.m.js'],
['LocalizedLink', 'localized_link_test.m.js'], ['LocalizedLink', 'localized_link_test.m.js'],
['BluetoothPage', 'bluetooth_page_tests.m.js'],
].forEach(test => registerTest(...test)); ].forEach(test => registerTest(...test));
function registerTest(testName, module, caseName) { function registerTest(testName, module, caseName) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment