| 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 85b15a476eef2b46117b5bac59e5ca3519e433c9..76c34cd99b13f319e3d6aa49381dc3d456dc7d84 100644
|
| --- a/chrome/browser/chromeos/login/login_utils_browsertest.cc
|
| +++ b/chrome/browser/chromeos/login/login_utils_browsertest.cc
|
| @@ -30,6 +30,7 @@
|
| #include "chrome/common/net/gaia/gaia_auth_consumer.h"
|
| #include "chrome/test/base/testing_browser_process.h"
|
| #include "chrome/test/base/testing_pref_service.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| #include "content/public/common/url_fetcher_delegate.h"
|
| #include "content/test/test_browser_thread.h"
|
| #include "content/test/test_url_fetcher_factory.h"
|
| @@ -48,6 +49,7 @@ using ::testing::DoAll;
|
| using ::testing::Return;
|
| using ::testing::SetArgPointee;
|
| using ::testing::_;
|
| +using content::BrowserThread;
|
|
|
| const char kTrue[] = "true";
|
| const char kDomain[] = "domain.com";
|
| @@ -74,15 +76,6 @@ ACTION_P(MockSessionManagerClientPolicyCallback, policy) {
|
| arg0.Run(policy);
|
| }
|
|
|
| -// Subclass IOThread to expose set_message_loop.
|
| -class TestIOThread : public IOThread {
|
| - public:
|
| - explicit TestIOThread(PrefService* local_state)
|
| - : IOThread(local_state, NULL, NULL) {}
|
| -
|
| - using IOThread::set_message_loop;
|
| -};
|
| -
|
| template<typename TESTBASE>
|
| class LoginUtilsTestBase : public TESTBASE,
|
| public LoginUtils::Delegate,
|
| @@ -95,7 +88,8 @@ class LoginUtilsTestBase : public TESTBASE,
|
| local_state_(browser_process_),
|
| ui_thread_(content::BrowserThread::UI, &loop_),
|
| file_thread_(content::BrowserThread::FILE, &loop_),
|
| - io_thread_(local_state_.Get()),
|
| + io_thread_(content::BrowserThread::IO, &loop_),
|
| + io_thread_state_(local_state_.Get(), NULL, NULL),
|
| prepared_profile_(NULL) {}
|
|
|
| virtual void SetUp() OVERRIDE {
|
| @@ -111,7 +105,7 @@ class LoginUtilsTestBase : public TESTBASE,
|
|
|
| local_state_.Get()->RegisterStringPref(prefs::kApplicationLocale, "");
|
|
|
| - browser_process_->SetIOThread(&io_thread_);
|
| + browser_process_->SetIOThread(&io_thread_state_);
|
|
|
| DBusThreadManager::InitializeForTesting(&dbus_thread_manager_);
|
|
|
| @@ -158,24 +152,26 @@ class LoginUtilsTestBase : public TESTBASE,
|
| connector_ = browser_process_->browser_policy_connector();
|
| connector_->Init();
|
|
|
| + file_thread_.Start();
|
| + io_thread_.StartIOThread();
|
| +
|
| loop_.RunAllPending();
|
| }
|
|
|
| virtual void TearDown() OVERRIDE {
|
| loop_.RunAllPending();
|
| - {
|
| - // chrome_browser_net::Predictor usually skips its shutdown routines on
|
| - // unit_tests, but does the full thing when
|
| - // g_browser_process->profile_manager() is valid during initialization.
|
| - // Run a task on a temporary BrowserThread::IO that allows skipping
|
| - // these routines.
|
| - io_thread_.set_message_loop(&loop_);
|
| - loop_.PostTask(FROM_HERE,
|
| - base::Bind(&LoginUtilsTestBase::TearDownOnIO,
|
| - base::Unretained(this)));
|
| - loop_.RunAllPending();
|
| - io_thread_.set_message_loop(NULL);
|
| - }
|
| +
|
| + // chrome_browser_net::Predictor usually skips its shutdown routines on
|
| + // unit_tests, but does the full thing when
|
| + // g_browser_process->profile_manager() is valid during initialization.
|
| + //
|
| + // Since the IO thread here is actually a TestIOThread that uses
|
| + // loop_, this allows skipping these routines.
|
| + BrowserThread::PostTask(BrowserThread::IO,
|
| + FROM_HERE,
|
| + base::Bind(&LoginUtilsTestBase::TearDownOnIO,
|
| + base::Unretained(this)));
|
| + loop_.RunAllPending();
|
|
|
| // These trigger some tasks that have to run while BrowserThread::UI
|
| // exists.
|
| @@ -305,7 +301,8 @@ class LoginUtilsTestBase : public TESTBASE,
|
|
|
| content::TestBrowserThread ui_thread_;
|
| content::TestBrowserThread file_thread_;
|
| - TestIOThread io_thread_;
|
| + content::TestBrowserThread io_thread_;
|
| + IOThread io_thread_state_;
|
|
|
| MockDBusThreadManager dbus_thread_manager_;
|
| TestURLFetcherFactory test_url_fetcher_factory_;
|
|
|