Commit 997a93e6 authored by James Hawkins's avatar James Hawkins Committed by Commit Bot

cr_components/network: Convert NetworkPropertyListMojo to Polymer 3.

Bug: 1045266
Test: NetworkComponentsNetworkPropertyListMojoTest*
Change-Id: I14e9be994b77445a4106b156fcce3e48421c340b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2368494
Auto-Submit: James Hawkins <jhawkins@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Commit-Queue: James Hawkins <jhawkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800421}
parent 90cc64e6
......@@ -251,6 +251,7 @@ if (include_js_tests) {
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_list_item_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_list_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_password_input_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_elements/cr_searchable_drop_down_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/ambient_mode_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/bluetooth_page_tests.m.js",
......
......@@ -35,6 +35,7 @@ GEN('#include "content/public/test/browser_test.h"');
['NetworkList', 'network/network_list_test.js', []],
['NetworkListItem', 'network/network_list_item_test.js', []],
['NetworkPasswordInput', 'network/network_password_input_test.js', []],
['NetworkPropertyListMojo', 'network/network_property_list_mojo_test.js', []],
].forEach(test => registerTest('NetworkComponents', 'os-settings', ...test));
[
......
......@@ -16,6 +16,7 @@ GEN('#include "chromeos/constants/chromeos_features.h"');
['NetworkList', 'network/network_list_test.m.js'],
['NetworkListItem', 'network/network_list_item_test.m.js'],
['NetworkPasswordInput', 'network/network_password_input_test.m.js'],
['NetworkPropertyListMojo', 'network/network_property_list_mojo_test.m.js'],
].forEach(test => registerTest('NetworkComponents', ...test));
[['BasePage', 'cellular_setup/base_page_test.m.js'],
......
......@@ -12,5 +12,6 @@ js_modulizer("modulize") {
"network_list_item_test.js",
"network_list_test.js",
"network_password_input_test.js",
"network_property_list_mojo_test.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/strings.m.js';
// #import 'chrome://resources/cr_components/chromeos/network/network_property_list_mojo.m.js';
// #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// clang-format on
suite('NetworkPropertyListMojoTest', function() {
/** @type {!NetworkPropertyListMojo|undefined} */
let propertyList;
setup(function() {
propertyList = document.createElement('network-property-list-mojo');
const ipv4 = {
ipAddress: "100.0.0.1",
type: "IPv4",
};
propertyList.propertyDict = {ipv4: ipv4};
propertyList.fields = [
'ipv4.ipAddress',
'ipv4.routingPrefix',
'ipv4.gateway',
'ipv6.ipAddress',
];
document.body.appendChild(propertyList);
Polymer.dom.flush();
});
test('Editable field types', async () => {
// ipv4.ipAddress is not set as editable (via |editFieldTypes|), so the
// edit input does not exist.
assertEquals(null, propertyList.$$('cr-input'));
// Set ipv4.ipAddress field as editable.
propertyList.editFieldTypes = {
'ipv4.ipAddress': 'String',
};
Polymer.dom.flush();
// The input to edit the property now exists.
assertNotEquals(null, propertyList.$$('cr-input'));
});
});
......@@ -268,7 +268,7 @@ js_type_check("closure_compile_module") {
# ":network_nameservers.m",
":network_password_input.m",
# ":network_property_list_mojo.m",
":network_property_list_mojo.m",
# ":network_proxy.m",
# ":network_proxy_exclusions.m",
# ":network_proxy_input.m",
......@@ -439,7 +439,12 @@ js_library("network_password_input.m") {
js_library("network_property_list_mojo.m") {
sources = [ "$root_gen_dir/ui/webui/resources/cr_components/chromeos/network/network_property_list_mojo.m.js" ]
deps = [
# TODO: Fill those in.
":cr_policy_network_behavior_mojo.m",
":cr_policy_network_indicator_mojo.m",
":network_shared_css.m",
":onc_mojo.m",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/js:assert.m",
]
extra_deps = [ ":network_property_list_mojo_module" ]
}
......@@ -627,6 +632,7 @@ polymer_modulizer("network_property_list_mojo") {
js_file = "network_property_list_mojo.js"
html_file = "network_property_list_mojo.html"
html_type = "dom-module"
auto_imports = cr_components_chromeos_auto_imports
}
polymer_modulizer("network_proxy_exclusions") {
......
<link rel="import" href="../../../html/polymer.html">
<link rel="import" href="chrome://resources/html/assert.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_input/cr_input.html">
<link rel="import" href="../../../cr_elements/shared_style_css.html">
......@@ -7,6 +8,7 @@
<link rel="import" href="cr_policy_network_behavior_mojo.html">
<link rel="import" href="cr_policy_network_indicator_mojo.html">
<link rel="import" href="network_shared_css.html">
<link rel="import" href="onc_mojo.html">
<dom-module id="network-property-list-mojo">
<template>
......
......@@ -7,9 +7,6 @@
* in a list. This also supports editing fields inline for fields listed in
* editFieldTypes.
*/
(function() {
'use strict';
Polymer({
is: 'network-property-list-mojo',
......@@ -382,4 +379,3 @@ Polymer({
return '';
},
});
})();
......@@ -54,6 +54,10 @@
file="${root_gen_dir}/ui/webui/resources/cr_components/chromeos/network/network_password_input.m.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_WEBUI_CHROMEOS_NETWORK_PROPRETY_LIST_MOJO_M_JS"
file="${root_gen_dir}/ui/webui/resources/cr_components/chromeos/network/network_property_list_mojo.m.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_WEBUI_CHROMEOS_NETWORK_SHARED_CSS_M_JS"
file="${root_gen_dir}/ui/webui/resources/cr_components/chromeos/network/network_shared_css.m.js"
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