Commit 86fcd8f9 authored by Roman Sorokin's avatar Roman Sorokin Committed by Commit Bot

OOBE: Test docked magnifier and virtual keyboard

This is a follow-up of CL:1855939

Bug: 833348
Change-Id: Id43ac9e389d88571463dd02f53e602d053ccdd56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1865224Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarDenis Kuznetsov <antrim@chromium.org>
Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707333}
parent 660f2191
...@@ -312,6 +312,10 @@ void DockedMagnifierControllerImpl::CenterOnPoint( ...@@ -312,6 +312,10 @@ void DockedMagnifierControllerImpl::CenterOnPoint(
viewport_magnifier_layer_->SetTransform(transform); viewport_magnifier_layer_->SetTransform(transform);
} }
int DockedMagnifierControllerImpl::GetMagnifierHeightForTesting() const {
return GetTotalMagnifierHeight();
}
void DockedMagnifierControllerImpl::OnActiveUserPrefServiceChanged( void DockedMagnifierControllerImpl::OnActiveUserPrefServiceChanged(
PrefService* pref_service) { PrefService* pref_service) {
active_user_pref_service_ = pref_service; active_user_pref_service_ = pref_service;
......
...@@ -79,6 +79,7 @@ class ASH_EXPORT DockedMagnifierControllerImpl ...@@ -79,6 +79,7 @@ class ASH_EXPORT DockedMagnifierControllerImpl
// DockedMagnifierController: // DockedMagnifierController:
void CenterOnPoint(const gfx::Point& point_in_screen) override; void CenterOnPoint(const gfx::Point& point_in_screen) override;
int GetMagnifierHeightForTesting() const override;
// ash::SessionObserver: // ash::SessionObserver:
void OnActiveUserPrefServiceChanged(PrefService* pref_service) override; void OnActiveUserPrefServiceChanged(PrefService* pref_service) override;
......
...@@ -26,6 +26,9 @@ class ASH_EXPORT DockedMagnifierController { ...@@ -26,6 +26,9 @@ class ASH_EXPORT DockedMagnifierController {
// by itself. // by itself.
virtual void CenterOnPoint(const gfx::Point& point_in_screen) = 0; virtual void CenterOnPoint(const gfx::Point& point_in_screen) = 0;
// Returns docked magnifier height.
virtual int GetMagnifierHeightForTesting() const = 0;
protected: protected:
virtual ~DockedMagnifierController() = default; virtual ~DockedMagnifierController() = default;
}; };
......
...@@ -525,14 +525,16 @@ class AccessibilityManagerLoginTest : public OobeBaseTest { ...@@ -525,14 +525,16 @@ class AccessibilityManagerLoginTest : public OobeBaseTest {
~AccessibilityManagerLoginTest() override = default; ~AccessibilityManagerLoginTest() override = default;
void SetUpOnMainThread() override { void SetUpOnMainThread() override {
OobeBaseTest::SetUpOnMainThread(); // BrailleController has to be set before SetUpOnMainThread call as
// observers subscribe to the controller during SetUpOnMainThread.
AccessibilityManager::SetBrailleControllerForTest(&braille_controller_); AccessibilityManager::SetBrailleControllerForTest(&braille_controller_);
default_autoclick_delay_ = GetAutoclickDelay(); default_autoclick_delay_ = GetAutoclickDelay();
OobeBaseTest::SetUpOnMainThread();
} }
void TearDownOnMainThread() override { void TearDownOnMainThread() override {
AccessibilityManager::SetBrailleControllerForTest(nullptr);
OobeBaseTest::TearDownOnMainThread(); OobeBaseTest::TearDownOnMainThread();
AccessibilityManager::SetBrailleControllerForTest(nullptr);
} }
void CreateSession(const AccountId& account_id) { void CreateSession(const AccountId& account_id) {
......
// Copyright 2019 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.
#include "ash/public/cpp/docked_magnifier_controller.h"
#include "ash/public/cpp/keyboard/keyboard_controller.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
#include "chrome/browser/chromeos/login/test/oobe_base_test.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/browser/chromeos/login/ui/webui_login_view.h"
#include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/view_observer.h"
namespace chromeos {
class DockedMagnifierVirtualKeyboardTest
: public OobeBaseTest,
public views::ViewObserver,
public ChromeKeyboardControllerClient::Observer {
public:
DockedMagnifierVirtualKeyboardTest() = default;
~DockedMagnifierVirtualKeyboardTest() override = default;
protected:
ChromeKeyboardControllerClient* keyboard_controller() {
return ChromeKeyboardControllerClient::Get();
}
MagnificationManager* magnification_manager() {
return MagnificationManager::Get();
}
WebUILoginView* webui_login_view() {
return LoginDisplayHost::default_host()->GetWebUILoginView();
}
gfx::Rect GetOobeBounds() { return webui_login_view()->GetBoundsInScreen(); }
void ShowDockedMagnifier() {
magnification_manager()->SetDockedMagnifierEnabled(true);
ASSERT_TRUE(magnification_manager()->IsDockedMagnifierEnabled());
ASSERT_GT(GetMagnifierHeight(), 0);
}
void HideDockedMagnifier() {
magnification_manager()->SetDockedMagnifierEnabled(false);
ASSERT_FALSE(magnification_manager()->IsDockedMagnifierEnabled());
ASSERT_EQ(GetMagnifierHeight(), 0);
}
int GetMagnifierHeight() {
return ash::DockedMagnifierController::Get()
->GetMagnifierHeightForTesting();
}
void ShowKeyboard() {
AccessibilityManager::Get()->EnableVirtualKeyboard(true);
keyboard_controller()->ShowKeyboard();
keyboard_controller()->SetKeyboardLocked(true);
WaitForBoundsToChange();
ASSERT_GT(GetKeyboardHeight(), 0);
}
void HideKeyboard() {
keyboard_controller()->HideKeyboard(ash::HideReason::kUser);
ASSERT_EQ(GetKeyboardHeight(), 0);
}
int GetKeyboardHeight() { return keyboard_bounds_.height(); }
void WaitForBoundsToChange() {
ASSERT_FALSE(run_loop_);
run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->Run();
run_loop_.reset();
}
private:
// views::ViewObserver:
void OnViewBoundsChanged(views::View* observed_view) override {
ASSERT_EQ(observed_view, webui_login_view());
if (run_loop_)
run_loop_->Quit();
}
// ChromeKeyboardControllerClient::Observer:
void OnKeyboardOccludedBoundsChanged(
const gfx::Rect& screen_bounds) override {
keyboard_bounds_ = screen_bounds;
}
// OobeBaseTest:
void SetUpOnMainThread() override {
OobeBaseTest::SetUpOnMainThread();
webui_login_view()->views::View::AddObserver(this);
keyboard_controller()->AddObserver(this);
}
void TearDownOnMainThread() override {
webui_login_view()->views::View::RemoveObserver(this);
keyboard_controller()->RemoveObserver(this);
OobeBaseTest::TearDownOnMainThread();
}
std::unique_ptr<base::RunLoop> run_loop_;
gfx::Rect keyboard_bounds_;
};
IN_PROC_BROWSER_TEST_F(DockedMagnifierVirtualKeyboardTest, WelcomeScreen) {
const gfx::Rect original_bounds = GetOobeBounds();
gfx::Rect expected_bounds(original_bounds);
ShowDockedMagnifier();
expected_bounds.Inset(0, GetMagnifierHeight(), 0, 0);
EXPECT_EQ(expected_bounds, GetOobeBounds());
ShowKeyboard();
expected_bounds.Inset(0, 0, 0, GetKeyboardHeight());
EXPECT_EQ(expected_bounds, GetOobeBounds());
expected_bounds.Inset(0, -GetMagnifierHeight(), 0, 0);
HideDockedMagnifier();
EXPECT_EQ(expected_bounds, GetOobeBounds());
HideKeyboard();
EXPECT_EQ(original_bounds, GetOobeBounds());
}
} // namespace chromeos
...@@ -77,7 +77,6 @@ ...@@ -77,7 +77,6 @@
#include "components/account_id/account_id.h" #include "components/account_id/account_id.h"
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings_types.h" #include "components/content_settings/core/common/content_settings_types.h"
#include "components/guest_view/browser/test_guest_view_manager.h"
#include "components/policy/core/browser/browser_policy_connector.h" #include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h" #include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "components/policy/core/common/policy_map.h" #include "components/policy/core/common/policy_map.h"
...@@ -95,7 +94,6 @@ ...@@ -95,7 +94,6 @@
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/common/features/feature_channel.h" #include "extensions/common/features/feature_channel.h"
#include "google_apis/gaia/fake_gaia.h" #include "google_apis/gaia/fake_gaia.h"
#include "google_apis/gaia/gaia_constants.h" #include "google_apis/gaia/gaia_constants.h"
...@@ -831,22 +829,15 @@ class SAMLEnrollmentTest : public SamlTest { ...@@ -831,22 +829,15 @@ class SAMLEnrollmentTest : public SamlTest {
void SetUpOnMainThread() override; void SetUpOnMainThread() override;
void StartSamlAndWaitForIdpPageLoad(const std::string& gaia_email) override; void StartSamlAndWaitForIdpPageLoad(const std::string& gaia_email) override;
guest_view::TestGuestViewManager* GetGuestViewManager();
content::WebContents* GetEnrollmentContents();
protected: protected:
LocalPolicyTestServerMixin local_policy_mixin_{&mixin_host_}; LocalPolicyTestServerMixin local_policy_mixin_{&mixin_host_};
test::EnrollmentUIMixin enrollment_ui_{&mixin_host_}; test::EnrollmentUIMixin enrollment_ui_{&mixin_host_};
guest_view::TestGuestViewManagerFactory guest_view_manager_factory_;
private: private:
DISALLOW_COPY_AND_ASSIGN(SAMLEnrollmentTest); DISALLOW_COPY_AND_ASSIGN(SAMLEnrollmentTest);
}; };
SAMLEnrollmentTest::SAMLEnrollmentTest() { SAMLEnrollmentTest::SAMLEnrollmentTest() {
guest_view::GuestViewManager::set_factory_for_testing(
&guest_view_manager_factory_);
gaia_frame_parent_ = "oauth-enroll-auth-view"; gaia_frame_parent_ = "oauth-enroll-auth-view";
authenticator_id_ = "$('enterprise-enrollment').authenticator_"; authenticator_id_ = "$('enterprise-enrollment').authenticator_";
} }
...@@ -867,32 +858,14 @@ void SAMLEnrollmentTest::SetUpOnMainThread() { ...@@ -867,32 +858,14 @@ void SAMLEnrollmentTest::SetUpOnMainThread() {
void SAMLEnrollmentTest::StartSamlAndWaitForIdpPageLoad( void SAMLEnrollmentTest::StartSamlAndWaitForIdpPageLoad(
const std::string& gaia_email) { const std::string& gaia_email) {
WaitForSigninScreen(); LoginDisplayHost::default_host()->StartWizard(
ExistingUserController::current_controller()->OnStartEnterpriseEnrollment(); EnrollmentScreenView::kScreenId);
while (!GetEnrollmentContents()) { WaitForGaiaPageBackButtonUpdate();
GetGuestViewManager()->WaitForNextGuestCreated();
}
// Wait for Gaia is ready.
OobeBaseTest::WaitForGaiaPageEvent("backButton");
SigninFrameJS().TypeIntoPath(gaia_email, {"identifier"}); SigninFrameJS().TypeIntoPath(gaia_email, {"identifier"});
SigninFrameJS().TapOn("nextButton"); SigninFrameJS().TapOn("nextButton");
OobeBaseTest::WaitForGaiaPageEvent("authFlowChange"); OobeBaseTest::WaitForGaiaPageEvent("authFlowChange");
} }
guest_view::TestGuestViewManager* SAMLEnrollmentTest::GetGuestViewManager() {
return static_cast<guest_view::TestGuestViewManager*>(
guest_view::TestGuestViewManager::FromBrowserContext(
ProfileHelper::GetSigninProfile()));
}
content::WebContents* SAMLEnrollmentTest::GetEnrollmentContents() {
content::RenderFrameHost* frame_host =
signin::GetAuthFrame(GetLoginUI()->GetWebContents(), gaia_frame_parent_);
if (!frame_host)
return nullptr;
return content::WebContents::FromRenderFrameHost(frame_host);
}
IN_PROC_BROWSER_TEST_F(SAMLEnrollmentTest, WithoutCredentialsPassingAPI) { IN_PROC_BROWSER_TEST_F(SAMLEnrollmentTest, WithoutCredentialsPassingAPI) {
fake_saml_idp()->SetLoginHTMLTemplate("saml_login.html"); fake_saml_idp()->SetLoginHTMLTemplate("saml_login.html");
StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail); StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail);
...@@ -1106,7 +1079,6 @@ void SAMLPolicyTest::SetLoginVideoCaptureAllowedUrls( ...@@ -1106,7 +1079,6 @@ void SAMLPolicyTest::SetLoginVideoCaptureAllowedUrls(
} }
void SAMLPolicyTest::ShowGAIALoginForm() { void SAMLPolicyTest::ShowGAIALoginForm() {
login_screen_load_observer_->Wait();
content::DOMMessageQueue message_queue; content::DOMMessageQueue message_queue;
ASSERT_TRUE(content::ExecuteScript( ASSERT_TRUE(content::ExecuteScript(
GetLoginUI()->GetWebContents(), GetLoginUI()->GetWebContents(),
...@@ -1121,7 +1093,6 @@ void SAMLPolicyTest::ShowGAIALoginForm() { ...@@ -1121,7 +1093,6 @@ void SAMLPolicyTest::ShowGAIALoginForm() {
} }
void SAMLPolicyTest::ShowSAMLInterstitial() { void SAMLPolicyTest::ShowSAMLInterstitial() {
login_screen_load_observer_->Wait();
WaitForOobeUI(); WaitForOobeUI();
std::string js = std::string js =
...@@ -1151,8 +1122,6 @@ void SAMLPolicyTest::ShowSAMLInterstitial() { ...@@ -1151,8 +1122,6 @@ void SAMLPolicyTest::ShowSAMLInterstitial() {
} }
void SAMLPolicyTest::ClickNextOnSAMLInterstitialPage() { void SAMLPolicyTest::ClickNextOnSAMLInterstitialPage() {
login_screen_load_observer_->Wait();
content::DOMMessageQueue message_queue; content::DOMMessageQueue message_queue;
SetupAuthFlowChangeListener(); SetupAuthFlowChangeListener();
...@@ -1168,8 +1137,6 @@ void SAMLPolicyTest::ClickNextOnSAMLInterstitialPage() { ...@@ -1168,8 +1137,6 @@ void SAMLPolicyTest::ClickNextOnSAMLInterstitialPage() {
} }
void SAMLPolicyTest::ClickChangeAccountOnSAMLInterstitialPage() { void SAMLPolicyTest::ClickChangeAccountOnSAMLInterstitialPage() {
login_screen_load_observer_->Wait();
std::string js = std::string js =
"$('gaia-signin').authenticator_.addEventListener('ready', function() {" "$('gaia-signin').authenticator_.addEventListener('ready', function() {"
" window.domAutomationController.send('ready');" " window.domAutomationController.send('ready');"
...@@ -1253,7 +1220,6 @@ IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, PRE_NoSAML) { ...@@ -1253,7 +1220,6 @@ IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, PRE_NoSAML) {
// Verifies that the offline login time limit does not affect a user who // Verifies that the offline login time limit does not affect a user who
// authenticated without SAML. // authenticated without SAML.
IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, NoSAML) { IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, NoSAML) {
login_screen_load_observer_->Wait();
// Verify that offline login is allowed. // Verify that offline login is allowed.
test::OobeJS().ExpectTrue( test::OobeJS().ExpectTrue(
"window.getComputedStyle(document.querySelector(" "window.getComputedStyle(document.querySelector("
...@@ -1270,7 +1236,6 @@ IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, PRE_SAMLNoLimit) { ...@@ -1270,7 +1236,6 @@ IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, PRE_SAMLNoLimit) {
// Verifies that when no offline login time limit is set, a user who // Verifies that when no offline login time limit is set, a user who
// authenticated with SAML is allowed to log in offline. // authenticated with SAML is allowed to log in offline.
IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, SAMLNoLimit) { IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, SAMLNoLimit) {
login_screen_load_observer_->Wait();
// Verify that offline login is allowed. // Verify that offline login is allowed.
test::OobeJS().ExpectTrue( test::OobeJS().ExpectTrue(
"window.getComputedStyle(document.querySelector(" "window.getComputedStyle(document.querySelector("
...@@ -1287,7 +1252,6 @@ IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, PRE_SAMLZeroLimit) { ...@@ -1287,7 +1252,6 @@ IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, PRE_SAMLZeroLimit) {
// Verifies that when the offline login time limit is exceeded for a user who // Verifies that when the offline login time limit is exceeded for a user who
// authenticated via SAML, that user is forced to log in online the next time. // authenticated via SAML, that user is forced to log in online the next time.
IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, SAMLZeroLimit) { IN_PROC_BROWSER_TEST_F(SAMLPolicyTestWebUILogin, SAMLZeroLimit) {
login_screen_load_observer_->Wait();
// Verify that offline login is not allowed. // Verify that offline login is not allowed.
test::OobeJS().ExpectTrue( test::OobeJS().ExpectTrue(
"window.getComputedStyle(document.querySelector(" "window.getComputedStyle(document.querySelector("
......
...@@ -304,11 +304,6 @@ class OAuth2Test : public OobeBaseTest { ...@@ -304,11 +304,6 @@ class OAuth2Test : public OobeBaseTest {
} }
void LoginAsExistingUser() { void LoginAsExistingUser() {
content::WindowedNotificationObserver(
chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
content::NotificationService::AllSources())
.Wait();
test::OobeJS().ExpectTrue("!!document.querySelector('#account-picker')"); test::OobeJS().ExpectTrue("!!document.querySelector('#account-picker')");
test::OobeJS().ExpectTrue("!!document.querySelector('#pod-row')"); test::OobeJS().ExpectTrue("!!document.querySelector('#pod-row')");
...@@ -572,11 +567,6 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, PRE_MergeSession) { ...@@ -572,11 +567,6 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, PRE_MergeSession) {
IN_PROC_BROWSER_TEST_F(OAuth2Test, DISABLED_MergeSession) { IN_PROC_BROWSER_TEST_F(OAuth2Test, DISABLED_MergeSession) {
SimulateNetworkOnline(); SimulateNetworkOnline();
content::WindowedNotificationObserver(
chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
content::NotificationService::AllSources())
.Wait();
test::OobeJS().ExpectTrue("!!document.querySelector('#account-picker')"); test::OobeJS().ExpectTrue("!!document.querySelector('#account-picker')");
test::OobeJS().ExpectTrue("!!document.querySelector('#pod-row')"); test::OobeJS().ExpectTrue("!!document.querySelector('#pod-row')");
...@@ -610,12 +600,6 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, DISABLED_OverlappingContinueSessionRestore) { ...@@ -610,12 +600,6 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, DISABLED_OverlappingContinueSessionRestore) {
SetupGaiaServerForUnexpiredAccount(); SetupGaiaServerForUnexpiredAccount();
SimulateNetworkOnline(); SimulateNetworkOnline();
// Waits for login screen to be ready.
content::WindowedNotificationObserver(
chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
content::NotificationService::AllSources())
.Wait();
// Blocks database thread to control TokenService::LoadCredentials timing. // Blocks database thread to control TokenService::LoadCredentials timing.
// TODO(achuith): Fix this. crbug.com/753615. // TODO(achuith): Fix this. crbug.com/753615.
auto thread_blocker = std::make_unique<ThreadBlocker>(nullptr); auto thread_blocker = std::make_unique<ThreadBlocker>(nullptr);
...@@ -730,12 +714,6 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, SetInvalidTokenStatus) { ...@@ -730,12 +714,6 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, SetInvalidTokenStatus) {
SetupGaiaServerForUnexpiredAccount(); SetupGaiaServerForUnexpiredAccount();
SimulateNetworkOnline(); SimulateNetworkOnline();
// Waits for login screen to be ready.
content::WindowedNotificationObserver(
chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
content::NotificationService::AllSources())
.Wait();
// Signs in as the existing user created in pre test. // Signs in as the existing user created in pre test.
ExistingUserController* const controller = ExistingUserController* const controller =
ExistingUserController::current_controller(); ExistingUserController::current_controller();
......
...@@ -114,13 +114,6 @@ class SyncConsentTest : public OobeBaseTest { ...@@ -114,13 +114,6 @@ class SyncConsentTest : public OobeBaseTest {
OobeBaseTest::TearDownOnMainThread(); OobeBaseTest::TearDownOnMainThread();
} }
void WaitForUIToLoad() {
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
content::NotificationService::AllSources());
observer.Wait();
}
void SwitchLanguage(const std::string& language) { void SwitchLanguage(const std::string& language) {
const char get_num_reloads[] = "Oobe.getInstance().reloadContentNumEvents_"; const char get_num_reloads[] = "Oobe.getInstance().reloadContentNumEvents_";
const int prev_reloads = test::OobeJS().GetInt(get_num_reloads); const int prev_reloads = test::OobeJS().GetInt(get_num_reloads);
...@@ -212,7 +205,6 @@ class SyncConsentTest : public OobeBaseTest { ...@@ -212,7 +205,6 @@ class SyncConsentTest : public OobeBaseTest {
}; };
IN_PROC_BROWSER_TEST_F(SyncConsentTest, SyncConsentRecorder) { IN_PROC_BROWSER_TEST_F(SyncConsentTest, SyncConsentRecorder) {
WaitForUIToLoad();
EXPECT_EQ(g_browser_process->GetApplicationLocale(), "en-US"); EXPECT_EQ(g_browser_process->GetApplicationLocale(), "en-US");
LoginToSyncConsentScreen(); LoginToSyncConsentScreen();
// For En-US we hardcode strings here to catch string issues too. // For En-US we hardcode strings here to catch string issues too.
...@@ -245,7 +237,6 @@ class SyncConsentTestWithParams ...@@ -245,7 +237,6 @@ class SyncConsentTestWithParams
IN_PROC_BROWSER_TEST_P(SyncConsentTestWithParams, SyncConsentTestWithLocale) { IN_PROC_BROWSER_TEST_P(SyncConsentTestWithParams, SyncConsentTestWithLocale) {
LOG(INFO) << "SyncConsentTestWithParams() started with param='" << GetParam() LOG(INFO) << "SyncConsentTestWithParams() started with param='" << GetParam()
<< "'"; << "'";
WaitForUIToLoad();
EXPECT_EQ(g_browser_process->GetApplicationLocale(), "en-US"); EXPECT_EQ(g_browser_process->GetApplicationLocale(), "en-US");
SwitchLanguage(GetParam()); SwitchLanguage(GetParam());
LoginToSyncConsentScreen(); LoginToSyncConsentScreen();
......
...@@ -103,6 +103,7 @@ void OobeBaseTest::WaitForOobeUI() { ...@@ -103,6 +103,7 @@ void OobeBaseTest::WaitForOobeUI() {
run_loop.QuitClosure())) { run_loop.QuitClosure())) {
run_loop.Run(); run_loop.Run();
} }
MaybeWaitForLoginScreenLoad();
} }
void OobeBaseTest::WaitForGaiaPageLoad() { void OobeBaseTest::WaitForGaiaPageLoad() {
...@@ -159,7 +160,7 @@ void OobeBaseTest::WaitForSigninScreen() { ...@@ -159,7 +160,7 @@ void OobeBaseTest::WaitForSigninScreen() {
WizardController::SkipPostLoginScreensForTesting(); WizardController::SkipPostLoginScreensForTesting();
login_screen_load_observer_->Wait(); MaybeWaitForLoginScreenLoad();
} }
test::JSChecker OobeBaseTest::SigninFrameJS() { test::JSChecker OobeBaseTest::SigninFrameJS() {
...@@ -172,4 +173,11 @@ test::JSChecker OobeBaseTest::SigninFrameJS() { ...@@ -172,4 +173,11 @@ test::JSChecker OobeBaseTest::SigninFrameJS() {
return result; return result;
} }
void OobeBaseTest::MaybeWaitForLoginScreenLoad() {
if (!login_screen_load_observer_)
return;
login_screen_load_observer_->Wait();
login_screen_load_observer_.reset();
}
} // namespace chromeos } // namespace chromeos
...@@ -58,13 +58,18 @@ class OobeBaseTest : public MixinBasedInProcessBrowserTest { ...@@ -58,13 +58,18 @@ class OobeBaseTest : public MixinBasedInProcessBrowserTest {
// is set before SetUpCommandLine is invoked. // is set before SetUpCommandLine is invoked.
bool needs_background_networking_ = false; bool needs_background_networking_ = false;
std::unique_ptr<content::WindowedNotificationObserver>
login_screen_load_observer_;
std::string gaia_frame_parent_ = "signin-frame"; std::string gaia_frame_parent_ = "signin-frame";
std::string authenticator_id_ = "$('gaia-signin').authenticator_"; std::string authenticator_id_ = "$('gaia-signin').authenticator_";
EmbeddedTestServerSetupMixin embedded_test_server_{&mixin_host_, EmbeddedTestServerSetupMixin embedded_test_server_{&mixin_host_,
embedded_test_server()}; embedded_test_server()};
private:
// Waits for login_screen_load_observer_ and resets it afterwards.
void MaybeWaitForLoginScreenLoad();
std::unique_ptr<content::WindowedNotificationObserver>
login_screen_load_observer_;
DISALLOW_COPY_AND_ASSIGN(OobeBaseTest); DISALLOW_COPY_AND_ASSIGN(OobeBaseTest);
}; };
......
...@@ -42,10 +42,6 @@ void WaitForExit(OobeScreenId screen_id) { ...@@ -42,10 +42,6 @@ void WaitForExit(OobeScreenId screen_id) {
} // namespace } // namespace
void WaitForWelcomeScreen() { void WaitForWelcomeScreen() {
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
content::NotificationService::AllSources());
observer.Wait();
WaitFor(WelcomeView::kScreenId); WaitFor(WelcomeView::kScreenId);
} }
......
...@@ -84,9 +84,6 @@ IN_PROC_BROWSER_TEST_F(ForceMaximizeOnFirstRunTest, PRE_TwoRuns) { ...@@ -84,9 +84,6 @@ IN_PROC_BROWSER_TEST_F(ForceMaximizeOnFirstRunTest, PRE_TwoRuns) {
IN_PROC_BROWSER_TEST_F(ForceMaximizeOnFirstRunTest, TwoRuns) { IN_PROC_BROWSER_TEST_F(ForceMaximizeOnFirstRunTest, TwoRuns) {
SetUpResolution(); SetUpResolution();
content::WindowedNotificationObserver(
chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
content::NotificationService::AllSources()).Wait();
LogIn(kAccountId, kAccountPassword, kEmptyServices); LogIn(kAccountId, kAccountPassword, kEmptyServices);
const Browser* const browser = OpenNewBrowserWindow(); const Browser* const browser = OpenNewBrowserWindow();
......
...@@ -85,9 +85,6 @@ IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, PRE_LogInAndVerify) { ...@@ -85,9 +85,6 @@ IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, PRE_LogInAndVerify) {
// Verify that the policies are honored on an existing user's login. // Verify that the policies are honored on an existing user's login.
IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, LogInAndVerify) { IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, LogInAndVerify) {
content::WindowedNotificationObserver(
chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
content::NotificationService::AllSources()).Wait();
LogInAndVerifyStartUpURLs(); LogInAndVerifyStartUpURLs();
} }
......
...@@ -2096,6 +2096,7 @@ if (!is_android) { ...@@ -2096,6 +2096,7 @@ if (!is_android) {
"../browser/chromeos/input_method/textinput_test_helper.h", "../browser/chromeos/input_method/textinput_test_helper.h",
"../browser/chromeos/lock_screen_apps/note_taking_browsertest.cc", "../browser/chromeos/lock_screen_apps/note_taking_browsertest.cc",
"../browser/chromeos/logging_browsertest.cc", "../browser/chromeos/logging_browsertest.cc",
"../browser/chromeos/login/accessibility_browsertest.cc",
"../browser/chromeos/login/active_directory_login_browsertest.cc", "../browser/chromeos/login/active_directory_login_browsertest.cc",
"../browser/chromeos/login/arc_terms_of_service_browsertest.cc", "../browser/chromeos/login/arc_terms_of_service_browsertest.cc",
"../browser/chromeos/login/auto_launched_kiosk_browsertest.cc", "../browser/chromeos/login/auto_launched_kiosk_browsertest.cc",
......
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