Commit e9dd35a1 authored by James Hawkins's avatar James Hawkins Committed by Commit Bot

OS Settings: Convert NetworkProxySection to Polymer 3.

R=khorimoto@chromium.org

Bug: 1045266
Test: OSSettingsNetworkProxySection*
Change-Id: I3594eadfee74353e4e9b91ced94906baa81d3813
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429245Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: James Hawkins <jhawkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810359}
parent 571684fa
...@@ -189,7 +189,7 @@ js_type_check("closure_compile_module") { ...@@ -189,7 +189,7 @@ js_type_check("closure_compile_module") {
":internet_page_browser_proxy.m", ":internet_page_browser_proxy.m",
":internet_shared_css.m", ":internet_shared_css.m",
# ":internet_subpage.m", # ":internet_subpage.m",
# ":network_proxy_section.m", ":network_proxy_section.m",
# ":network_summary.m", # ":network_summary.m",
# ":network_summary_item.m", # ":network_summary_item.m",
# ":tether_connection_dialog.m" # ":tether_connection_dialog.m"
...@@ -285,7 +285,20 @@ js_library("internet_subpage.m") { ...@@ -285,7 +285,20 @@ js_library("internet_subpage.m") {
js_library("network_proxy_section.m") { js_library("network_proxy_section.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/internet_page/network_proxy_section.m.js" ] sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/internet_page/network_proxy_section.m.js" ]
deps = [ deps = [
# TODO: Fill those in. ":internet_shared_css.m",
"//chrome/browser/resources/settings/chromeos:os_route.m",
"//chrome/browser/resources/settings/controls:extension_controlled_indicator.m",
"//chrome/browser/resources/settings/controls:settings_toggle_button.m",
"//chrome/browser/resources/settings/prefs:prefs_behavior.m",
"//chrome/browser/resources/settings:router.m",
"//third_party/polymer/v3_0/components-chromium/iron-flex-layout:iron-flex-layout-classes",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/cr_components/chromeos/network:cr_policy_network_behavior_mojo.m",
"//ui/webui/resources/cr_components/chromeos/network:cr_policy_network_indicator_mojo.m",
"//ui/webui/resources/cr_components/chromeos/network:network_proxy.m",
"//ui/webui/resources/cr_elements/cr_button:cr_button.m",
"//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m",
"//ui/webui/resources/js:i18n_behavior.m",
] ]
extra_deps = [ ":network_proxy_section_module" ] extra_deps = [ ":network_proxy_section_module" ]
} }
...@@ -377,6 +390,8 @@ polymer_modulizer("network_proxy_section") { ...@@ -377,6 +390,8 @@ polymer_modulizer("network_proxy_section") {
js_file = "network_proxy_section.js" js_file = "network_proxy_section.js"
html_file = "network_proxy_section.html" html_file = "network_proxy_section.html"
html_type = "dom-module" html_type = "dom-module"
auto_imports = os_settings_auto_imports
namespace_rewrites = os_settings_namespace_rewrites
} }
polymer_modulizer("network_summary") { polymer_modulizer("network_summary") {
......
...@@ -6,15 +6,14 @@ ...@@ -6,15 +6,14 @@
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html"> <link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html"> <link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../../controls/extension_controlled_indicator.html"> <link rel="import" href="../../controls/extension_controlled_indicator.html">
<link rel="import" href="../../controls/settings_toggle_button.html"> <link rel="import" href="../../controls/settings_toggle_button.html">
<link rel="import" href="../../i18n_setup.html">
<link rel="import" href="../../prefs/prefs_behavior.html"> <link rel="import" href="../../prefs/prefs_behavior.html">
<link rel="import" href="../../router.html">
<link rel="import" href="../../settings_vars_css.html"> <link rel="import" href="../../settings_vars_css.html">
<link rel="import" href="../os_route.html">
<link rel="import" href="internet_shared_css.html"> <link rel="import" href="internet_shared_css.html">
<dom-module id="network-proxy-section"> <dom-module id="network-proxy-section">
......
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
* detail page. This element is responsible for setting 'Allow proxies for * detail page. This element is responsible for setting 'Allow proxies for
* shared networks'. * shared networks'.
*/ */
(function() {
'use strict';
const mojom = chromeos.networkConfig.mojom;
Polymer({ Polymer({
is: 'network-proxy-section', is: 'network-proxy-section',
...@@ -63,12 +59,13 @@ Polymer({ ...@@ -63,12 +59,13 @@ Polymer({
* @private * @private
*/ */
isShared_() { isShared_() {
const mojom = chromeos.networkConfig.mojom;
return this.managedProperties.source == mojom.OncSource.kDevice || return this.managedProperties.source == mojom.OncSource.kDevice ||
this.managedProperties.source == mojom.OncSource.kDevicePolicy; this.managedProperties.source == mojom.OncSource.kDevicePolicy;
}, },
/** /**
* @return {!mojom.ManagedString|undefined} * @return {!chromeos.networkConfig.mojom.ManagedString|undefined}
* @private * @private
*/ */
getProxySettingsTypeProperty_() { getProxySettingsTypeProperty_() {
...@@ -158,4 +155,3 @@ Polymer({ ...@@ -158,4 +155,3 @@ Polymer({
this.$.allowShared.focus(); this.$.allowShared.focus();
}, },
}); });
})();
...@@ -10,6 +10,7 @@ import './bluetooth_page/bluetooth_device_list_item.m.js'; ...@@ -10,6 +10,7 @@ import './bluetooth_page/bluetooth_device_list_item.m.js';
import './internet_page/cellular_setup_dialog.m.js'; import './internet_page/cellular_setup_dialog.m.js';
import './internet_page/internet_config.m.js'; import './internet_page/internet_config.m.js';
import './internet_page/internet_known_networks_page.m.js'; import './internet_page/internet_known_networks_page.m.js';
import './internet_page/network_proxy_section.m.js';
import './nearby_share_page/nearby_share_receive_dialog.m.js'; import './nearby_share_page/nearby_share_receive_dialog.m.js';
import './nearby_share_page/nearby_share_subpage.m.js'; import './nearby_share_page/nearby_share_subpage.m.js';
import './multidevice_page/multidevice_page.m.js'; import './multidevice_page/multidevice_page.m.js';
......
...@@ -55,6 +55,11 @@ ...@@ -55,6 +55,11 @@
use_base_dir="false" use_base_dir="false"
compress="false" compress="false"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_OS_SETTINGS_NETWORK_PROXY_SECTION_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/internet_page/network_proxy_section.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_PERSONALIZATION_PAGE_M_JS" <include name="IDR_OS_SETTINGS_PERSONALIZATION_PAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.m.js"
use_base_dir="false" use_base_dir="false"
...@@ -87,6 +92,11 @@ ...@@ -87,6 +92,11 @@
use_base_dir="false" use_base_dir="false"
compress="false" compress="false"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_OS_SETTINGS_EXTENSION_CONTROLLED_INDICATOR_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/controls/extension_controlled_indicator.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_SETTINGS_RADIO_GROUP_M_JS" <include name="IDR_OS_SETTINGS_SETTINGS_RADIO_GROUP_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/controls/settings_radio_group.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/controls/settings_radio_group.m.js"
use_base_dir="false" use_base_dir="false"
...@@ -102,6 +112,11 @@ ...@@ -102,6 +112,11 @@
use_base_dir="false" use_base_dir="false"
compress="false" compress="false"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_OS_SETTINGS_EXTENSION_CONTROL_BROWSER_PROXY_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/extension_control_browser_proxy.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_LANGUAGES_PAGE_LANGUAGES_BROWSER_PROXY_M_JS" <include name="IDR_OS_SETTINGS_LANGUAGES_PAGE_LANGUAGES_BROWSER_PROXY_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/languages_page/languages_browser_proxy.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/languages_page/languages_browser_proxy.m.js"
use_base_dir="false" use_base_dir="false"
......
...@@ -301,6 +301,7 @@ if (include_js_tests) { ...@@ -301,6 +301,7 @@ if (include_js_tests) {
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/multidevice_subpage_tests.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/multidevice_subpage_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/nearby_share_receive_dialog_tests.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/nearby_share_receive_dialog_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/nearby_share_subpage_tests.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/nearby_share_subpage_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/network_proxy_section_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_edit_dictionary_page_test.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_edit_dictionary_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_languages_page_tests.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_languages_page_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_languages_page_v2_tests.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_languages_page_v2_tests.m.js",
......
...@@ -53,6 +53,7 @@ js_modulizer("modulize") { ...@@ -53,6 +53,7 @@ js_modulizer("modulize") {
"multidevice_subpage_tests.js", "multidevice_subpage_tests.js",
"nearby_share_receive_dialog_tests.js", "nearby_share_receive_dialog_tests.js",
"nearby_share_subpage_tests.js", "nearby_share_subpage_tests.js",
"network_proxy_section_test.js",
"os_edit_dictionary_page_test.js", "os_edit_dictionary_page_test.js",
"os_languages_page_tests.js", "os_languages_page_tests.js",
"os_languages_page_v2_tests.js", "os_languages_page_v2_tests.js",
......
// Copyright 2020 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.
// clang-format off
// #import 'chrome://os-settings/chromeos/os_settings.js';
// #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// clang-format on
suite('NetworkProxySection', function() {
/** @type {!NetworkProxySectionElement|undefined} */
let proxySection;
setup(function() {
proxySection = document.createElement('network-proxy-section');
proxySection.prefs = {
// prefs.settings.use_shared_proxies is set by the proxy service in CrOS,
// which does not run in the browser_tests environment.
'settings': {
'use_shared_proxies': {
key: 'use_shared_proxies',
type: chrome.settingsPrivate.PrefType.BOOLEAN,
value: true,
},
},
};
document.body.appendChild(proxySection);
Polymer.dom.flush();
});
test('Visibility of Allow Shared toggle', function() {
const mojom = chromeos.networkConfig.mojom;
const allowSharedToggle = proxySection.$.allowShared;
assertTrue(!!allowSharedToggle);
proxySection.managedProperties = {
source: mojom.OncSource.kNone,
};
assertTrue(allowSharedToggle.hidden);
proxySection.managedProperties = {
source: mojom.OncSource.kDevice,
};
assertFalse(allowSharedToggle.hidden);
proxySection.managedProperties = {
source: mojom.OncSource.kDevicePolicy,
};
assertFalse(allowSharedToggle.hidden);
proxySection.managedProperties = {
source: mojom.OncSource.kUser,
};
assertTrue(allowSharedToggle.hidden);
proxySection.managedProperties = {
source: mojom.OncSource.kUserPolicy,
};
assertTrue(allowSharedToggle.hidden);
});
});
...@@ -1172,6 +1172,22 @@ TEST_F('OSSettingsNearbyShareSubPageTest', 'AllJsTests', () => { ...@@ -1172,6 +1172,22 @@ TEST_F('OSSettingsNearbyShareSubPageTest', 'AllJsTests', () => {
mocha.run(); mocha.run();
}); });
// Test fixture for settings-internet-detail-page.
// eslint-disable-next-line no-var
var OSSettingsNetworkProxySectionTest = class extends OSSettingsBrowserTest {
/** @override */
get extraLibraries() {
return super.extraLibraries.concat([
BROWSER_SETTINGS_PATH + '../chromeos/fake_network_config_mojom.js',
'network_proxy_section_test.js',
]);
}
};
TEST_F('OSSettingsNetworkProxySectionTest', 'All', () => {
mocha.run();
});
// eslint-disable-next-line no-var // eslint-disable-next-line no-var
var OSSettingsPeoplePageAccountManagerTest = var OSSettingsPeoplePageAccountManagerTest =
class extends OSSettingsBrowserTest { class extends OSSettingsBrowserTest {
......
...@@ -104,6 +104,7 @@ TEST_F('OSSettingsNearbyShareSubPageV3Test', 'All', () => mocha.run()); ...@@ -104,6 +104,7 @@ TEST_F('OSSettingsNearbyShareSubPageV3Test', 'All', () => mocha.run());
['MultidevicePage', 'multidevice_page_tests.m.js'], ['MultidevicePage', 'multidevice_page_tests.m.js'],
['MultideviceSmartLockSubPage', 'multidevice_smartlock_subpage_test.m.js'], ['MultideviceSmartLockSubPage', 'multidevice_smartlock_subpage_test.m.js'],
['MultideviceSubPage', 'multidevice_subpage_tests.m.js'], ['MultideviceSubPage', 'multidevice_subpage_tests.m.js'],
['NetworkProxySection', 'network_proxy_section_test.m.js'],
['OsEditDictionaryPage', 'os_edit_dictionary_page_test.m.js'], ['OsEditDictionaryPage', 'os_edit_dictionary_page_test.m.js'],
['OsLanguagesPage', 'os_languages_page_tests.m.js'], ['OsLanguagesPage', 'os_languages_page_tests.m.js'],
['NearbyShareReceiveDialog', 'nearby_share_receive_dialog_tests.m.js'], ['NearbyShareReceiveDialog', 'nearby_share_receive_dialog_tests.m.js'],
......
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