Commit 8dcadfb3 authored by dpapad's avatar dpapad Committed by Commit Bot

Settings: Port privacy_page/personalization_options.html to Polymer3.

Bug: 1026426
Change-Id: I35b0fd47a1662d600779a904a18f99f163087c06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2119583
Commit-Queue: dpapad <dpapad@chromium.org>
Reviewed-by: default avatarJohn Lee <johntlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753473}
parent 86d0cca4
......@@ -444,7 +444,6 @@ polymer_modulizer("sync_page") {
js_file = "sync_page.js"
html_file = "sync_page.html"
html_type = "dom-module"
ignore_imports = [ "chrome/browser/resources/settings/privacy_page/personalization_options.html" ]
namespace_rewrites = settings_namespace_rewrites
auto_imports = settings_auto_imports + [
"ui/webui/resources/html/polymer.html|Polymer,html,flush",
......
......@@ -3,6 +3,9 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/polymer/polymer.gni")
import("//ui/webui/resources/tools/js_modulizer.gni")
import("../settings.gni")
js_type_check("closure_compile") {
deps = [
......@@ -200,23 +203,25 @@ js_library("security_page") {
}
# TODO(crbug.com/1026426): Fix and enable.
#js_type_check("closure_compile_module") {
# is_polymer3 = true
# deps = [
# ":passwords_leak_detection_toggle.m",
# ":personalization_options.m",
# ":privacy_page.m",
# ":privacy_page_browser_proxy.m",
# ":security_keys_bio_enroll_dialog.m",
# ":security_keys_browser_proxy.m",
# ":security_keys_credential_management_dialog.m",
# ":security_keys_pin_field.m",
# ":security_keys_reset_dialog.m",
# ":security_keys_set_pin_dialog.m",
# ":security_keys_subpage.m",
# ":security_page.m",
# ]
#}
js_type_check("closure_compile_module") {
is_polymer3 = true
deps = [
#":passwords_leak_detection_toggle.m",
":personalization_options.m",
#":privacy_page.m",
":privacy_page_browser_proxy.m",
#":security_keys_bio_enroll_dialog.m",
#":security_keys_browser_proxy.m",
#":security_keys_credential_management_dialog.m",
#":security_keys_pin_field.m",
#":security_keys_reset_dialog.m",
#":security_keys_set_pin_dialog.m",
#":security_keys_subpage.m",
#":security_page.m",
]
}
js_library("passwords_leak_detection_toggle.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/privacy_page/passwords_leak_detection_toggle.m.js" ]
......@@ -229,7 +234,15 @@ js_library("passwords_leak_detection_toggle.m") {
js_library("personalization_options.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/privacy_page/personalization_options.m.js" ]
deps = [
# TODO: Fill those in.
":privacy_page_browser_proxy.m",
"..:i18n_setup.m",
"..:lifetime_browser_proxy.m",
"../controls:settings_toggle_button.m",
"../people_page:signout_dialog.m",
"../people_page:sync_browser_proxy.m",
"../prefs:prefs_behavior.m",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/js:web_ui_listener_behavior.m",
]
extra_deps = [ ":personalization_options_module" ]
}
......@@ -244,9 +257,7 @@ js_library("privacy_page.m") {
js_library("privacy_page_browser_proxy.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/privacy_page/privacy_page_browser_proxy.m.js" ]
deps = [
# TODO: Fill those in.
]
deps = [ "//ui/webui/resources/js:cr.m" ]
extra_deps = [ ":modulize" ]
}
......@@ -314,8 +325,6 @@ js_library("security_page.m") {
extra_deps = [ ":security_page_module" ]
}
import("//tools/polymer/polymer.gni")
group("polymer3_elements") {
public_deps = [
":modulize",
......@@ -342,6 +351,12 @@ polymer_modulizer("personalization_options") {
js_file = "personalization_options.js"
html_file = "personalization_options.html"
html_type = "dom-module"
namespace_rewrites = settings_namespace_rewrites
auto_imports = settings_auto_imports + [
"chrome/browser/resources/settings/privacy_page/privacy_page_browser_proxy.html|PrivacyPageBrowserProxy,PrivacyPageBrowserProxyImpl,MetricsReporting",
"chrome/browser/resources/settings/people_page/sync_browser_proxy.html|StatusAction,SyncStatus",
"chrome/browser/resources/settings/lifetime_browser_proxy.html|LifetimeBrowserProxyImpl",
]
}
polymer_modulizer("privacy_page") {
......@@ -392,11 +407,11 @@ polymer_modulizer("security_page") {
html_type = "dom-module"
}
import("//ui/webui/resources/tools/js_modulizer.gni")
js_modulizer("modulize") {
input_files = [
"privacy_page_browser_proxy.js",
"security_keys_browser_proxy.js",
]
namespace_rewrites = settings_namespace_rewrites
}
......@@ -4,6 +4,7 @@
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../lifetime_browser_proxy.html">
<link rel="import" href="../people_page/signout_dialog.html">
<link rel="import" href="../people_page/sync_browser_proxy.html">
......
......@@ -24,8 +24,10 @@ Polymer({
},
/**
* TODO(dpapad): Restore actual type !PrivacyPageVisibility after this file
* is no longer reused by chrome://os-settings.
* Dictionary defining page visibility.
* @type {!PrivacyPageVisibility}
* @type {!Object}
*/
pageVisibility: Object,
......@@ -71,6 +73,9 @@ Polymer({
},
},
/** @private {?settings.PrivacyPageBrowserProxy} */
browserProxy_: null,
/**
* @return {boolean}
* @private
......
......@@ -4,9 +4,13 @@
/** @fileoverview Handles interprocess communication for the privacy page. */
// clang-format off
// #import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
// clang-format on
cr.define('settings', function() {
/** @typedef {{enabled: boolean, managed: boolean}} */
let MetricsReporting;
/* #export */ let MetricsReporting;
/** @typedef {{name: string, value: string, policy: string}} */
let ResolverOption;
......@@ -16,7 +20,7 @@ cr.define('settings', function() {
* kept in sync with the modes in chrome/browser/net/dns_util.h.
* @enum {string}
*/
const SecureDnsMode = {
/* #export */ const SecureDnsMode = {
OFF: 'off',
AUTOMATIC: 'automatic',
SECURE: 'secure',
......@@ -27,7 +31,7 @@ cr.define('settings', function() {
* the management modes in chrome/browser/net/dns_util.h.
* @enum {number}
*/
const SecureDnsUiManagementMode = {
/* #export */ const SecureDnsUiManagementMode = {
NO_OVERRIDE: 0,
DISABLED_MANAGED: 1,
DISABLED_PARENTAL_CONTROLS: 2,
......@@ -43,7 +47,7 @@ cr.define('settings', function() {
let SecureDnsSetting;
/** @interface */
class PrivacyPageBrowserProxy {
/* #export */ class PrivacyPageBrowserProxy {
// <if expr="_google_chrome and not chromeos">
/** @return {!Promise<!settings.MetricsReporting>} */
getMetricsReporting() {}
......@@ -93,7 +97,7 @@ cr.define('settings', function() {
/**
* @implements {settings.PrivacyPageBrowserProxy}
*/
class PrivacyPageBrowserProxyImpl {
/* #export */ class PrivacyPageBrowserProxyImpl {
// <if expr="_google_chrome and not chromeos">
/** @override */
getMetricsReporting() {
......
......@@ -54,15 +54,21 @@ settings_namespace_rewrites = [
"Settings.PrefUtil.stringToPrefValue|stringToPrefValue",
"settings.PrintingBrowserProxy|PrintingBrowserProxy",
"settings.PrivacyElementInteractions|PrivacyElementInteractions",
"settings.PrivacyPageBrowserProxy|PrivacyPageBrowserProxy",
"settings.ProfileInfoBrowserProxy|ProfileInfoBrowserProxy",
"settings.ProfileInfo|ProfileInfo",
"settings.ProfileShortcutStatus|ProfileShortcutStatus",
"settings.ResetBrowserProxy|ResetBrowserProxy",
"settings.ResolverOption|ResolverOption",
"settings.Route|Route",
"settings.routes|routes",
"settings.SearchEnginesBrowserProxy|SearchEnginesBrowserProxy",
"settings.SearchRequest|SearchRequest",
"settings.SearchResult|SearchResult",
"settings.SecureDnsMode|SecureDnsMode",
"settings.SecureDnsSetting|SecureDnsSetting",
"settings.SecureDnsUiManagementMode|SecureDnsUiManagementMode",
"settings.MetricsReporting|MetricsReporting",
"settings.SITE_EXCEPTION_WILDCARD|SITE_EXCEPTION_WILDCARD",
"settings.SiteSettingSource|SiteSettingSource",
"settings.SiteSettingsPrefsBrowserProxy|SiteSettingsPrefsBrowserProxy",
......
......@@ -56,3 +56,4 @@ export {ResetBrowserProxyImpl} from './reset_page/reset_browser_proxy.m.js';
export {routes} from './route.m.js';
export {Route, Router} from './router.m.js';
export {SearchEnginesBrowserProxyImpl} from './search_engines_page/search_engines_browser_proxy.m.js';
export {PrivacyPageBrowserProxyImpl, SecureDnsMode, SecureDnsUiManagementMode} from './privacy_page/privacy_page_browser_proxy.m.js';
......@@ -447,6 +447,16 @@
use_base_dir="false"
preprocess="true"
type="BINDATA" />
<include name="IDR_SETTINGS_PRIVACY_PAGE_PERSONALIZATION_OPTIONS_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/privacy_page/personalization_options.m.js"
use_base_dir="false"
preprocess="true"
type="BINDATA" />
<include name="IDR_SETTINGS_PRIVACY_PAGE_BROWSER_PROXY_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/privacy_page/privacy_page_browser_proxy.m.js"
use_base_dir="false"
preprocess="true"
type="BINDATA" />
<include name="IDR_SETTINGS_RESET_PAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/reset_page/reset_page.m.js"
use_base_dir="false"
......
......@@ -246,6 +246,7 @@ js2gtest("browser_tests_js_webui") {
"$root_gen_dir/chrome/test/data/webui/settings/people_page_sync_controls_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/people_page_sync_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/people_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/personalization_options_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/pref_util_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/prefs_test_cases.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/prefs_tests.m.js",
......@@ -275,6 +276,7 @@ js2gtest("browser_tests_js_webui") {
"$root_gen_dir/chrome/test/data/webui/settings/test_lifetime_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/test_open_window_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/test_password_manager_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/test_privacy_page_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/test_profile_info_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/test_reset_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/test_search_engines_browser_proxy.m.js",
......
......@@ -42,6 +42,7 @@ js_modulizer("modulize") {
"people_page_sync_controls_test.js",
"people_page_sync_page_test.js",
"people_page_sync_page_interactive_test.js",
"personalization_options_test.js",
"prefs_test_cases.js",
"prefs_tests.js",
"pref_util_tests.js",
......@@ -73,6 +74,7 @@ js_modulizer("modulize") {
"test_metrics_browser_proxy.js",
"test_open_window_proxy.js",
"test_password_manager_proxy.js",
"test_privacy_page_browser_proxy.js",
"test_profile_info_browser_proxy.js",
"test_reset_browser_proxy.js",
"test_search_engines_browser_proxy.js",
......
......@@ -1003,17 +1003,17 @@ CrSettingsPersonalizationOptionsTest.prototype = {
};
TEST_F('CrSettingsPersonalizationOptionsTest', 'AllBuilds', function() {
mocha.grep('PersonalizationOptionsTests_AllBuilds').run();
runMochaSuite('PersonalizationOptionsTests_AllBuilds');
});
GEN('#if BUILDFLAG(GOOGLE_CHROME_BRANDING)');
TEST_F('CrSettingsPersonalizationOptionsTest', 'OfficialBuild', function() {
mocha.grep('PersonalizationOptionsTests_OfficialBuild').run();
runMochaSuite('PersonalizationOptionsTests_OfficialBuild');
});
GEN('#endif');
TEST_F('CrSettingsPersonalizationOptionsTest', 'AllBuildsOld', function() {
mocha.grep('PersonalizationOptionsTests_AllBuilds_Old').run();
runMochaSuite('PersonalizationOptionsTests_AllBuilds_Old');
});
/**
......
......@@ -233,6 +233,30 @@ TEST_F('CrSettingsSiteListV3Test', 'AddExceptionDialog', function() {
runMochaSuite('AddExceptionDialog');
});
// eslint-disable-next-line no-var
var CrSettingsPersonalizationOptionsV3Test =
class extends CrSettingsV3BrowserTest {
/** @override */
get browsePreload() {
return 'chrome://settings/test_loader.html?module=settings/personalization_options_test.m.js';
}
};
TEST_F('CrSettingsPersonalizationOptionsV3Test', 'AllBuilds', function() {
runMochaSuite('PersonalizationOptionsTests_AllBuilds');
});
GEN('#if BUILDFLAG(GOOGLE_CHROME_BRANDING)');
TEST_F('CrSettingsPersonalizationOptionsV3Test', 'OfficialBuild', function() {
runMochaSuite('PersonalizationOptionsTests_OfficialBuild');
});
GEN('#endif');
TEST_F('CrSettingsPersonalizationOptionsV3Test', 'AllBuildsOld', function() {
runMochaSuite('PersonalizationOptionsTests_AllBuilds_Old');
});
[['AppearanceFontsPage', 'appearance_fonts_page_test.m.js'],
['AppearancePage', 'appearance_page_test.m.js'],
['AutofillPage', 'autofill_page_test.m.js'],
......
......@@ -2,6 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// clang-format off
// #import {PrivacyPageBrowserProxyImpl, StatusAction, SyncBrowserProxyImpl} from 'chrome://settings/settings.js';
// #import 'chrome://settings/lazy_load.js';
// #import {TestSyncBrowserProxy} from 'chrome://test/settings/test_sync_browser_proxy.m.js';
// #import {TestPrivacyPageBrowserProxy} from 'chrome://test/settings/test_privacy_page_browser_proxy.m.js';
// #import {isChromeOS} from 'chrome://resources/js/cr.m.js';
// #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {isVisible, isChildVisible, eventToPromise} from 'chrome://test/test_util.m.js';
// clang-format on
cr.define('settings_personalization_options', function() {
suite('PersonalizationOptionsTests_AllBuilds', function() {
......@@ -258,4 +268,5 @@ cr.define('settings_personalization_options', function() {
assertTrue(test_util.isChildVisible(testElement, '#linkDoctor'));
});
});
// #cr_define_end
});
......@@ -2,8 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// clang-format off
// #import {TestBrowserProxy} from 'chrome://test/test_browser_proxy.m.js';
// #import {SecureDnsUiManagementMode, SecureDnsMode} from 'chrome://settings/settings.js';
// clang-format on
/** @implements {settings.PrivacyPageBrowserProxy} */
class TestPrivacyPageBrowserProxy extends TestBrowserProxy {
/* #export */ class TestPrivacyPageBrowserProxy extends TestBrowserProxy {
constructor() {
super([
'getMetricsReporting',
......
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