Commit 8f13a697 authored by Claude van der Merwe's avatar Claude van der Merwe Committed by Commit Bot

Migrate os_about_page from Polymer 2 to Polymer 3

Bug: 1045266
Change-Id: Id9424142a6da6137a0a667ab6deb7b00ce123a88
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2370603
Commit-Queue: Claude van der Merwe <cvandermerwe@google.com>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarJon Mann <jonmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801250}
parent 9cf458f4
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* url: string, * url: string,
* }} * }}
*/ */
let RegulatoryInfo; /* #export */ let RegulatoryInfo;
/** /**
* @typedef {{ * @typedef {{
...@@ -28,7 +28,7 @@ let RegulatoryInfo; ...@@ -28,7 +28,7 @@ let RegulatoryInfo;
* isLts: boolean, * isLts: boolean,
* }} * }}
*/ */
let ChannelInfo; /* #export */ let ChannelInfo;
/** /**
* @typedef {{ * @typedef {{
...@@ -37,7 +37,7 @@ let ChannelInfo; ...@@ -37,7 +37,7 @@ let ChannelInfo;
* osVersion: string, * osVersion: string,
* }} * }}
*/ */
let VersionInfo; /* #export */ let VersionInfo;
/** /**
* @typedef {{ * @typedef {{
...@@ -45,7 +45,7 @@ let VersionInfo; ...@@ -45,7 +45,7 @@ let VersionInfo;
* size: (string|undefined), * size: (string|undefined),
* }} * }}
*/ */
let AboutPageUpdateInfo; /* #export */ let AboutPageUpdateInfo;
/** /**
* @typedef {{ * @typedef {{
...@@ -59,7 +59,7 @@ let EndOfLifeInfo; ...@@ -59,7 +59,7 @@ let EndOfLifeInfo;
* Enumeration of all possible browser channels. * Enumeration of all possible browser channels.
* @enum {string} * @enum {string}
*/ */
const BrowserChannel = { /* #export */ const BrowserChannel = {
BETA: 'beta-channel', BETA: 'beta-channel',
CANARY: 'canary-channel', CANARY: 'canary-channel',
DEV: 'dev-channel', DEV: 'dev-channel',
...@@ -71,7 +71,7 @@ const BrowserChannel = { ...@@ -71,7 +71,7 @@ const BrowserChannel = {
* updateAvailable: boolean, * updateAvailable: boolean,
* }} * }}
*/ */
let TPMFirmwareUpdateStatusChangedEvent; /* #export */ let TPMFirmwareUpdateStatusChangedEvent;
// </if> // </if>
/** /**
...@@ -124,7 +124,7 @@ cr.define('settings', function() { ...@@ -124,7 +124,7 @@ cr.define('settings', function() {
* @param {boolean} isLts * @param {boolean} isLts
* @return {string} * @return {string}
*/ */
function browserChannelToI18nId(channel, isLts) { /* #export */ function browserChannelToI18nId(channel, isLts) {
if (isLts) { if (isLts) {
return 'aboutChannelLongTermStable'; return 'aboutChannelLongTermStable';
} }
...@@ -149,7 +149,8 @@ cr.define('settings', function() { ...@@ -149,7 +149,8 @@ cr.define('settings', function() {
* @return {boolean} Whether the target channel is more stable than the * @return {boolean} Whether the target channel is more stable than the
* current channel. * current channel.
*/ */
function isTargetChannelMoreStable(currentChannel, targetChannel) { /* #export */ function isTargetChannelMoreStable(
currentChannel, targetChannel) {
// List of channels in increasing stability order. // List of channels in increasing stability order.
const channelList = [ const channelList = [
BrowserChannel.CANARY, BrowserChannel.CANARY,
......
...@@ -272,7 +272,8 @@ group("closure_compile_module") { ...@@ -272,7 +272,8 @@ group("closure_compile_module") {
"multidevice_page:closure_compile_module", "multidevice_page:closure_compile_module",
#"os_a11y_page:closure_compile_module", #"os_a11y_page:closure_compile_module",
#"os_about_page:closure_compile_module", "os_about_page:closure_compile_module",
#"os_apps_page:closure_compile_module", #"os_apps_page:closure_compile_module",
#"os_apps_page/app_management_page/plugin_vm_page:closure_compile_module", #"os_apps_page/app_management_page/plugin_vm_page:closure_compile_module",
"os_files_page:closure_compile_module", "os_files_page:closure_compile_module",
...@@ -435,10 +436,13 @@ group("polymer3_elements") { ...@@ -435,10 +436,13 @@ group("polymer3_elements") {
"..:modulize", "..:modulize",
"..:settings_shared_css_module", "..:settings_shared_css_module",
"..:settings_vars_css_module", "..:settings_vars_css_module",
"../../settings:settings_page_css_module",
"../about_page:modulize",
"../nearby_share_page:polymer3_elements", "../nearby_share_page:polymer3_elements",
"../prefs:modulize", "../prefs:modulize",
"../prefs:prefs_module", "../prefs:prefs_module",
"../settings_page:settings_animated_pages_module", "../settings_page:settings_animated_pages_module",
"../settings_page:settings_section_module",
"../settings_page:settings_subpage_module", "../settings_page:settings_subpage_module",
] ]
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
let lazyLoadPromise = null; let lazyLoadPromise = null;
/** @return {!Promise<void>} Resolves when the lazy load module is imported. */ /** @return {!Promise<void>} Resolves when the lazy load module is imported. */
export function ensureLazyLoadedOs() { export function ensureLazyLoaded() {
if (!lazyLoadPromise) { if (!lazyLoadPromise) {
const script = document.createElement('script'); const script = document.createElement('script');
script.type = 'module'; script.type = 'module';
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# 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("../os_settings.gni")
js_type_check("closure_compile") { js_type_check("closure_compile") {
deps = [ deps = [
...@@ -47,21 +48,23 @@ js_library("channel_switcher_dialog") { ...@@ -47,21 +48,23 @@ js_library("channel_switcher_dialog") {
] ]
} }
# TODO: Uncomment as the Polymer3 migration makes progress. js_type_check("closure_compile_module") {
#js_type_check("closure_compile_module") { is_polymer3 = true
# is_polymer3 = true deps = [
# deps = [ ":channel_switcher_dialog.m",
# ":channel_switcher_dialog.m", ":detailed_build_info.m",
# ":detailed_build_info.m", ":os_about_page.m",
# ":os_about_page.m", ":update_warning_dialog.m",
# ":update_warning_dialog.m" ]
# ] }
#}
js_library("channel_switcher_dialog.m") { js_library("channel_switcher_dialog.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_about_page/channel_switcher_dialog.m.js" ] sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_about_page/channel_switcher_dialog.m.js" ]
deps = [ deps = [
# TODO: Fill those in. "../../about_page:about_page_browser_proxy.m",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/js:assert.m",
"//ui/webui/resources/js:load_time_data.m",
] ]
extra_deps = [ ":channel_switcher_dialog_module" ] extra_deps = [ ":channel_switcher_dialog_module" ]
} }
...@@ -69,7 +72,10 @@ js_library("channel_switcher_dialog.m") { ...@@ -69,7 +72,10 @@ js_library("channel_switcher_dialog.m") {
js_library("detailed_build_info.m") { js_library("detailed_build_info.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_about_page/detailed_build_info.m.js" ] sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_about_page/detailed_build_info.m.js" ]
deps = [ deps = [
# TODO: Fill those in. "../../about_page:about_page_browser_proxy.m",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/cr_elements/policy:cr_policy_indicator_behavior.m",
"//ui/webui/resources/js:i18n_behavior.m",
] ]
extra_deps = [ ":detailed_build_info_module" ] extra_deps = [ ":detailed_build_info_module" ]
} }
...@@ -77,7 +83,17 @@ js_library("detailed_build_info.m") { ...@@ -77,7 +83,17 @@ js_library("detailed_build_info.m") {
js_library("os_about_page.m") { js_library("os_about_page.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_about_page/os_about_page.m.js" ] sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_about_page/os_about_page.m.js" ]
deps = [ deps = [
# TODO: Fill those in. "..:os_route.m",
"../..:i18n_setup",
"../..:lifetime_browser_proxy.m",
"../..:router.m",
"../../about_page:about_page_browser_proxy.m",
"../os_settings_page:main_page_behavior.m",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/js:i18n_behavior.m",
"//ui/webui/resources/js:load_time_data.m",
"//ui/webui/resources/js:parse_html_subset.m",
"//ui/webui/resources/js:web_ui_listener_behavior.m",
] ]
extra_deps = [ ":os_about_page_module" ] extra_deps = [ ":os_about_page_module" ]
} }
...@@ -85,7 +101,9 @@ js_library("os_about_page.m") { ...@@ -85,7 +101,9 @@ js_library("os_about_page.m") {
js_library("update_warning_dialog.m") { js_library("update_warning_dialog.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_about_page/update_warning_dialog.m.js" ] sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_about_page/update_warning_dialog.m.js" ]
deps = [ deps = [
# TODO: Fill those in. "../../about_page:about_page_browser_proxy.m",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/js:i18n_behavior.m",
] ]
extra_deps = [ ":update_warning_dialog_module" ] extra_deps = [ ":update_warning_dialog_module" ]
} }
...@@ -105,22 +123,34 @@ polymer_modulizer("channel_switcher_dialog") { ...@@ -105,22 +123,34 @@ polymer_modulizer("channel_switcher_dialog") {
js_file = "channel_switcher_dialog.js" js_file = "channel_switcher_dialog.js"
html_file = "channel_switcher_dialog.html" html_file = "channel_switcher_dialog.html"
html_type = "dom-module" html_type = "dom-module"
migrated_imports = settings_migrated_imports
namespace_rewrites = os_settings_namespace_rewrites
auto_imports = os_settings_auto_imports
} }
polymer_modulizer("detailed_build_info") { polymer_modulizer("detailed_build_info") {
js_file = "detailed_build_info.js" js_file = "detailed_build_info.js"
html_file = "detailed_build_info.html" html_file = "detailed_build_info.html"
html_type = "dom-module" html_type = "dom-module"
migrated_imports = settings_migrated_imports
namespace_rewrites = os_settings_namespace_rewrites
auto_imports = os_settings_auto_imports
} }
polymer_modulizer("os_about_page") { polymer_modulizer("os_about_page") {
js_file = "os_about_page.js" js_file = "os_about_page.js"
html_file = "os_about_page.html" html_file = "os_about_page.html"
html_type = "dom-module" html_type = "dom-module"
migrated_imports = settings_migrated_imports
namespace_rewrites = os_settings_namespace_rewrites
auto_imports = os_settings_auto_imports
} }
polymer_modulizer("update_warning_dialog") { polymer_modulizer("update_warning_dialog") {
js_file = "update_warning_dialog.js" js_file = "update_warning_dialog.js"
html_file = "update_warning_dialog.html" html_file = "update_warning_dialog.html"
html_type = "dom-module" html_type = "dom-module"
migrated_imports = settings_migrated_imports
namespace_rewrites = os_settings_namespace_rewrites
auto_imports = os_settings_auto_imports
} }
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
<link rel="import" href="chrome://resources/polymer/v1_0/iron-selector/iron-selector.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-selector/iron-selector.html">
<link rel="import" href="../../about_page/about_page_browser_proxy.html"> <link rel="import" href="../../about_page/about_page_browser_proxy.html">
<link rel="import" href="../../settings_shared_css.html"> <link rel="import" href="../../settings_shared_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/load_time_data.html">
<dom-module id="settings-channel-switcher-dialog"> <dom-module id="settings-channel-switcher-dialog">
<template> <template>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<link rel="import" href="../localized_link/localized_link.html"> <link rel="import" href="../localized_link/localized_link.html">
<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/policy/cr_policy_indicator.html"> <link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator_behavior.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html">
<dom-module id="settings-detailed-build-info"> <dom-module id="settings-detailed-build-info">
......
<link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/html/parse_html_subset.html">
<link rel="import" href="../../about_page/about_page_browser_proxy.html"> <link rel="import" href="../../about_page/about_page_browser_proxy.html">
<link rel="import" href="../../i18n_setup.html"> <link rel="import" href="../../i18n_setup.html">
<!-- TODO(crbug.com/986596): Don't use browser icons here. Fork them. -->
<link rel="import" href="../../icons.html"> <link rel="import" href="../../icons.html">
<link rel="import" href="../../lifetime_browser_proxy.html"> <link rel="import" href="../../lifetime_browser_proxy.html">
<link rel="import" href="../../prefs/prefs.html"> <link rel="import" href="../../prefs/prefs.html">
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
text-align: center; text-align: center;
} }
/* TODO(crbug.com/986596): Don't use browser icons here. Fork them. */
iron-icon[icon='settings:check-circle'] { iron-icon[icon='settings:check-circle'] {
fill: var(--cros-icon-color-prominent); fill: var(--cros-icon-color-prominent);
} }
...@@ -102,6 +103,7 @@ ...@@ -102,6 +103,7 @@
when update is done) or set the src (when it's updating). --> when update is done) or set the src (when it's updating). -->
<div class="icon-container" <div class="icon-container"
hidden="[[!shouldShowIcons_(showUpdateStatus_)]]"> hidden="[[!shouldShowIcons_(showUpdateStatus_)]]">
<!-- TODO(crbug.com/986596): Don't use browser icons here. Fork them. -->
<iron-icon <iron-icon
icon$="[[getUpdateStatusIcon_( icon$="[[getUpdateStatusIcon_(
hasEndOfLife_, currentUpdateStatusEvent_)]]" hasEndOfLife_, currentUpdateStatusEvent_)]]"
......
...@@ -400,6 +400,7 @@ Polymer({ ...@@ -400,6 +400,7 @@ Polymer({
return 'cr:error'; return 'cr:error';
case UpdateStatus.UPDATED: case UpdateStatus.UPDATED:
case UpdateStatus.NEARLY_UPDATED: case UpdateStatus.NEARLY_UPDATED:
// TODO(crbug.com/986596): Don't use browser icons here. Fork them.
return 'settings:check-circle'; return 'settings:check-circle';
default: default:
return null; return null;
...@@ -464,6 +465,7 @@ Polymer({ ...@@ -464,6 +465,7 @@ Polymer({
return this.i18nAdvanced('aboutRelaunch'); return this.i18nAdvanced('aboutRelaunch');
} }
} }
return '';
}, },
/** @private */ /** @private */
......
...@@ -40,8 +40,13 @@ Polymer({ ...@@ -40,8 +40,13 @@ Polymer({
/** @private */ /** @private */
onContinueTap_() { onContinueTap_() {
if (!this.updateInfo || !this.updateInfo.version || !this.updateInfo.size){
console.log('ERROR: requestUpdateOverCellular arguments are undefined');
return;
}
this.browserProxy_.requestUpdateOverCellular( this.browserProxy_.requestUpdateOverCellular(
this.updateInfo.version, this.updateInfo.size); /** @type {!string} */ (this.updateInfo.version),
/** @type {!string} */ (this.updateInfo.size));
this.$.dialog.close(); this.$.dialog.close();
}, },
......
...@@ -74,6 +74,9 @@ os_settings_namespace_rewrites = settings_namespace_rewrites + ...@@ -74,6 +74,9 @@ os_settings_namespace_rewrites = settings_namespace_rewrites +
"settings.printing.isNameAndAddressValid|isNameAndAddressValid", "settings.printing.isNameAndAddressValid|isNameAndAddressValid",
"settings.printing.isPPDInfoValid|isPPDInfoValid", "settings.printing.isPPDInfoValid|isPPDInfoValid",
"settings.printing.getPrintServerErrorText|getPrintServerErrorText", "settings.printing.getPrintServerErrorText|getPrintServerErrorText",
"settings.AboutPageBrowserProxyImpl|AboutPageBrowserProxyImpl",
"settings.browserChannelToI18nId|browserChannelToI18nId",
"settings.isTargetChannelMoreStable|isTargetChannelMoreStable",
] ]
os_settings_auto_imports = settings_auto_imports + os_settings_auto_imports = settings_auto_imports +
...@@ -120,6 +123,9 @@ os_settings_auto_imports = settings_auto_imports + ...@@ -120,6 +123,9 @@ os_settings_auto_imports = settings_auto_imports +
"ui/webui/resources/html/web_ui_listener_behavior.html|WebUIListenerBehavior", "ui/webui/resources/html/web_ui_listener_behavior.html|WebUIListenerBehavior",
"ui/webui/resources/cr_components/chromeos/network/network_listener_behavior.html|NetworkListenerBehavior", "ui/webui/resources/cr_components/chromeos/network/network_listener_behavior.html|NetworkListenerBehavior",
"chrome/browser/resources/settings/chromeos/os_printing_page/cups_printer_types.html|PrinterListEntry,PrinterType", "chrome/browser/resources/settings/chromeos/os_printing_page/cups_printer_types.html|PrinterListEntry,PrinterType",
"chrome/browser/resources/settings/about_page/about_page_browser_proxy.html|AboutPageBrowserProxyImpl,AboutPageUpdateInfo,AboutPageBrowserProxy,browserChannelToI18nId,VersionInfo,ChannelInfo,BrowserChannel,isTargetChannelMoreStable,UpdateStatus,UpdateStatusChangedEvent,RegulatoryInfo,TPMFirmwareUpdateStatusChangedEvent",
"chrome/browser/resources/settings/chromeos/os_settings_page/main_page_behavior.html|MainPageBehavior",
"ui/webui/resources/html/parse_html_subset.html|parseHtmlSubset",
] ]
os_settings_migrated_imports = settings_migrated_imports os_settings_migrated_imports = settings_migrated_imports
...@@ -16,7 +16,12 @@ import './os_people_page/account_manager.m.js'; ...@@ -16,7 +16,12 @@ import './os_people_page/account_manager.m.js';
import './os_people_page/kerberos_accounts.m.js'; import './os_people_page/kerberos_accounts.m.js';
import './parental_controls_page/parental_controls_page.m.js'; import './parental_controls_page/parental_controls_page.m.js';
import './os_people_page/os_people_page.m.js'; import './os_people_page/os_people_page.m.js';
import './os_about_page/os_about_page.m.js';
import './os_about_page/channel_switcher_dialog.m.js';
import './os_about_page/detailed_build_info.m.js';
import './os_about_page/update_warning_dialog.m.js';
export {AboutPageBrowserProxyImpl, BrowserChannel, UpdateStatus} from '../about_page/about_page_browser_proxy.m.js';
export {LifetimeBrowserProxy, LifetimeBrowserProxyImpl} from '../lifetime_browser_proxy.m.js'; export {LifetimeBrowserProxy, LifetimeBrowserProxyImpl} from '../lifetime_browser_proxy.m.js';
export {dataUsageStringToEnum, NearbyShareDataUsage} from '../nearby_share_page/types.m.js'; export {dataUsageStringToEnum, NearbyShareDataUsage} from '../nearby_share_page/types.m.js';
export {pageVisibility} from '../page_visibility.js'; export {pageVisibility} from '../page_visibility.js';
......
...@@ -406,6 +406,49 @@ ...@@ -406,6 +406,49 @@
use_base_dir="false" use_base_dir="false"
compress="false" compress="false"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_OS_SETTINGS_OS_PRINTING_PAGE_OS_ABOUT_PAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_about_page/os_about_page.m.js"
use_base_dir="false"
compress="false"
preprocess="true"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_OS_PRINTING_PAGE_CHANNEL_SWITCHER_DIALOG_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_about_page/channel_switcher_dialog.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_OS_PRINTING_PAGE_DETAILED_BUILD_INFO_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_about_page/detailed_build_info.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_OS_PRINTING_PAGE_UPDATE_WARNING_DIALOG_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_about_page/update_warning_dialog.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_OS_SETTINGS_PAGE_MAIN_PAGE_BEHAVIOR_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_settings_page/main_page_behavior.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_SETTINGS_ABOUT_PAGE_ABOUT_PAGE_BROWSER_PROXY_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/about_page/about_page_browser_proxy.m.js"
use_base_dir="false"
compress="false"
preprocess="true"
type="BINDATA" />
<include name="IDR_SETTINGS_SETTINGS_PAGE_SETTINGS_SECTION_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/settings_page/settings_section.m.js"
use_base_dir="false"
compress="false"
type="BINDATA" />
<include name="IDR_SETTINGS_SETTINGS_PAGE_CSS_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/settings_page_css.m.js"
use_base_dir="false"
compress="false"
preprocess="true"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_OS_FILES_PAGE_OS_FILES_PAGE_M_JS" <include name="IDR_OS_SETTINGS_OS_FILES_PAGE_OS_FILES_PAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_files_page/os_files_page.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_files_page/os_files_page.m.js"
use_base_dir="false" use_base_dir="false"
......
...@@ -300,6 +300,8 @@ if (include_js_tests) { ...@@ -300,6 +300,8 @@ if (include_js_tests) {
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/cups_printer_test_utils.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/cups_printer_test_utils.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/cups_printer_landing_page_tests.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/cups_printer_landing_page_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/cups_printer_entry_tests.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/cups_printer_entry_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_about_page_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_about_page_browser_proxy_chromeos.m.js",
] ]
} }
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
......
...@@ -75,6 +75,8 @@ js_modulizer("modulize") { ...@@ -75,6 +75,8 @@ js_modulizer("modulize") {
"cups_printer_test_utils.js", "cups_printer_test_utils.js",
"cups_printer_landing_page_tests.js", "cups_printer_landing_page_tests.js",
"cups_printer_entry_tests.js", "cups_printer_entry_tests.js",
"os_about_page_tests.js",
"test_about_page_browser_proxy_chromeos.js",
] ]
namespace_rewrites = namespace_rewrites =
os_settings_namespace_rewrites + os_test_namespace_rewrites os_settings_namespace_rewrites + os_test_namespace_rewrites
......
...@@ -2,28 +2,16 @@ ...@@ -2,28 +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.
cr.define('settings_about_page', function() { // clang-format off
function registerAboutPageTests() { // #import {TestAboutPageBrowserProxyChromeOS} from './test_about_page_browser_proxy_chromeos.m.js';
/** // #import {BrowserChannel,UpdateStatus,AboutPageBrowserProxyImpl,LifetimeBrowserProxyImpl,Router, routes} from 'chrome://os-settings/chromeos/os_settings.js';
* @param {!UpdateStatus} status // #import {PromiseResolver} from 'chrome://resources/js/promise_resolver.m.js';
* @param {{ // #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
* progress: number|undefined, // #import {TestLifetimeBrowserProxy} from './test_os_lifetime_browser_proxy.m.js';
* message: string|undefined // #import {eventToPromise,flushTasks} from 'chrome://test/test_util.m.js';
* rollback: bool|undefined // clang-format on
* powerwash: bool|undefined
* }} opt_options
*/
function fireStatusChanged(status, opt_options) {
const options = opt_options || {};
cr.webUIListenerCallback('update-status-changed', {
progress: options.progress === undefined ? 1 : options.progress,
message: options.message,
status: status,
rollback: options.rollback,
powerwash: options.powerwash,
});
}
cr.define('settings_about_page', function() {
suite('AboutPageTest', function() { suite('AboutPageTest', function() {
let page = null; let page = null;
...@@ -49,6 +37,26 @@ cr.define('settings_about_page', function() { ...@@ -49,6 +37,26 @@ cr.define('settings_about_page', function() {
page = null; page = null;
}); });
/**
* @param {!UpdateStatus} status
* @param {{
* progress: number|undefined,
* message: string|undefined
* rollback: bool|undefined
* powerwash: bool|undefined
* }} opt_options
*/
function fireStatusChanged(status, opt_options) {
const options = opt_options || {};
cr.webUIListenerCallback('update-status-changed', {
progress: options.progress === undefined ? 1 : options.progress,
message: options.message,
status: status,
rollback: options.rollback,
powerwash: options.powerwash,
});
}
/** @return {!Promise} */ /** @return {!Promise} */
function initNewPage() { function initNewPage() {
aboutBrowserProxy.reset(); aboutBrowserProxy.reset();
...@@ -218,8 +226,7 @@ cr.define('settings_about_page', function() { ...@@ -218,8 +226,7 @@ cr.define('settings_about_page', function() {
* is more stable than current channel and update will powerwash. * is more stable than current channel and update will powerwash.
*/ */
test('ButtonsUpdate_BetaToStable', async () => { test('ButtonsUpdate_BetaToStable', async () => {
aboutBrowserProxy.setChannels( aboutBrowserProxy.setChannels(BrowserChannel.BETA, BrowserChannel.STABLE);
BrowserChannel.BETA, BrowserChannel.STABLE);
await initNewPage(); await initNewPage();
fireStatusChanged(UpdateStatus.NEARLY_UPDATED, {powerwash: true}); fireStatusChanged(UpdateStatus.NEARLY_UPDATED, {powerwash: true});
...@@ -241,8 +248,7 @@ cr.define('settings_about_page', function() { ...@@ -241,8 +248,7 @@ cr.define('settings_about_page', function() {
* is less stable than current channel. * is less stable than current channel.
*/ */
test('ButtonsUpdate_StableToBeta', async () => { test('ButtonsUpdate_StableToBeta', async () => {
aboutBrowserProxy.setChannels( aboutBrowserProxy.setChannels(BrowserChannel.STABLE, BrowserChannel.BETA);
BrowserChannel.STABLE, BrowserChannel.BETA);
await initNewPage(); await initNewPage();
fireStatusChanged(UpdateStatus.NEARLY_UPDATED, {powerwash: false}); fireStatusChanged(UpdateStatus.NEARLY_UPDATED, {powerwash: false});
...@@ -484,25 +490,7 @@ cr.define('settings_about_page', function() { ...@@ -484,25 +490,7 @@ cr.define('settings_about_page', function() {
return aboutBrowserProxy.whenCalled('openOsHelpPage'); return aboutBrowserProxy.whenCalled('openOsHelpPage');
}); });
}); });
}
function registerOfficialBuildTests() {
suite('AboutPageTest_OfficialBuild', function() {
test('ReportAnIssue', function() {
const browserProxy = new TestAboutPageBrowserProxyChromeOS();
settings.AboutPageBrowserProxyImpl.instance_ = browserProxy;
PolymerTest.clearBody();
const page = document.createElement('os-settings-about-page');
document.body.appendChild(page);
assertTrue(!!page.$.reportIssue);
page.$.reportIssue.click();
return browserProxy.whenCalled('openFeedbackDialog');
});
});
}
function registerDetailedBuildInfoTests() {
suite('DetailedBuildInfoTest', function() { suite('DetailedBuildInfoTest', function() {
let page = null; let page = null;
let browserProxy = null; let browserProxy = null;
...@@ -615,16 +603,15 @@ cr.define('settings_about_page', function() { ...@@ -615,16 +603,15 @@ cr.define('settings_about_page', function() {
checkCopyBuildDetailsButton(); checkCopyBuildDetailsButton();
}); });
}); });
}
function registerChannelSwitcherDialogTests() {
suite('ChannelSwitcherDialogTest', function() { suite('ChannelSwitcherDialogTest', function() {
let dialog = null; let dialog = null;
let radioButtons = null; let radioButtons = null;
let browserProxy = null; let browserProxy = null;
const currentChannel = BrowserChannel.BETA; let currentChannel;
setup(function() { setup(function() {
currentChannel = BrowserChannel.BETA;
browserProxy = new TestAboutPageBrowserProxyChromeOS(); browserProxy = new TestAboutPageBrowserProxyChromeOS();
browserProxy.setChannels(currentChannel, currentChannel); browserProxy.setChannels(currentChannel, currentChannel);
settings.AboutPageBrowserProxyImpl.instance_ = browserProxy; settings.AboutPageBrowserProxyImpl.instance_ = browserProxy;
...@@ -708,14 +695,21 @@ cr.define('settings_about_page', function() { ...@@ -708,14 +695,21 @@ cr.define('settings_about_page', function() {
assertEquals(BrowserChannel.STABLE, detail); assertEquals(BrowserChannel.STABLE, detail);
}); });
}); });
}
return { suite('AboutPageTest_OfficialBuild', function() {
registerTests: function() { test('ReportAnIssue', function() {
registerDetailedBuildInfoTests(); const browserProxy = new TestAboutPageBrowserProxyChromeOS();
registerChannelSwitcherDialogTests(); settings.AboutPageBrowserProxyImpl.instance_ = browserProxy;
registerAboutPageTests(); PolymerTest.clearBody();
}, const page = document.createElement('os-settings-about-page');
registerOfficialBuildTests: registerOfficialBuildTests, document.body.appendChild(page);
};
assertTrue(!!page.$.reportIssue);
page.$.reportIssue.click();
return browserProxy.whenCalled('openFeedbackDialog');
});
});
// #cr_define_end
return {};
}); });
...@@ -82,15 +82,13 @@ var OSSettingsAboutPageTest = class extends OSSettingsBrowserTest { ...@@ -82,15 +82,13 @@ var OSSettingsAboutPageTest = class extends OSSettingsBrowserTest {
} }
}; };
TEST_F('OSSettingsAboutPageTest', 'AboutPage', () => { TEST_F('OSSettingsAboutPageTest', 'AllBuilds', () => {
settings_about_page.registerTests(); mocha.grep('/^(?!AboutPageTest_OfficialBuild).*$/').run();
mocha.run();
}); });
GEN('#if BUILDFLAG(GOOGLE_CHROME_BRANDING)'); GEN('#if BUILDFLAG(GOOGLE_CHROME_BRANDING)');
TEST_F('OSSettingsAboutPageTest', 'AboutPage_OfficialBuild', () => { TEST_F('OSSettingsAboutPageTest', 'AboutPage_OfficialBuild', () => {
settings_about_page.registerOfficialBuildTests(); mocha.grep('AboutPageTest_OfficialBuild').run();
mocha.run();
}); });
GEN('#endif'); GEN('#endif');
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
// Polymer BrowserTest fixture. // Polymer BrowserTest fixture.
GEN_INCLUDE(['//chrome/test/data/webui/polymer_browser_test_base.js']); GEN_INCLUDE(['//chrome/test/data/webui/polymer_browser_test_base.js']);
GEN('#include "chrome/common/buildflags.h"'); GEN('#include "chrome/common/buildflags.h"');
GEN('#include "build/branding_buildflags.h"');
GEN('#include "content/public/test/browser_test.h"'); GEN('#include "content/public/test/browser_test.h"');
GEN('#include "chromeos/constants/chromeos_features.h"'); GEN('#include "chromeos/constants/chromeos_features.h"');
...@@ -65,6 +66,7 @@ var OSSettingsV3BrowserTest = class extends PolymerTest { ...@@ -65,6 +66,7 @@ var OSSettingsV3BrowserTest = class extends PolymerTest {
['CupsPrinterPage', 'cups_printer_page_tests.m.js'], ['CupsPrinterPage', 'cups_printer_page_tests.m.js'],
['CupsPrinterLandingPage', 'cups_printer_landing_page_tests.m.js'], ['CupsPrinterLandingPage', 'cups_printer_landing_page_tests.m.js'],
['CupsPrinterEntry', 'cups_printer_entry_tests.m.js'], ['CupsPrinterEntry', 'cups_printer_entry_tests.m.js'],
['AboutPage', 'os_about_page_tests.m.js'],
].forEach(test => registerTest(...test)); ].forEach(test => registerTest(...test));
function registerTest(testName, module, caseName) { function registerTest(testName, module, caseName) {
...@@ -76,5 +78,19 @@ function registerTest(testName, module, caseName) { ...@@ -76,5 +78,19 @@ function registerTest(testName, module, caseName) {
} }
}; };
// AboutPage has a test suite that can only succeed on official builds where
// the is_chrome_branded build flag is enabled
if (testName === 'AboutPage') {
TEST_F(className, 'AllBuilds' || 'All', () => {
mocha.grep('/^(?!AboutPageTest_OfficialBuild).*$/').run();
});
GEN('#if BUILDFLAG(GOOGLE_CHROME_BRANDING)');
TEST_F(className, 'OfficialBuild' || 'All', () => {
mocha.grep('AboutPageTest_OfficialBuild').run();
});
GEN('#endif');
} else {
TEST_F(className, caseName || 'All', () => mocha.run()); TEST_F(className, caseName || 'All', () => mocha.run());
}
} }
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
// 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 {TestBrowserProxy} from 'chrome://test/test_browser_proxy.m.js'; // clang-format off
// #import {BrowserChannel, UpdateStatus} from 'chrome://settings/settings.js'; // #import {TestBrowserProxy} from '../../test_browser_proxy.m.js';
// #import {BrowserChannel,UpdateStatus} from 'chrome://os-settings/chromeos/os_settings.js';
// clang-format on
/** @implements {settings.AboutPageBrowserProxy} */ /** @implements {settings.AboutPageBrowserProxy} */
/* #export */ class TestAboutPageBrowserProxyChromeOS extends TestBrowserProxy { /* #export */ class TestAboutPageBrowserProxyChromeOS extends TestBrowserProxy {
......
...@@ -12,4 +12,5 @@ cr_elements_chromeos_namespace_rewrites = [ ...@@ -12,4 +12,5 @@ cr_elements_chromeos_namespace_rewrites = [
cr_elements_chromeos_auto_imports = [ cr_elements_chromeos_auto_imports = [
"ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_types.html|CrPicture", "ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_types.html|CrPicture",
"ui/webui/resources/cr_elements/chromeos/cr_picture/png.html|convertImageSequenceToPng,isEncodedPngDataUrlAnimated", "ui/webui/resources/cr_elements/chromeos/cr_picture/png.html|convertImageSequenceToPng,isEncodedPngDataUrlAnimated",
"ui/webui/resources/cr_elements/policy/cr_policy_indicator_behavior.html|CrPolicyIndicatorType",
] ]
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