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

Unified Diff: components/component_updater/test/update_checker_unittest.cc

Issue 514473002: Componentize component_updater: Break content/ dependency for rest of component_updater tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix lint issues. fix explicits. Created 6 years, 4 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: components/component_updater/test/update_checker_unittest.cc
diff --git a/components/component_updater/test/update_checker_unittest.cc b/components/component_updater/test/update_checker_unittest.cc
index 79cf15c4e7dc255f52a35323a8cea21a5a2c0989..4f8a640089b906eef0879762cbdccf76fa390a0a 100644
--- a/components/component_updater/test/update_checker_unittest.cc
+++ b/components/component_updater/test/update_checker_unittest.cc
@@ -7,6 +7,7 @@
#include "base/files/file_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/version.h"
@@ -14,14 +15,10 @@
#include "components/component_updater/test/test_configurator.h"
#include "components/component_updater/test/url_request_post_interceptor.h"
#include "components/component_updater/update_checker.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/test/test_browser_thread_bundle.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
-using content::BrowserThread;
-
namespace component_updater {
namespace {
@@ -67,16 +64,13 @@ class UpdateCheckerTest : public testing::Test {
UpdateResponse::Results results_;
private:
- content::TestBrowserThreadBundle thread_bundle_;
+ base::MessageLoopForIO loop_;
base::Closure quit_closure_;
DISALLOW_COPY_AND_ASSIGN(UpdateCheckerTest);
};
-UpdateCheckerTest::UpdateCheckerTest()
- : config_(new TestConfigurator),
- error_(0),
- thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {
+UpdateCheckerTest::UpdateCheckerTest() : post_interceptor_(NULL), error_(0) {
net::URLFetcher::SetEnableInterceptionForTests(true);
}
@@ -85,7 +79,10 @@ UpdateCheckerTest::~UpdateCheckerTest() {
}
void UpdateCheckerTest::SetUp() {
- interceptor_factory_.reset(new InterceptorFactory);
+ config_.reset(new TestConfigurator(base::MessageLoopProxy::current(),
+ base::MessageLoopProxy::current()));
+ interceptor_factory_.reset(
+ new InterceptorFactory(base::MessageLoopProxy::current()));
post_interceptor_ = interceptor_factory_->CreateInterceptor();
EXPECT_TRUE(post_interceptor_);
@@ -103,6 +100,10 @@ void UpdateCheckerTest::TearDown() {
interceptor_factory_.reset();
config_.reset();
+
+ // The PostInterceptor requires the message loop to run to destruct correctly.
+ // TODO: This is fragile and should be fixed.
+ RunThreadsUntilIdle();
}
void UpdateCheckerTest::RunThreads() {

Powered by Google App Engine
This is Rietveld 408576698