| Index: chrome/browser/chromeos/login/login_utils_browsertest.cc
|
| diff --git a/chrome/browser/chromeos/login/login_utils_browsertest.cc b/chrome/browser/chromeos/login/login_utils_browsertest.cc
|
| index 204e772f73e30156bf62b9da0a1262451e71fc5d..074f79f6930422ef7d8c29e7fc9e2b5aa081458b 100644
|
| --- a/chrome/browser/chromeos/login/login_utils_browsertest.cc
|
| +++ b/chrome/browser/chromeos/login/login_utils_browsertest.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/path_service.h"
|
| #include "base/scoped_temp_dir.h"
|
| #include "base/string_util.h"
|
| +#include "base/threading/sequenced_worker_pool.h"
|
| #include "chrome/browser/chromeos/cros/cros_library.h"
|
| #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h"
|
| #include "chrome/browser/chromeos/cros/mock_library_loader.h"
|
| @@ -211,14 +212,14 @@ class LoginUtilsTestBase : public TESTBASE,
|
| connector_ = browser_process_->browser_policy_connector();
|
| connector_->Init();
|
|
|
| - loop_.RunAllPending();
|
| + RunAllPending();
|
| }
|
|
|
| virtual void TearDown() OVERRIDE {
|
| cryptohome::AsyncMethodCaller::Shutdown();
|
| mock_async_method_caller_ = NULL;
|
|
|
| - loop_.RunAllPending();
|
| + RunAllPending();
|
| {
|
| // chrome_browser_net::Predictor usually skips its shutdown routines on
|
| // unit_tests, but does the full thing when
|
| @@ -233,7 +234,7 @@ class LoginUtilsTestBase : public TESTBASE,
|
| loop_.PostTask(FROM_HERE,
|
| base::Bind(&LoginUtilsTestBase::TearDownOnIO,
|
| base::Unretained(this)));
|
| - loop_.RunAllPending();
|
| + RunAllPending();
|
| io_thread_.DeprecatedSetMessageLoop(NULL);
|
| }
|
|
|
| @@ -242,7 +243,7 @@ class LoginUtilsTestBase : public TESTBASE,
|
| connector_ = NULL;
|
| browser_process_->SetBrowserPolicyConnector(NULL);
|
| browser_process_->SetProfileManager(NULL);
|
| - loop_.RunAllPending();
|
| + RunAllPending();
|
| }
|
|
|
| void TearDownOnIO() {
|
| @@ -258,6 +259,12 @@ class LoginUtilsTestBase : public TESTBASE,
|
| }
|
| }
|
|
|
| + void RunAllPending() {
|
| + loop_.RunAllPending();
|
| + BrowserThread::GetBlockingPool()->FlushForTesting();
|
| + loop_.RunAllPending();
|
| + }
|
| +
|
| virtual void OnProfilePrepared(Profile* profile) OVERRIDE {
|
| EXPECT_FALSE(prepared_profile_);
|
| prepared_profile_ = profile;
|
| @@ -284,7 +291,7 @@ class LoginUtilsTestBase : public TESTBASE,
|
| device_data_store->set_device_id(kDeviceId);
|
| EXPECT_EQ(policy::EnterpriseInstallAttributes::LOCK_SUCCESS,
|
| connector_->LockDevice(username));
|
| - loop_.RunAllPending();
|
| + RunAllPending();
|
| }
|
|
|
| void PrepareProfile(const std::string& username) {
|
| @@ -304,7 +311,7 @@ class LoginUtilsTestBase : public TESTBASE,
|
|
|
| LoginUtils::Get()->PrepareProfile(username, std::string(), "password",
|
| false, true, false, this);
|
| - loop_.RunAllPending();
|
| + RunAllPending();
|
| }
|
|
|
| TestURLFetcher* PrepareOAuthFetcher(const std::string& expected_url) {
|
| @@ -488,13 +495,13 @@ TEST_P(LoginUtilsBlockingLoginTest, EnterpriseLoginBlocksForEnterpriseUser) {
|
|
|
| // The cloud policy subsystem is now ready to fetch the dmtoken and the user
|
| // policy.
|
| - loop_.RunAllPending();
|
| + RunAllPending();
|
| if (steps < 4) break;
|
|
|
| fetcher = PrepareDMRegisterFetcher();
|
| fetcher->delegate()->OnURLFetchComplete(fetcher);
|
| // The policy fetch job has now been scheduled, run it:
|
| - loop_.RunAllPending();
|
| + RunAllPending();
|
| if (steps < 5) break;
|
|
|
| // Verify that there is no profile prepared just before the policy fetch.
|
|
|