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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc

Issue 14197014: Add TestBrowserThreadBundle into RenderViewHostTestHarness. Kill some unnecessary real threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments Created 7 years, 7 months 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/ui/autofill/autofill_dialog_controller_unittest.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
index 76afc05e3a7173b9e1c497c3bfc9b163d9485278..2db30b9f6613260f3ca20b98dae4d90524837aca 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
@@ -6,6 +6,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/prefs/pref_service.h"
+#include "base/run_loop.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view.h"
@@ -21,7 +22,7 @@
#include "components/autofill/browser/wallet/wallet_test_util.h"
#include "components/autofill/common/form_data.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -42,8 +43,6 @@ const char* kFieldsFromPage[] = { "email", "cc-number", "billing region",
"shipping region" };
const char kSettingsOrigin[] = "Chrome settings";
-using content::BrowserThread;
-
class TestAutofillDialogView : public AutofillDialogView {
public:
TestAutofillDialogView() {}
@@ -234,19 +233,7 @@ class TestAutofillDialogController
};
class AutofillDialogControllerTest : public testing::Test {
- public:
- AutofillDialogControllerTest()
- : ui_thread_(BrowserThread::UI, &loop_),
- file_thread_(BrowserThread::FILE),
- file_blocking_thread_(BrowserThread::FILE_USER_BLOCKING),
- io_thread_(BrowserThread::IO) {
- file_thread_.Start();
- file_blocking_thread_.Start();
- io_thread_.StartIOThread();
- }
-
- virtual ~AutofillDialogControllerTest() {}
-
+ protected:
// testing::Test implementation:
virtual void SetUp() OVERRIDE {
FormData form_data;
@@ -333,18 +320,14 @@ class AutofillDialogControllerTest : public testing::Test {
form_structure_ = form_structure;
}
+ // Must be first member to ensure TestBrowserThreads outlive other objects.
+ content::TestBrowserThreadBundle thread_bundle_;
+
#if defined(OS_WIN)
// http://crbug.com/227221
ui::ScopedOleInitializer ole_initializer_;
#endif
- // A bunch of threads are necessary for classes like TestWebContents and
- // URLRequestContextGetter not to fall over.
- base::MessageLoopForUI loop_;
- content::TestBrowserThread ui_thread_;
- content::TestBrowserThread file_thread_;
- content::TestBrowserThread file_blocking_thread_;
- content::TestBrowserThread io_thread_;
TestingProfile profile_;
// The controller owns itself.
@@ -357,8 +340,6 @@ class AutofillDialogControllerTest : public testing::Test {
// Returned when the dialog closes successfully.
const FormStructure* form_structure_;
-
- DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerTest);
Ilya Sherman 2013/05/20 21:38:49 Why did you remove this? I see in your CL descrip
awong 2013/05/20 21:57:56 Replied on main thread and added explanation to th
Ilya Sherman 2013/05/20 22:33:01 Ok, thanks for the explanation -- makes sense :)
};
} // namespace

Powered by Google App Engine
This is Rietveld 408576698