Commit 588088bc authored by James Hawkins's avatar James Hawkins Committed by Commit Bot

cr_components/network: Convert NetworkProxy to Polymer 3.

R=khorimoto@chromium.org

Bug: 1045266
Test: NetworkComponentsNetworkProxyTest*
Change-Id: I500d1455da3ecfcb3c53c8477db539eb353e88b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2412969
Commit-Queue: James Hawkins <jhawkins@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807273}
parent df8d8b5a
...@@ -271,6 +271,7 @@ if (include_js_tests) { ...@@ -271,6 +271,7 @@ if (include_js_tests) {
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_property_list_mojo_test.m.js", "$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_property_list_mojo_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_proxy_exclusions_test.m.js", "$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_proxy_exclusions_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_proxy_input_test.m.js", "$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_proxy_input_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_proxy_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_select_test.m.js", "$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_select_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_siminfo_test.m.js", "$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_siminfo_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_elements/cr_searchable_drop_down_tests.m.js", "$root_gen_dir/chrome/test/data/webui/cr_elements/cr_searchable_drop_down_tests.m.js",
......
...@@ -45,6 +45,7 @@ GEN('#include "content/public/test/browser_test.h"'); ...@@ -45,6 +45,7 @@ GEN('#include "content/public/test/browser_test.h"');
['NetworkPropertyListMojo', 'network/network_property_list_mojo_test.js', []], ['NetworkPropertyListMojo', 'network/network_property_list_mojo_test.js', []],
['NetworkProxyExclusions', 'network/network_proxy_exclusions_test.js', []], ['NetworkProxyExclusions', 'network/network_proxy_exclusions_test.js', []],
['NetworkProxyInput', 'network/network_proxy_input_test.js', []], ['NetworkProxyInput', 'network/network_proxy_input_test.js', []],
['NetworkProxy', 'network/network_proxy_test.js', []],
['NetworkSiminfo', 'network/network_siminfo_test.js', []], ['NetworkSiminfo', 'network/network_siminfo_test.js', []],
].forEach(test => registerTest('NetworkComponents', 'os-settings', ...test)); ].forEach(test => registerTest('NetworkComponents', 'os-settings', ...test));
......
...@@ -27,6 +27,7 @@ GEN('#include "chromeos/constants/chromeos_features.h"'); ...@@ -27,6 +27,7 @@ GEN('#include "chromeos/constants/chromeos_features.h"');
['NetworkPropertyListMojo', 'network/network_property_list_mojo_test.m.js'], ['NetworkPropertyListMojo', 'network/network_property_list_mojo_test.m.js'],
['NetworkProxyExclusions', 'network/network_proxy_exclusions_test.m.js'], ['NetworkProxyExclusions', 'network/network_proxy_exclusions_test.m.js'],
['NetworkProxyInput', 'network/network_proxy_input_test.m.js'], ['NetworkProxyInput', 'network/network_proxy_input_test.m.js'],
['NetworkProxy', 'network/network_proxy_test.m.js'],
['NetworkSelect', 'network/network_select_test.m.js'], ['NetworkSelect', 'network/network_select_test.m.js'],
['NetworkSiminfo', 'network/network_siminfo_test.m.js'], ['NetworkSiminfo', 'network/network_siminfo_test.m.js'],
].forEach(test => registerTest('NetworkComponents', ...test)); ].forEach(test => registerTest('NetworkComponents', ...test));
......
...@@ -23,10 +23,10 @@ js_modulizer("modulize") { ...@@ -23,10 +23,10 @@ js_modulizer("modulize") {
"network_property_list_mojo_test.js", "network_property_list_mojo_test.js",
"network_proxy_exclusions_test.js", "network_proxy_exclusions_test.js",
"network_proxy_input_test.js", "network_proxy_input_test.js",
"network_proxy_test.js",
"network_select_test.js", "network_select_test.js",
"network_siminfo_test.js", "network_siminfo_test.js",
] ]
namespace_rewrites = [ namespace_rewrites =
"network_config.MojoInterfaceProviderImpl|MojoInterfaceProviderImpl", [ "network_config.MojoInterfaceProviderImpl|MojoInterfaceProviderImpl" ]
]
} }
// 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/strings.m.js';
// #import 'chrome://resources/cr_components/chromeos/network/network_proxy.m.js';
//
// #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// clang-format on
suite('NetworkProxyTest', function() {
/** @type {!NetworkProxy|undefined} */
let netProxy;
setup(function() {
netProxy = document.createElement('network-proxy');
document.body.appendChild(netProxy);
Polymer.dom.flush();
});
test('Proxy select option change fires proxy-change event', function(done) {
let proxyType = netProxy.$.proxyType;
// Verify that changing the proxy type select option fires the proxy-change
// event with the new proxy type.
netProxy.addEventListener('proxy-change', function(e) {
assertEquals('WPAD', e.detail.type);
done();
});
// Simulate changing the proxy select option.
proxyType.value = 'WPAD';
proxyType.dispatchEvent(new Event('change'));
});
});
...@@ -253,7 +253,6 @@ js_type_check("closure_compile_module") { ...@@ -253,7 +253,6 @@ js_type_check("closure_compile_module") {
":cr_policy_network_behavior_mojo.m", ":cr_policy_network_behavior_mojo.m",
":cr_policy_network_indicator_mojo.m", ":cr_policy_network_indicator_mojo.m",
":mojo_interface_provider.m", ":mojo_interface_provider.m",
":network_apnlist.m", ":network_apnlist.m",
":network_choose_mobile.m", ":network_choose_mobile.m",
":network_config.m", ":network_config.m",
...@@ -262,17 +261,15 @@ js_type_check("closure_compile_module") { ...@@ -262,17 +261,15 @@ js_type_check("closure_compile_module") {
":network_config_select.m", ":network_config_select.m",
":network_config_toggle.m", ":network_config_toggle.m",
":network_icon.m", ":network_icon.m",
":network_ip_config.m", ":network_ip_config.m",
":network_list.m", ":network_list.m",
":network_list_item.m", ":network_list_item.m",
":network_list_types.m", ":network_list_types.m",
":network_listener_behavior.m", ":network_listener_behavior.m",
":network_nameservers.m", ":network_nameservers.m",
":network_password_input.m", ":network_password_input.m",
":network_property_list_mojo.m", ":network_property_list_mojo.m",
# ":network_proxy.m", ":network_proxy.m",
":network_proxy_exclusions.m", ":network_proxy_exclusions.m",
":network_proxy_input.m", ":network_proxy_input.m",
":network_select.m", ":network_select.m",
...@@ -511,9 +508,20 @@ js_library("network_property_list_mojo.m") { ...@@ -511,9 +508,20 @@ js_library("network_property_list_mojo.m") {
js_library("network_proxy.m") { js_library("network_proxy.m") {
sources = [ "$root_gen_dir/ui/webui/resources/cr_components/chromeos/network/network_proxy.m.js" ] sources = [ "$root_gen_dir/ui/webui/resources/cr_components/chromeos/network/network_proxy.m.js" ]
deps = [ deps = [
# TODO: Fill those in. ":cr_policy_network_behavior_mojo.m",
":network_proxy_exclusions.m",
":network_proxy_input.m",
":network_shared_css.m",
":onc_mojo.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_elements/cr_button:cr_button.m",
"//ui/webui/resources/cr_elements/cr_input:cr_input.m",
"//ui/webui/resources/cr_elements/cr_toggle:cr_toggle.m",
"//ui/webui/resources/js:assert.m",
"//ui/webui/resources/js:i18n_behavior.m",
] ]
extra_deps = [ ":modulize" ] extra_deps = [ ":network_proxy_module" ]
} }
js_library("network_proxy_exclusions.m") { js_library("network_proxy_exclusions.m") {
...@@ -612,6 +620,7 @@ group("polymer3_elements") { ...@@ -612,6 +620,7 @@ group("polymer3_elements") {
":network_property_list_mojo_module", ":network_property_list_mojo_module",
":network_proxy_exclusions_module", ":network_proxy_exclusions_module",
":network_proxy_input_module", ":network_proxy_input_module",
":network_proxy_module",
":network_select_module", ":network_select_module",
":network_shared_css_module", ":network_shared_css_module",
":network_siminfo_module", ":network_siminfo_module",
...@@ -622,9 +631,7 @@ polymer_modulizer("cr_policy_network_indicator_mojo") { ...@@ -622,9 +631,7 @@ polymer_modulizer("cr_policy_network_indicator_mojo") {
js_file = "cr_policy_network_indicator_mojo.js" js_file = "cr_policy_network_indicator_mojo.js"
html_file = "cr_policy_network_indicator_mojo.html" html_file = "cr_policy_network_indicator_mojo.html"
html_type = "dom-module" html_type = "dom-module"
auto_imports = cr_components_chromeos_auto_imports + [ auto_imports = cr_components_chromeos_auto_imports + [ "ui/webui/resources/cr_elements/policy/cr_policy_indicator_behavior.html|CrPolicyIndicatorBehavior,CrPolicyIndicatorType" ]
"ui/webui/resources/cr_elements/policy/cr_policy_indicator_behavior.html|CrPolicyIndicatorBehavior,CrPolicyIndicatorType",
]
} }
polymer_modulizer("network_apnlist") { polymer_modulizer("network_apnlist") {
...@@ -639,7 +646,8 @@ polymer_modulizer("network_choose_mobile") { ...@@ -639,7 +646,8 @@ polymer_modulizer("network_choose_mobile") {
html_file = "network_choose_mobile.html" html_file = "network_choose_mobile.html"
html_type = "dom-module" html_type = "dom-module"
auto_imports = cr_components_chromeos_auto_imports auto_imports = cr_components_chromeos_auto_imports
namespace_rewrites = cr_components_chromeos_namespace_rewrites + [ namespace_rewrites =
cr_components_chromeos_namespace_rewrites + [
"cros_network_config.mojom.m.js|cros_network_config.mojom-lite.js", "cros_network_config.mojom.m.js|cros_network_config.mojom-lite.js",
"ip_address.mojom.m.js|ip_address.mojom-lite.js", "ip_address.mojom.m.js|ip_address.mojom-lite.js",
"mojo_bindings_lite.m.js|mojo_bindings_lite.js", "mojo_bindings_lite.m.js|mojo_bindings_lite.js",
...@@ -740,6 +748,14 @@ polymer_modulizer("network_proxy_exclusions") { ...@@ -740,6 +748,14 @@ polymer_modulizer("network_proxy_exclusions") {
namespace_rewrites = cr_components_chromeos_namespace_rewrites namespace_rewrites = cr_components_chromeos_namespace_rewrites
} }
polymer_modulizer("network_proxy") {
js_file = "network_proxy.js"
html_file = "network_proxy.html"
html_type = "dom-module"
auto_imports = cr_components_chromeos_auto_imports
namespace_rewrites = cr_components_chromeos_namespace_rewrites
}
polymer_modulizer("network_proxy_input") { polymer_modulizer("network_proxy_input") {
js_file = "network_proxy_input.js" js_file = "network_proxy_input.js"
html_file = "network_proxy_input.html" html_file = "network_proxy_input.html"
...@@ -779,7 +795,6 @@ js_modulizer("modulize") { ...@@ -779,7 +795,6 @@ js_modulizer("modulize") {
"network_config_element_behavior.js", "network_config_element_behavior.js",
"network_listener_behavior.js", "network_listener_behavior.js",
"network_list_types.js", "network_list_types.js",
"network_proxy.js",
"onc_mojo.js", "onc_mojo.js",
] ]
namespace_rewrites = cr_components_chromeos_namespace_rewrites namespace_rewrites = cr_components_chromeos_namespace_rewrites
......
<link rel="import" href="../../../html/polymer.html"> <link rel="import" href="../../../html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
<link rel="import" href="chrome://resources/html/assert.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="../../../cr_elements/cr_button/cr_button.html">
<link rel="import" href="../../../cr_elements/cr_input/cr_input.html">
<link rel="import" href="../../../cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="../../../cr_elements/hidden_style_css.html">
<link rel="import" href="../../../html/assert.html">
<link rel="import" href="../../../html/i18n_behavior.html">
<link rel="import" href="../../../cr_elements/md_select_css.html">
<link rel="import" href="cr_policy_network_behavior_mojo.html"> <link rel="import" href="cr_policy_network_behavior_mojo.html">
<link rel="import" href="network_proxy_exclusions.html"> <link rel="import" href="network_proxy_exclusions.html">
<link rel="import" href="network_proxy_input.html"> <link rel="import" href="network_proxy_input.html">
<link rel="import" href="network_shared_css.html"> <link rel="import" href="network_shared_css.html">
<link rel="import" href="onc_mojo.html">
<dom-module id="network-proxy"> <dom-module id="network-proxy">
<template> <template>
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
* @fileoverview Polymer element for displaying and editing network proxy * @fileoverview Polymer element for displaying and editing network proxy
* values. * values.
*/ */
(function() {
'use strict';
Polymer({ Polymer({
is: 'network-proxy', is: 'network-proxy',
...@@ -563,4 +561,3 @@ Polymer({ ...@@ -563,4 +561,3 @@ Polymer({
return property === value; return property === value;
}, },
}); });
})();
...@@ -116,6 +116,10 @@ ...@@ -116,6 +116,10 @@
file="${root_gen_dir}/ui/webui/resources/cr_components/chromeos/network/network_proxy_input.m.js" file="${root_gen_dir}/ui/webui/resources/cr_components/chromeos/network/network_proxy_input.m.js"
use_base_dir="false" use_base_dir="false"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_WEBUI_CHROMEOS_NETWORK_PROXY_M_JS"
file="${root_gen_dir}/ui/webui/resources/cr_components/chromeos/network/network_proxy.m.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_WEBUI_CHROMEOS_NETWORK_SELECT_M_JS" <include name="IDR_WEBUI_CHROMEOS_NETWORK_SELECT_M_JS"
file="${root_gen_dir}/ui/webui/resources/cr_components/chromeos/network/network_select.m.js" file="${root_gen_dir}/ui/webui/resources/cr_components/chromeos/network/network_select.m.js"
use_base_dir="false" use_base_dir="false"
......
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