Commit 7dd05f1c authored by Andy Paicu's avatar Andy Paicu Committed by Commit Bot

Revert "Fix browser test EulaTest.LoadOffline"

This reverts commit 5fd0e6ed.

Reason for revert: Breaks linux-chromeos-google-rel build

First failing build:
https://ci.chromium.org/p/chrome/builders/ci/linux-chromeos-google-rel/8657

Original change's description:
> Fix browser test EulaTest.LoadOffline
> 
> This commit improves the reliability of the EULA browser test
> EulaTest.LoadOffline. This test was disabled due to its flakiness
> in the past and is now enabled again.
> 
> Tested locally. Ran 100 tests under stress without any errors.
> 
> Bug: 1015948
> Change-Id: I59bc8612da9f5be526a2aa28d13ee70400dbb01e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1892775
> Reviewed-by: Roman Sorokin [CET] <rsorokin@chromium.org>
> Commit-Queue: Renato Silva <rrsilva@google.com>
> Cr-Commit-Position: refs/heads/master@{#712516}

TBR=rsorokin@chromium.org,rrsilva@google.com

Change-Id: I7ef72ddd859ba5689557a8b2157edd13527c0328
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1015948
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899772Reviewed-by: default avatarAndy Paicu <andypaicu@chromium.org>
Commit-Queue: Andy Paicu <andypaicu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712560}
parent d6273490
...@@ -72,10 +72,8 @@ class WebContentsLoadFinishedWaiter : public content::WebContentsObserver { ...@@ -72,10 +72,8 @@ class WebContentsLoadFinishedWaiter : public content::WebContentsObserver {
~WebContentsLoadFinishedWaiter() override = default; ~WebContentsLoadFinishedWaiter() override = default;
void Wait() { void Wait() {
if (!web_contents()->IsLoading() && if (!web_contents()->IsLoading())
web_contents()->GetLastCommittedURL() != GURL::EmptyGURL()) {
return; return;
}
run_loop_ = std::make_unique<base::RunLoop>(); run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->Run(); run_loop_->Run();
...@@ -109,23 +107,26 @@ class EulaTest : public OobeBaseTest { ...@@ -109,23 +107,26 @@ class EulaTest : public OobeBaseTest {
EulaTest() = default; EulaTest() = default;
~EulaTest() override = default; ~EulaTest() override = default;
void SetUpOnMainThread() override {
// Retrieve the URL from the embedded test server and override EULA URL.
fake_eula_url_ =
embedded_test_server()->base_url().Resolve(kFakeOnlineEulaPath).spec();
EulaScreenHandler::set_eula_url_for_testing(fake_eula_url_.c_str());
OobeBaseTest::SetUpOnMainThread();
}
// OobeBaseTest: // OobeBaseTest:
void RegisterAdditionalRequestHandlers() override { void RegisterAdditionalRequestHandlers() override {
embedded_test_server()->RegisterRequestHandler( embedded_test_server()->RegisterRequestHandler(
base::Bind(&EulaTest::HandleRequest, base::Unretained(this))); base::Bind(&EulaTest::HandleRequest, base::Unretained(this)));
} }
void OverrideOnlineEulaUrl() {
// Override with the embedded test server's base url. Otherwise, the load
// would not hit the embedded test server.
const GURL fake_eula_url =
embedded_test_server()->base_url().Resolve(kFakeOnlineEulaPath);
test::OobeJS().Evaluate(
base::StringPrintf("loadTimeData.overrideValues({eulaOnlineUrl: '%s'});"
"Oobe.updateLocalizedContent();",
fake_eula_url.spec().c_str()));
}
void ShowEulaScreen() { void ShowEulaScreen() {
LoginDisplayHost::default_host()->StartWizard(EulaView::kScreenId); LoginDisplayHost::default_host()->StartWizard(EulaView::kScreenId);
OverrideOnlineEulaUrl();
OobeScreenWaiter(EulaView::kScreenId).Wait(); OobeScreenWaiter(EulaView::kScreenId).Wait();
} }
...@@ -229,9 +230,6 @@ class EulaTest : public OobeBaseTest { ...@@ -229,9 +230,6 @@ class EulaTest : public OobeBaseTest {
bool allow_online_eula_ = false; bool allow_online_eula_ = false;
// URL used for testing. Retrieved from the embedded server.
std::string fake_eula_url_;
DISALLOW_COPY_AND_ASSIGN(EulaTest); DISALLOW_COPY_AND_ASSIGN(EulaTest);
}; };
...@@ -249,7 +247,8 @@ IN_PROC_BROWSER_TEST_F(EulaTest, DISABLED_LoadOnline) { ...@@ -249,7 +247,8 @@ IN_PROC_BROWSER_TEST_F(EulaTest, DISABLED_LoadOnline) {
// Tests that offline version is shown when the online version is not // Tests that offline version is shown when the online version is not
// accessible. // accessible.
IN_PROC_BROWSER_TEST_F(EulaTest, LoadOffline) { // Disable due to flaky crbug.com/1015948
IN_PROC_BROWSER_TEST_F(EulaTest, DISABLED_LoadOffline) {
set_allow_online_eula(false); set_allow_online_eula(false);
ShowEulaScreen(); ShowEulaScreen();
...@@ -262,14 +261,8 @@ IN_PROC_BROWSER_TEST_F(EulaTest, LoadOffline) { ...@@ -262,14 +261,8 @@ IN_PROC_BROWSER_TEST_F(EulaTest, LoadOffline) {
WebContentsLoadFinishedWaiter(eula_contents).Wait(); WebContentsLoadFinishedWaiter(eula_contents).Wait();
} }
// Wait until the Accept button on the EULA frame becomes enabled. EXPECT_TRUE(test::GetWebViewContents({"oobe-eula-md", "crosEulaFrame"})
chromeos::test::OobeJS() .find(kOfflineEULAWarning) != std::string::npos);
.CreateEnabledWaiter(true, {"oobe-eula-md", "acceptButton"})
->Wait();
const std::string webview_contents =
test::GetWebViewContents({"oobe-eula-md", "crosEulaFrame"});
EXPECT_TRUE(webview_contents.find(kOfflineEULAWarning) != std::string::npos);
} }
// Tests that clicking on "System security settings" button opens a dialog // Tests that clicking on "System security settings" button opens a dialog
......
...@@ -120,7 +120,6 @@ Polymer({ ...@@ -120,7 +120,6 @@ Polymer({
*/ */
updateLocalizedContent: function(event) { updateLocalizedContent: function(event) {
// This forces frame to reload. // This forces frame to reload.
this.acceptButtonDisabled = true;
this.screen.loadEulaToWebview_(this.$.crosEulaFrame); this.screen.loadEulaToWebview_(this.$.crosEulaFrame);
this.i18nUpdateLocale(); this.i18nUpdateLocale();
}, },
......
...@@ -29,8 +29,6 @@ namespace chromeos { ...@@ -29,8 +29,6 @@ namespace chromeos {
constexpr StaticOobeScreenId EulaView::kScreenId; constexpr StaticOobeScreenId EulaView::kScreenId;
const char* EulaScreenHandler::eula_url_for_testing_ = nullptr;
EulaScreenHandler::EulaScreenHandler(JSCallsContainer* js_calls_container, EulaScreenHandler::EulaScreenHandler(JSCallsContainer* js_calls_container,
CoreOobeView* core_oobe_view) CoreOobeView* core_oobe_view)
: BaseScreenHandler(kScreenId, js_calls_container), : BaseScreenHandler(kScreenId, js_calls_container),
...@@ -66,15 +64,6 @@ void EulaScreenHandler::Unbind() { ...@@ -66,15 +64,6 @@ void EulaScreenHandler::Unbind() {
BaseScreenHandler::SetBaseScreen(nullptr); BaseScreenHandler::SetBaseScreen(nullptr);
} }
std::string EulaScreenHandler::GetEulaOnlineUrl() {
if (EulaScreenHandler::eula_url_for_testing_) {
return std::string(EulaScreenHandler::eula_url_for_testing_);
}
return base::StringPrintf(chrome::kOnlineEulaURLPath,
g_browser_process->GetApplicationLocale().c_str());
}
void EulaScreenHandler::DeclareLocalizedValues( void EulaScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) { ::login::LocalizedValuesBuilder* builder) {
builder->Add("eulaScreenAccessibleTitle", IDS_EULA_SCREEN_ACCESSIBLE_TITLE); builder->Add("eulaScreenAccessibleTitle", IDS_EULA_SCREEN_ACCESSIBLE_TITLE);
...@@ -105,8 +94,10 @@ void EulaScreenHandler::DeclareLocalizedValues( ...@@ -105,8 +94,10 @@ void EulaScreenHandler::DeclareLocalizedValues(
IDS_SHORT_PRODUCT_OS_NAME); IDS_SHORT_PRODUCT_OS_NAME);
#endif #endif
// Online URL to use. May be overridden by tests. builder->Add(
builder->Add("eulaOnlineUrl", GetEulaOnlineUrl()); "eulaOnlineUrl",
base::StringPrintf(chrome::kOnlineEulaURLPath,
g_browser_process->GetApplicationLocale().c_str()));
/* MD-OOBE */ /* MD-OOBE */
builder->Add("oobeEulaSectionTitle", IDS_OOBE_EULA_SECTION_TITLE); builder->Add("oobeEulaSectionTitle", IDS_OOBE_EULA_SECTION_TITLE);
......
...@@ -62,21 +62,12 @@ class EulaScreenHandler : public EulaView, public BaseScreenHandler { ...@@ -62,21 +62,12 @@ class EulaScreenHandler : public EulaView, public BaseScreenHandler {
void GetAdditionalParameters(base::DictionaryValue* dict) override; void GetAdditionalParameters(base::DictionaryValue* dict) override;
void Initialize() override; void Initialize() override;
// Allows the EULA URL to be overridden by tests.
static void set_eula_url_for_testing(const char* eula_test_url) {
eula_url_for_testing_ = eula_test_url;
}
private: private:
// JS messages handlers. // JS messages handlers.
void HandleOnLearnMore(); void HandleOnLearnMore();
void HandleOnInstallationSettingsPopupOpened(); void HandleOnInstallationSettingsPopupOpened();
void HandleUsageStatsEnabled(bool enabled); void HandleUsageStatsEnabled(bool enabled);
// Determines the online URL to use.
std::string GetEulaOnlineUrl();
static const char* eula_url_for_testing_;
void UpdateLocalizedValues(::login::SecureModuleUsed secure_module_used); void UpdateLocalizedValues(::login::SecureModuleUsed secure_module_used);
EulaScreen* screen_ = nullptr; EulaScreen* screen_ = nullptr;
......
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