Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Unified Diff: chrome/browser/chromeos/login/login_utils_browsertest.cc

Issue 8718012: Revert 111695 - Have content/ create and destroy its own threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/login_utils_browsertest.cc
===================================================================
--- chrome/browser/chromeos/login/login_utils_browsertest.cc (revision 111697)
+++ chrome/browser/chromeos/login/login_utils_browsertest.cc (working copy)
@@ -30,7 +30,6 @@
#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"
@@ -49,7 +48,6 @@
using ::testing::Return;
using ::testing::SetArgPointee;
using ::testing::_;
-using content::BrowserThread;
const char kTrue[] = "true";
const char kDomain[] = "domain.com";
@@ -76,19 +74,20 @@
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,
public LoginStatusConsumer {
public:
- // Initialization here is important. The UI thread gets the test's
- // message loop, as does the file thread (which never actually gets
- // started - so this is a way to fake multiple threads on a single
- // test thread). The IO thread does not get the message loop set,
- // and is never started. This is necessary so that we skip various
- // bits of initialization that get posted to the IO thread. We do
- // however, at one point in the test, temporarily set the message
- // loop for the IO thread.
LoginUtilsTestBase()
: loop_(MessageLoop::TYPE_IO),
browser_process_(
@@ -96,8 +95,7 @@
local_state_(browser_process_),
ui_thread_(content::BrowserThread::UI, &loop_),
file_thread_(content::BrowserThread::FILE, &loop_),
- io_thread_(content::BrowserThread::IO),
- io_thread_state_(local_state_.Get(), NULL, NULL),
+ io_thread_(local_state_.Get()),
prepared_profile_(NULL) {}
virtual void SetUp() OVERRIDE {
@@ -113,7 +111,7 @@
local_state_.Get()->RegisterStringPref(prefs::kApplicationLocale, "");
- browser_process_->SetIOThread(&io_thread_state_);
+ browser_process_->SetIOThread(&io_thread_);
DBusThreadManager::InitializeForTesting(&dbus_thread_manager_);
@@ -171,16 +169,12 @@
// g_browser_process->profile_manager() is valid during initialization.
// Run a task on a temporary BrowserThread::IO that allows skipping
// these routines.
- //
- // It is important to not have a fake message loop on the IO
- // thread for the whole test, see comment on LoginUtilsTestBase
- // constructor for details.
- io_thread_.DeprecatedSetMessageLoop(&loop_);
+ io_thread_.set_message_loop(&loop_);
loop_.PostTask(FROM_HERE,
base::Bind(&LoginUtilsTestBase::TearDownOnIO,
base::Unretained(this)));
loop_.RunAllPending();
- io_thread_.DeprecatedSetMessageLoop(NULL);
+ io_thread_.set_message_loop(NULL);
}
// These trigger some tasks that have to run while BrowserThread::UI
@@ -311,8 +305,7 @@
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
- content::TestBrowserThread io_thread_;
- IOThread io_thread_state_;
+ TestIOThread io_thread_;
MockDBusThreadManager dbus_thread_manager_;
TestURLFetcherFactory test_url_fetcher_factory_;
« no previous file with comments | « chrome/browser/chromeos/input_method/xkeyboard.cc ('k') | chrome/browser/chromeos/login/webui_screen_locker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698