Commit ff09bc4d authored by Demetrios Papadopoulos's avatar Demetrios Papadopoulos Committed by Commit Bot

SplitSettings: Remove parental controls from Browser settings.

Also move corresponding tests to os_settings_browsertest.js.

This UI is already available on the OS Settings, and does not need
to be shown in the browser settings.

Bug: 986596
Change-Id: Ia8043cd0a97e4142e62766a5576b4f232fc6cdaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1992818
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#730236}
parent 542d248a
...@@ -105,10 +105,7 @@ group("closure_compile") { ...@@ -105,10 +105,7 @@ group("closure_compile") {
} }
if (is_chromeos) { if (is_chromeos) {
deps += [ deps += [ "chromeos:closure_compile" ]
"chromeos:closure_compile",
"parental_controls_page:closure_compile",
]
} }
} }
......
...@@ -94,6 +94,7 @@ group("closure_compile") { ...@@ -94,6 +94,7 @@ group("closure_compile") {
"os_settings_menu:closure_compile", "os_settings_menu:closure_compile",
"os_settings_page:closure_compile", "os_settings_page:closure_compile",
"os_settings_ui:closure_compile", "os_settings_ui:closure_compile",
"parental_controls_page:closure_compile",
"personalization_page:closure_compile", "personalization_page:closure_compile",
"plugin_vm_page:closure_compile", "plugin_vm_page:closure_compile",
] ]
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<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/settings_toggle_button.html"> <link rel="import" href="../../controls/settings_toggle_button.html">
<link rel="import" href="../../icons.html"> <link rel="import" href="../../icons.html">
<link rel="import" href="../../parental_controls_page/parental_controls_page.html"> <link rel="import" href="../parental_controls_page/parental_controls_page.html">
<link rel="import" href="../../people_page/account_manager_browser_proxy.html"> <link rel="import" href="../../people_page/account_manager_browser_proxy.html">
<link rel="import" href="../../people_page/profile_info_browser_proxy.html"> <link rel="import" href="../../people_page/profile_info_browser_proxy.html">
<link rel="import" href="../../people_page/signout_dialog.html"> <link rel="import" href="../../people_page/signout_dialog.html">
......
...@@ -19,7 +19,7 @@ js_library("parental_controls_browser_proxy") { ...@@ -19,7 +19,7 @@ js_library("parental_controls_browser_proxy") {
js_library("parental_controls_page") { js_library("parental_controls_page") {
deps = [ deps = [
":parental_controls_browser_proxy", ":parental_controls_browser_proxy",
"..:route", "../..:route",
"//ui/webui/resources/js:cr", "//ui/webui/resources/js:cr",
"//ui/webui/resources/js:i18n_behavior", "//ui/webui/resources/js:i18n_behavior",
"//ui/webui/resources/js:web_ui_listener_behavior", "//ui/webui/resources/js:web_ui_listener_behavior",
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<link rel="import" href="chrome://resources/html/cr.html"> <link rel="import" href="chrome://resources/html/cr.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="parental_controls_browser_proxy.html"> <link rel="import" href="parental_controls_browser_proxy.html">
<link rel="import" href="../i18n_setup.html"> <link rel="import" href="../../i18n_setup.html">
<link rel="import" href="../icons.html"> <link rel="import" href="../../icons.html">
<link rel="import" href="../route.html"> <link rel="import" href="../../route.html">
<link rel="import" href="../settings_page/settings_animated_pages.html"> <link rel="import" href="../../settings_page/settings_animated_pages.html">
<link rel="import" href="../settings_page/settings_subpage.html"> <link rel="import" href="../../settings_page/settings_subpage.html">
<link rel="import" href="../settings_shared_css.html"> <link rel="import" href="../../settings_shared_css.html">
<dom-module id="settings-parental-controls-page"> <dom-module id="settings-parental-controls-page">
<template> <template>
......
...@@ -1061,17 +1061,17 @@ ...@@ -1061,17 +1061,17 @@
<structure name="IDR_OS_SETTINGS_TETHER_CONNECTION_DIALOG_JS" <structure name="IDR_OS_SETTINGS_TETHER_CONNECTION_DIALOG_JS"
file="chromeos/internet_page/tether_connection_dialog.js" file="chromeos/internet_page/tether_connection_dialog.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_SETTINGS_PARENTAL_CONTROLS_BROWSER_PROXY_HTML" <structure name="IDR_OS_SETTINGS_PARENTAL_CONTROLS_BROWSER_PROXY_HTML"
file="parental_controls_page/parental_controls_browser_proxy.html" file="chromeos/parental_controls_page/parental_controls_browser_proxy.html"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_SETTINGS_PARENTAL_CONTROLS_BROWSER_PROXY_JS" <structure name="IDR_OS_SETTINGS_PARENTAL_CONTROLS_BROWSER_PROXY_JS"
file="parental_controls_page/parental_controls_browser_proxy.js" file="chromeos/parental_controls_page/parental_controls_browser_proxy.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_OS_SETTINGS_PARENTAL_CONTROLS_PAGE_HTML" <structure name="IDR_OS_SETTINGS_PARENTAL_CONTROLS_PAGE_HTML"
file="parental_controls_page/parental_controls_page.html" file="chromeos/parental_controls_page/parental_controls_page.html"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_OS_SETTINGS_PARENTAL_CONTROLS_PAGE_JS" <structure name="IDR_OS_SETTINGS_PARENTAL_CONTROLS_PAGE_JS"
file="parental_controls_page/parental_controls_page.js" file="chromeos/parental_controls_page/parental_controls_page.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_ACCOUNT_MANAGER_HTML" <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_ACCOUNT_MANAGER_HTML"
file="chromeos/os_people_page/account_manager.html" file="chromeos/os_people_page/account_manager.html"
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
<link rel="import" href="account_manager_browser_proxy.html"> <link rel="import" href="account_manager_browser_proxy.html">
<link rel="import" href="change_picture.html"> <link rel="import" href="change_picture.html">
<link rel="import" href="chrome://resources/cr_elements/chromeos/cr_picture/cr_png_behavior.html"> <link rel="import" href="chrome://resources/cr_elements/chromeos/cr_picture/cr_png_behavior.html">
<link rel="import" href="../parental_controls_page/parental_controls_page.html">
</if> </if>
<if expr="not chromeos"> <if expr="not chromeos">
<link rel="import" href="chrome://resources/cr_elements/cr_toast/cr_toast.html"> <link rel="import" href="chrome://resources/cr_elements/cr_toast/cr_toast.html">
...@@ -218,13 +217,6 @@ ...@@ -218,13 +217,6 @@
</template> </template>
</if> </if>
<if expr="chromeos">
<template is="dom-if" if="[[showParentalControls_]]">
<settings-parental-controls-page>
</settings-parental-controls-page>
</template>
</if>
<if expr="not chromeos"> <if expr="not chromeos">
<cr-link-row id="importDataDialogTrigger" <cr-link-row id="importDataDialogTrigger"
label="$i18n{importTitle}" label="$i18n{importTitle}"
......
...@@ -117,17 +117,6 @@ Polymer({ ...@@ -117,17 +117,6 @@ Polymer({
/** @private */ /** @private */
showSignoutDialog_: Boolean, showSignoutDialog_: Boolean,
// <if expr="chromeos">
/** @private */
showParentalControls_: {
type: Boolean,
value: function() {
return loadTimeData.valueExists('showParentalControls') &&
loadTimeData.getBoolean('showParentalControls');
},
},
// </if>
/** @private {!Map<string, string>} */ /** @private {!Map<string, string>} */
focusConfig_: { focusConfig_: {
type: Object, type: Object,
......
...@@ -1056,18 +1056,6 @@ ...@@ -1056,18 +1056,6 @@
file="site_settings/zoom_levels.js" file="site_settings/zoom_levels.js"
type="chrome_html" /> type="chrome_html" />
<if expr="chromeos"> <if expr="chromeos">
<structure name="IDR_SETTINGS_PARENTAL_CONTROLS_BROWSER_PROXY_HTML"
file="parental_controls_page/parental_controls_browser_proxy.html"
type="chrome_html" />
<structure name="IDR_SETTINGS_PARENTAL_CONTROLS_BROWSER_PROXY_JS"
file="parental_controls_page/parental_controls_browser_proxy.js"
type="chrome_html" />
<structure name="IDR_SETTINGS_PARENTAL_CONTROLS_HTML"
file="parental_controls_page/parental_controls_page.html"
type="chrome_html" />
<structure name="IDR_SETTINGS_PARENTAL_CONTROLS_PAGE_JS"
file="parental_controls_page/parental_controls_page.js"
type="chrome_html" />
<structure name="IDR_SETTINGS_PEOPLE_PAGE_ACCOUNT_MANAGER_BROWSER_PROXY_HTML" <structure name="IDR_SETTINGS_PEOPLE_PAGE_ACCOUNT_MANAGER_BROWSER_PROXY_HTML"
file="people_page/account_manager_browser_proxy.html" file="people_page/account_manager_browser_proxy.html"
type="chrome_html"/> type="chrome_html"/>
......
...@@ -92,7 +92,6 @@ ...@@ -92,7 +92,6 @@
#include "chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h" #include "chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h" #include "chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/multidevice_handler.h" #include "chrome/browser/ui/webui/settings/chromeos/multidevice_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/grit/browser_resources.h" #include "chrome/grit/browser_resources.h"
#include "chromeos/components/account_manager/account_manager.h" #include "chromeos/components/account_manager/account_manager.h"
...@@ -240,9 +239,6 @@ SettingsUI::SettingsUI(content::WebUI* web_ui) ...@@ -240,9 +239,6 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
base::FeatureList::IsEnabled(features::kSyncSetupFriendlySettings)); base::FeatureList::IsEnabled(features::kSyncSetupFriendlySettings));
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
html_source->AddBoolean(
"showParentalControls",
chromeos::settings::ShouldShowParentalControls(profile));
html_source->AddBoolean("splitSettingsSyncEnabled", html_source->AddBoolean("splitSettingsSyncEnabled",
chromeos::features::IsSplitSettingsSyncEnabled()); chromeos::features::IsSplitSettingsSyncEnabled());
#endif #endif
...@@ -326,11 +322,6 @@ void SettingsUI::InitBrowserSettingsWebUIHandlers( ...@@ -326,11 +322,6 @@ void SettingsUI::InitBrowserSettingsWebUIHandlers(
: nullptr, : nullptr,
android_sms_service ? android_sms_service->android_sms_app_manager() android_sms_service ? android_sms_service->android_sms_app_manager()
: nullptr)); : nullptr));
if (chromeos::settings::ShouldShowParentalControls(profile)) {
web_ui->AddMessageHandler(
std::make_unique<chromeos::settings::ParentalControlsHandler>(
profile));
}
} }
web_ui->AddMessageHandler( web_ui->AddMessageHandler(
......
...@@ -144,6 +144,20 @@ cr.define('settings_people_page', function() { ...@@ -144,6 +144,20 @@ cr.define('settings_people_page', function() {
assertTrue(peoplePage.$$('#account-manager-subpage-trigger').hidden); assertTrue(peoplePage.$$('#account-manager-subpage-trigger').hidden);
}); });
test('parental controls page is shown when enabled', () => {
loadTimeData.overrideValues({
// Simulate parental controls.
showParentalControls: true,
});
peoplePage = document.createElement('os-settings-people-page');
document.body.appendChild(peoplePage);
Polymer.dom.flush();
// Setup button is shown and enabled.
assert(peoplePage.$$('settings-parental-controls-page'));
});
test('GAIA name and picture, account manager enabled', async () => { test('GAIA name and picture, account manager enabled', async () => {
loadTimeData.overrideValues({ loadTimeData.overrideValues({
isAccountManagerEnabled: true, isAccountManagerEnabled: true,
......
...@@ -578,6 +578,12 @@ TEST_F('OSSettingsMainTest', 'AllJsTests', () => { ...@@ -578,6 +578,12 @@ TEST_F('OSSettingsMainTest', 'AllJsTests', () => {
// Tests for the side-nav menu. // Tests for the side-nav menu.
// eslint-disable-next-line no-var // eslint-disable-next-line no-var
var OSSettingsMenuTest = class extends OSSettingsBrowserTest { var OSSettingsMenuTest = class extends OSSettingsBrowserTest {
/** @override */
get browsePreload() {
return super.browsePreload +
'chromeos/os_settings_menu/os_settings_menu.html';
}
/** @override */ /** @override */
get extraLibraries() { get extraLibraries() {
return super.extraLibraries.concat([ return super.extraLibraries.concat([
...@@ -846,6 +852,12 @@ TEST_F('OSSettingsPeoplePageSetupPinDialogTest', 'AllJsTests', () => { ...@@ -846,6 +852,12 @@ TEST_F('OSSettingsPeoplePageSetupPinDialogTest', 'AllJsTests', () => {
// eslint-disable-next-line no-var // eslint-disable-next-line no-var
var OSSettingsPeoplePageSyncControlsTest = class extends OSSettingsBrowserTest { var OSSettingsPeoplePageSyncControlsTest = class extends OSSettingsBrowserTest {
/** @override */
get browsePreload() {
return super.browsePreload +
'chromeos/os_people_page/os_sync_controls.html';
}
/** @override */ /** @override */
get featureList() { get featureList() {
return {enabled: ['chromeos::features::kSplitSettingsSync']}; return {enabled: ['chromeos::features::kSplitSettingsSync']};
...@@ -867,6 +879,11 @@ TEST_F('OSSettingsPeoplePageSyncControlsTest', 'AllJsTests', () => { ...@@ -867,6 +879,11 @@ TEST_F('OSSettingsPeoplePageSyncControlsTest', 'AllJsTests', () => {
// Tests for the People section. // Tests for the People section.
// eslint-disable-next-line no-var // eslint-disable-next-line no-var
var OSSettingsPeoplePageTest = class extends OSSettingsBrowserTest { var OSSettingsPeoplePageTest = class extends OSSettingsBrowserTest {
/** @override */
get browsePreload() {
return super.browsePreload + 'chromeos/os_people_page/os_people_page.html';
}
/** @override */ /** @override */
get extraLibraries() { get extraLibraries() {
return super.extraLibraries.concat([ return super.extraLibraries.concat([
...@@ -883,9 +900,36 @@ TEST_F('OSSettingsPeoplePageTest', 'AllJsTests', () => { ...@@ -883,9 +900,36 @@ TEST_F('OSSettingsPeoplePageTest', 'AllJsTests', () => {
mocha.run(); mocha.run();
}); });
// eslint-disable-next-line no-var
var OSSettingsParentalControlsPageTest = class extends OSSettingsBrowserTest {
/** @override */
get browsePreload() {
return super.browsePreload +
'chromeos/parental_controls_page/parental_controls_page.html';
}
/** @override */
get extraLibraries() {
return super.extraLibraries.concat([
BROWSER_SETTINGS_PATH + '../test_browser_proxy.js',
'parental_controls_page_test.js',
]);
}
};
TEST_F('OSSettingsParentalControlsPageTest', 'AllJsTests', () => {
mocha.run();
});
// Tests for the Personalization section. // Tests for the Personalization section.
// eslint-disable-next-line no-var // eslint-disable-next-line no-var
var OSSettingsPersonalizationPageTest = class extends OSSettingsBrowserTest { var OSSettingsPersonalizationPageTest = class extends OSSettingsBrowserTest {
/** @override */
get browsePreload() {
return super.browsePreload +
'chromeos/personalization_page/personalization_page.html';
}
/** @override */ /** @override */
get extraLibraries() { get extraLibraries() {
return super.extraLibraries.concat([ return super.extraLibraries.concat([
......
// 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.
/** @implements {parental_controls.ParentalControlsBrowserProxy} */
class TestParentalControlsBrowserProxy extends TestBrowserProxy {
constructor() {
super([
'showAddSupervisionDialog',
'launchFamilyLinkSettings',
]);
}
/** @override */
launchFamilyLinkSettings() {
this.methodCalled('launchFamilyLinkSettings');
}
/** @override */
showAddSupervisionDialog() {
this.methodCalled('showAddSupervisionDialog');
}
}
suite('Chrome OS parental controls page setup item tests', function() {
/** @type {ParentalControlsPage} */
let parentalControlsPage = null;
/** @type {TestParentalControlsBrowserProxy} */
let parentalControlsBrowserProxy = null;
suiteSetup(function() {
loadTimeData.overrideValues({
// Simulate parental controls.
showParentalControls: true,
});
});
setup(function() {
parentalControlsBrowserProxy = new TestParentalControlsBrowserProxy();
parental_controls.BrowserProxyImpl.instance_ = parentalControlsBrowserProxy;
PolymerTest.clearBody();
parentalControlsPage =
document.createElement('settings-parental-controls-page');
parentalControlsPage.pageVisibility = settings.pageVisibility;
document.body.appendChild(parentalControlsPage);
Polymer.dom.flush();
});
teardown(function() {
parentalControlsPage.remove();
});
test('parental controls page enabled when online', () => {
// Setup button is shown and enabled.
const setupButton =
assert(parentalControlsPage.$$('#parental-controls-item cr-button'));
setupButton.click();
// Ensure that the request to launch the add supervision flow went
// through.
assertEquals(
parentalControlsBrowserProxy.getCallCount('showAddSupervisionDialog'),
1);
});
test('parental controls page disabled when offline', () => {
// Simulate going offline
window.dispatchEvent(new CustomEvent('offline'));
// Setup button is shown but disabled.
const setupButton =
assert(parentalControlsPage.$$('#parental-controls-item cr-button'));
assertTrue(setupButton.disabled);
setupButton.click();
// Ensure that the request to launch the add supervision flow does not
// go through.
assertEquals(
parentalControlsBrowserProxy.getCallCount('showAddSupervisionDialog'),
0);
});
test('parental controls page re-enabled when it comes back online', () => {
// Simulate going offline
window.dispatchEvent(new CustomEvent('offline'));
// Setup button is shown but disabled.
const setupButton =
assert(parentalControlsPage.$$('#parental-controls-item cr-button'));
assertTrue(setupButton.disabled);
// Come back online.
window.dispatchEvent(new CustomEvent('online'));
// Setup button is shown and re-enabled.
assertFalse(setupButton.disabled);
});
});
suite('Chrome OS parental controls page child account tests', function() {
/** @type {ParentalControlsPage} */
let parentalControlsPage = null;
/** @type {TestParentalControlsBrowserProxy} */
let parentalControlsBrowserProxy = null;
suiteSetup(function() {
loadTimeData.overrideValues({
// Simulate parental controls.
showParentalControls: true,
// Simulate child account.
isChild: true,
});
});
setup(async function() {
parentalControlsBrowserProxy = new TestParentalControlsBrowserProxy();
parental_controls.BrowserProxyImpl.instance_ = parentalControlsBrowserProxy;
PolymerTest.clearBody();
parentalControlsPage =
document.createElement('settings-parental-controls-page');
parentalControlsPage.pageVisibility = settings.pageVisibility;
document.body.appendChild(parentalControlsPage);
Polymer.dom.flush();
});
teardown(function() {
parentalControlsPage.remove();
});
test('parental controls page child view shown to child account', () => {
// Get the link row.
const linkRow =
assert(parentalControlsPage.$$('#parental-controls-item cr-link-row'));
linkRow.click();
// Ensure that the request to launch FLH went through.
assertEquals(
parentalControlsBrowserProxy.getCallCount('launchFamilyLinkSettings'),
1);
});
});
...@@ -562,8 +562,6 @@ cr.define('settings_people_page', function() { ...@@ -562,8 +562,6 @@ cr.define('settings_people_page', function() {
showOSSettings: false, showOSSettings: false,
// Simulate ChromeOSAccountManager (Google Accounts support). // Simulate ChromeOSAccountManager (Google Accounts support).
isAccountManagerEnabled: true, isAccountManagerEnabled: true,
// Simulate parental controls.
showParentalControls: true,
}); });
}); });
...@@ -623,12 +621,6 @@ cr.define('settings_people_page', function() { ...@@ -623,12 +621,6 @@ cr.define('settings_people_page', function() {
const subpageArrow = assert(peoplePage.$$('#profile-subpage-arrow')); const subpageArrow = assert(peoplePage.$$('#profile-subpage-arrow'));
assertFalse(subpageArrow.hidden); assertFalse(subpageArrow.hidden);
}); });
test('parental controls page is shown when enabled', () => {
// Setup button is shown and enabled.
const parentalControlsItem =
assert(peoplePage.$$('settings-parental-controls-page'));
});
}); });
suite('Chrome OS with account manager disabled', function() { suite('Chrome OS with account manager disabled', function() {
...@@ -693,153 +685,5 @@ cr.define('settings_people_page', function() { ...@@ -693,153 +685,5 @@ cr.define('settings_people_page', function() {
assertEquals(oldRoute, settings.getCurrentRoute()); assertEquals(oldRoute, settings.getCurrentRoute());
}); });
}); });
/** @implements {parental_controls.ParentalControlsBrowserProxy} */
class TestParentalControlsBrowserProxy extends TestBrowserProxy {
constructor() {
super([
'showAddSupervisionDialog',
'launchFamilyLinkSettings',
]);
}
/** @override */
launchFamilyLinkSettings() {
this.methodCalled('launchFamilyLinkSettings');
}
/** @override */
showAddSupervisionDialog() {
this.methodCalled('showAddSupervisionDialog');
}
}
suite('Chrome OS parental controls page setup item tests', function() {
/** @type {ParentalControlsPage} */
let parentalControlsPage = null;
/** @type {TestParentalControlsBrowserProxy} */
let parentalControlsBrowserProxy = null;
suiteSetup(function() {
loadTimeData.overrideValues({
// Simulate parental controls.
showParentalControls: true,
});
});
setup(function() {
parentalControlsBrowserProxy = new TestParentalControlsBrowserProxy();
parental_controls.BrowserProxyImpl.instance_ =
parentalControlsBrowserProxy;
PolymerTest.clearBody();
parentalControlsPage =
document.createElement('settings-parental-controls-page');
parentalControlsPage.pageVisibility = settings.pageVisibility;
document.body.appendChild(parentalControlsPage);
Polymer.dom.flush();
});
teardown(function() {
parentalControlsPage.remove();
});
test('parental controls page enabled when online', () => {
// Setup button is shown and enabled.
const setupButton = assert(
parentalControlsPage.$$('#parental-controls-item cr-button'));
setupButton.click();
// Ensure that the request to launch the add supervision flow went
// through.
assertEquals(
parentalControlsBrowserProxy.getCallCount(
'showAddSupervisionDialog'),
1);
});
test('parental controls page disabled when offline', () => {
// Simulate going offline
window.dispatchEvent(new CustomEvent('offline'));
// Setup button is shown but disabled.
const setupButton = assert(
parentalControlsPage.$$('#parental-controls-item cr-button'));
assertTrue(setupButton.disabled);
setupButton.click();
// Ensure that the request to launch the add supervision flow does not
// go through.
assertEquals(
parentalControlsBrowserProxy.getCallCount(
'showAddSupervisionDialog'),
0);
});
test(
'parental controls page re-enabled when it comes back online', () => {
// Simulate going offline
window.dispatchEvent(new CustomEvent('offline'));
// Setup button is shown but disabled.
const setupButton = assert(
parentalControlsPage.$$('#parental-controls-item cr-button'));
assertTrue(setupButton.disabled);
// Come back online.
window.dispatchEvent(new CustomEvent('online'));
// Setup button is shown and re-enabled.
assertFalse(setupButton.disabled);
});
});
suite('Chrome OS parental controls page child account tests', function() {
/** @type {ParentalControlsPage} */
let parentalControlsPage = null;
/** @type {TestParentalControlsBrowserProxy} */
let parentalControlsBrowserProxy = null;
suiteSetup(function() {
loadTimeData.overrideValues({
// Simulate parental controls.
showParentalControls: true,
// Simulate child account.
isChild: true,
});
});
setup(async function() {
parentalControlsBrowserProxy = new TestParentalControlsBrowserProxy();
parental_controls.BrowserProxyImpl.instance_ =
parentalControlsBrowserProxy;
PolymerTest.clearBody();
parentalControlsPage =
document.createElement('settings-parental-controls-page');
parentalControlsPage.pageVisibility = settings.pageVisibility;
document.body.appendChild(parentalControlsPage);
Polymer.dom.flush();
});
teardown(function() {
parentalControlsPage.remove();
});
test('parental controls page child view shown to child account', () => {
// Get the link row.
const linkRow = assert(
parentalControlsPage.$$('#parental-controls-item cr-link-row'));
linkRow.click();
// Ensure that the request to launch FLH went through.
assertEquals(
parentalControlsBrowserProxy.getCallCount(
'launchFamilyLinkSettings'),
1);
});
});
} }
}); });
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