Commit 87d6f0f6 authored by Roman Sorokin's avatar Roman Sorokin Committed by Commit Bot

GuestSessionRlzTest: Wait for InitRlzImpl finish

Test was checking the brand while initializer was in CollectRlzParams
function. Added a closure to wait until InitRlzImpl is finished.

Bug: 997360
Change-Id: I23af618472396b660b82b3f4ed76fa50fb45d879
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2113473Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarRoger Tawa <rogerta@chromium.org>
Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752547}
parent 64a5f1d9
...@@ -289,8 +289,11 @@ class GuestSessionRlzTest : public InProcessBrowserTest, ...@@ -289,8 +289,11 @@ class GuestSessionRlzTest : public InProcessBrowserTest,
DISALLOW_COPY_AND_ASSIGN(GuestSessionRlzTest); DISALLOW_COPY_AND_ASSIGN(GuestSessionRlzTest);
}; };
// Flaky. https://crbug.com/997360. IN_PROC_BROWSER_TEST_P(GuestSessionRlzTest, DeviceIsLocked) {
IN_PROC_BROWSER_TEST_P(GuestSessionRlzTest, DISABLED_DeviceIsLocked) { base::RunLoop loop;
UserSessionInitializer::Get()->set_init_rlz_impl_closure_for_testing(
loop.QuitClosure());
loop.Run();
const char* const expected_brand = const char* const expected_brand =
stub_install_attributes()->IsDeviceLocked() ? "TEST" : ""; stub_install_attributes()->IsDeviceLocked() ? "TEST" : "";
EXPECT_EQ(expected_brand, google_brand::chromeos::GetBrand()); EXPECT_EQ(expected_brand, google_brand::chromeos::GetBrand());
......
...@@ -240,6 +240,8 @@ void UserSessionInitializer::InitRlzImpl(Profile* profile, ...@@ -240,6 +240,8 @@ void UserSessionInitializer::InitRlzImpl(Profile* profile,
ChromeRLZTrackerDelegate::IsGoogleHomepage(profile), ChromeRLZTrackerDelegate::IsGoogleHomepage(profile),
ChromeRLZTrackerDelegate::IsGoogleInStartpages(profile)); ChromeRLZTrackerDelegate::IsGoogleInStartpages(profile));
#endif #endif
if (init_rlz_impl_closure_for_testing_)
std::move(init_rlz_impl_closure_for_testing_).Run();
} }
} // namespace chromeos } // namespace chromeos
...@@ -44,6 +44,10 @@ class UserSessionInitializer : public session_manager::SessionManagerObserver { ...@@ -44,6 +44,10 @@ class UserSessionInitializer : public session_manager::SessionManagerObserver {
// Initialize child user profile services that depend on the policy. // Initialize child user profile services that depend on the policy.
void InitializeChildUserServices(Profile* profile); void InitializeChildUserServices(Profile* profile);
void set_init_rlz_impl_closure_for_testing(base::OnceClosure closure) {
init_rlz_impl_closure_for_testing_ = std::move(closure);
}
private: private:
// Initialize RLZ. // Initialize RLZ.
void InitRlz(Profile* profile); void InitRlz(Profile* profile);
...@@ -66,6 +70,8 @@ class UserSessionInitializer : public session_manager::SessionManagerObserver { ...@@ -66,6 +70,8 @@ class UserSessionInitializer : public session_manager::SessionManagerObserver {
// Initializes RLZ. If |disabled| is true, RLZ pings are disabled. // Initializes RLZ. If |disabled| is true, RLZ pings are disabled.
void InitRlzImpl(Profile* profile, const RlzInitParams& params); void InitRlzImpl(Profile* profile, const RlzInitParams& params);
base::OnceClosure init_rlz_impl_closure_for_testing_;
base::WeakPtrFactory<UserSessionInitializer> weak_factory_{this}; base::WeakPtrFactory<UserSessionInitializer> weak_factory_{this};
}; };
......
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