Commit 61acc080 authored by Danila Kuzmin's avatar Danila Kuzmin Committed by Chromium LUCI CQ

oobe new layout: demo-preferences-element

Bug: 1159889
Change-Id: I54ea83b1599f6a732e910f2034c67ccfd038c426
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2616350Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Reviewed-by: default avatarRoman Aleksandrov <raleksandrov@google.com>
Commit-Queue: Danila Kuzmin <dkuzmin@google.com>
Cr-Commit-Position: refs/heads/master@{#844863}
parent 439d2393
...@@ -284,8 +284,8 @@ class DemoSetupTestBase : public OobeBaseTest { ...@@ -284,8 +284,8 @@ class DemoSetupTestBase : public OobeBaseTest {
const std::string& button_selector, const std::string& button_selector,
JSExecution execution) { JSExecution execution) {
const std::string query = base::StrCat( const std::string query = base::StrCat(
{ScreenToContentQuery(screen), ".$$('oobe-dialog').querySelector('", {ScreenToContentQuery(screen), ScreenToOobeDialogType(screen),
button_selector, "').click();"}); ".querySelector('", button_selector, "').click();"});
switch (execution) { switch (execution) {
case JSExecution::kAsync: case JSExecution::kAsync:
test::ExecuteOobeJSAsync(query); test::ExecuteOobeJSAsync(query);
...@@ -298,6 +298,16 @@ class DemoSetupTestBase : public OobeBaseTest { ...@@ -298,6 +298,16 @@ class DemoSetupTestBase : public OobeBaseTest {
} }
} }
// During transition to new layout in OOBE we use oobe-adaptive-dialog instead
// of oobe-dialog. This is a helper function for this transition.
std::string ScreenToOobeDialogType(OobeScreenId screen) {
if (screen == DemoPreferencesScreenView::kScreenId) {
return ".$$('oobe-adaptive-dialog')";
} else {
return ".$$('oobe-dialog')";
}
}
// Simulates `button` click on a `dialog` of the specified OOBE `screen`. // Simulates `button` click on a `dialog` of the specified OOBE `screen`.
// Can be used for screens that consists of multiple oobe-dialog elements. // Can be used for screens that consists of multiple oobe-dialog elements.
void ClickScreenDialogButton(OobeScreenId screen, void ClickScreenDialogButton(OobeScreenId screen,
...@@ -659,17 +669,17 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, ...@@ -659,17 +669,17 @@ IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest,
ASSERT_NE(kCountryCodeToNameMap.end(), it); ASSERT_NE(kCountryCodeToNameMap.end(), it);
const std::string query = base::StrCat( const std::string query = base::StrCat(
{ScreenToContentQuery(DemoPreferencesScreenView::kScreenId), {ScreenToContentQuery(DemoPreferencesScreenView::kScreenId),
".$$('oobe-dialog').querySelector('#countrySelect').$$('option[value=" ScreenToOobeDialogType(DemoPreferencesScreenView::kScreenId),
"\"", ".querySelector('#countrySelect').$$('option[value=\"", country_code,
country_code, "\"]').innerHTML"}); "\"]').innerHTML"});
EXPECT_EQ(it->second, test::OobeJS().GetString(query)); EXPECT_EQ(it->second, test::OobeJS().GetString(query));
} }
// Select France as the Demo Mode country. // Select France as the Demo Mode country.
const std::string select_country = base::StrCat( const std::string select_country = base::StrCat(
{ScreenToContentQuery(DemoPreferencesScreenView::kScreenId), {ScreenToContentQuery(DemoPreferencesScreenView::kScreenId),
".$$('oobe-dialog').querySelector('#countrySelect').onSelected_('fr')" ScreenToOobeDialogType(DemoPreferencesScreenView::kScreenId),
";"}); ".querySelector('#countrySelect').onSelected_('fr');"});
test::ExecuteOobeJSAsync(select_country); test::ExecuteOobeJSAsync(select_country);
ClickOobeButton(DemoPreferencesScreenView::kScreenId, OobeButton::kText, ClickOobeButton(DemoPreferencesScreenView::kScreenId, OobeButton::kText,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/common_styles.html">
<link rel="import" href="/components/hd_iron_icon.html"> <link rel="import" href="/components/hd_iron_icon.html">
<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html">
<link rel="import" href="/components/oobe_i18n_behavior.html"> <link rel="import" href="/components/oobe_i18n_behavior.html">
<dom-module id="demo-preferences-element"> <dom-module id="demo-preferences-element">
...@@ -26,13 +26,15 @@ ...@@ -26,13 +26,15 @@
font-size: 13px; font-size: 13px;
} }
</style> </style>
<oobe-dialog id="demoPreferencesDialog" role="dialog" has-buttons <oobe-adaptive-dialog id="demoPreferencesDialog" role="dialog"
aria-label$="[[i18nDynamic(locale, 'demoPreferencesScreenTitle')]]" aria-label$="[[i18nDynamic(locale, 'demoPreferencesScreenTitle')]]">
title-key="demoPreferencesScreenTitle"> <hd-iron-icon slot="icon"
<hd-iron-icon slot="oobe-icon"
icon1x="oobe-32:gear" icon2x="oobe-64:gear"> icon1x="oobe-32:gear" icon2x="oobe-64:gear">
</hd-iron-icon> </hd-iron-icon>
<div slot="footer" class="layout vertical"> <h1 slot="title">
[[i18nDynamic(locale, 'demoPreferencesScreenTitle')]]
</h1>
<div slot="content" class="layout vertical">
<div id="languageDropdownContainer" class="flex layout center horizontal <div id="languageDropdownContainer" class="flex layout center horizontal
justified language-selection-entry"> justified language-selection-entry">
<div class="language-selection-title layout vertical <div class="language-selection-title layout vertical
...@@ -74,6 +76,6 @@ ...@@ -74,6 +76,6 @@
<oobe-text-button id="nextButton" inverse on-click="onNextClicked_" <oobe-text-button id="nextButton" inverse on-click="onNextClicked_"
text-key="demoPreferencesNextButtonLabel"></oobe-text-button> text-key="demoPreferencesNextButtonLabel"></oobe-text-button>
</div> </div>
</oobe-dialog> </oobe-adaptive-dialog>
</template> </template>
</dom-module> </dom-module>
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