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

Unified Diff: chrome/browser/profiles/off_the_record_profile_impl_unittest.cc

Issue 393133002: Migrate HostZoomMap to live in StoragePartition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to r288093. 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: chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
diff --git a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
index 4a568b746998b6e6b788ebf64b2ee2d1e7505e2a..3566271f8ed15a8fc6f236ac7ad4c963313477a5 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
@@ -18,6 +18,7 @@
#include "chrome/test/base/testing_profile_manager.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/common/page_zoom.h"
+#include "content/public/test/mock_resource_context.h"
#include "net/dns/mock_host_resolver.h"
using content::HostZoomMap;
@@ -64,6 +65,19 @@ class TestingProfileWithHostZoomMap : public TestingProfile {
DISALLOW_COPY_AND_ASSIGN(TestingProfileWithHostZoomMap);
};
+base::Closure ThreadSafeQuit(base::RunLoop* run_loop) {
+ if (content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)) {
+ return run_loop->QuitClosure();
+ } else {
+ using base::Bind;
+ using base::IgnoreResult;
+ return Bind(IgnoreResult(&base::MessageLoopProxy::PostTask),
+ base::MessageLoopProxy::current(),
+ FROM_HERE,
+ run_loop->QuitClosure());
+ }
+}
+
} // namespace
// We need to have a BrowserProcess in g_browser_process variable, since
@@ -81,12 +95,24 @@ class OffTheRecordProfileImplTest : public BrowserWithTestWindowTest {
ASSERT_TRUE(profile_manager_->SetUp());
testing_io_thread_state_.reset(new chrome::TestingIOThreadState());
- testing_io_thread_state_->io_thread_state()->globals()->host_resolver.reset(
- new net::MockHostResolver());
+ base::RunLoop run_loop;
awong 2014/08/11 22:36:33 Is it possible to use something like: https://co
wjmaclean 2014/08/12 16:57:44 Actually, don't even need that. This is cruft from
+ CHECK(content::BrowserThread::PostTask(
+ content::BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(&OffTheRecordProfileImplTest::InitResolver,
+ base::Unretained(this),
+ ThreadSafeQuit(&run_loop))));
+ run_loop.Run();
BrowserWithTestWindowTest::SetUp();
}
+ void InitResolver(const base::Closure& done) {
+ testing_io_thread_state_->io_thread_state()->globals()->host_resolver.reset(
+ new net::MockHostResolver());
+ done.Run();
+ }
+
virtual void TearDown() OVERRIDE {
BrowserWithTestWindowTest::TearDown();
@@ -142,13 +168,9 @@ TEST_F(OffTheRecordProfileImplTest, GetHostZoomMap) {
// OnZoomLevelChanged.
// Prepare an off the record profile owned by the parent profile.
- parent_profile->SetOffTheRecordProfile(
- scoped_ptr<Profile>(new OffTheRecordProfileImpl(parent_profile)));
OffTheRecordProfileImpl* child_profile =
static_cast<OffTheRecordProfileImpl*>(
parent_profile->GetOffTheRecordProfile());
- child_profile->InitIoData();
- child_profile->InitHostZoomMap();
// Prepare child host zoom map.
HostZoomMap* child_zoom_map =

Powered by Google App Engine
This is Rietveld 408576698