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

Unified Diff: chrome/browser/sync/profile_sync_service_session_unittest.cc

Issue 17127002: Correctly integrate StoragePartition into TestingProfile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments. merge to ToT. Murder a DB thread and more TestBrowserThreads. Created 7 years, 5 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/sync/profile_sync_service_session_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_session_unittest.cc b/chrome/browser/sync/profile_sync_service_session_unittest.cc
index bfbf2a9afa8b2ac3e0538996ec7b1c68c456d997..941389fafea3abeb61f05f181a3ac638f62204ba 100644
--- a/chrome/browser/sync/profile_sync_service_session_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_session_unittest.cc
@@ -12,7 +12,7 @@
#include "base/files/scoped_temp_dir.h"
#include "base/location.h"
#include "base/memory/scoped_ptr.h"
-#include "base/message_loop.h"
+#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
@@ -47,6 +47,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_browser_thread.h"
#include "google_apis/gaia/gaia_constants.h"
+#include "net/url_request/test_url_fetcher_factory.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/change_record.h"
#include "sync/internal_api/public/read_node.h"
@@ -200,8 +201,7 @@ class ProfileSyncServiceSessionTest
public content::NotificationObserver {
public:
ProfileSyncServiceSessionTest()
- : io_thread_(BrowserThread::IO),
- window_bounds_(0, 1, 2, 3),
+ : window_bounds_(0, 1, 2, 3),
notified_of_update_(false),
notified_of_refresh_(false) {}
ProfileSyncService* sync_service() { return sync_service_.get(); }
@@ -220,8 +220,6 @@ class ProfileSyncServiceSessionTest
virtual void SetUp() {
// BrowserWithTestWindowTest implementation.
BrowserWithTestWindowTest::SetUp();
- io_thread_.StartIOThread();
- profile()->CreateRequestContext();
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED,
content::NotificationService::AllSources());
@@ -248,7 +246,6 @@ class ProfileSyncServiceSessionTest
virtual void TearDown() {
sync_service_->Shutdown();
sync_service_.reset();
- profile()->ResetRequestContext();
// We need to destroy the profile before shutting down the threads, because
// some of the ref counted objects in the profile depend on their
@@ -258,9 +255,7 @@ class ProfileSyncServiceSessionTest
// Pump messages posted by the sync core thread (which may end up
// posting on the IO thread).
- base::MessageLoop::current()->RunUntilIdle();
- io_thread_.Stop();
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
BrowserWithTestWindowTest::TearDown();
}
@@ -310,7 +305,6 @@ class ProfileSyncServiceSessionTest
return true;
}
- content::TestBrowserThread io_thread_;
// Path used in testing.
base::ScopedTempDir temp_dir_;
SessionModelAssociator* model_associator_;
@@ -321,6 +315,7 @@ class ProfileSyncServiceSessionTest
bool notified_of_update_;
bool notified_of_refresh_;
content::NotificationRegistrar registrar_;
+ net::TestURLFetcherFactory fetcher_factory_;
};
class CreateRootHelper {
@@ -1220,7 +1215,7 @@ TEST_F(ProfileSyncServiceSessionTest, Favicons) {
// Update associator.
model_associator_->AssociateForeignSpecifics(meta, base::Time());
model_associator_->AssociateForeignSpecifics(tab, base::Time());
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
ASSERT_FALSE(model_associator_->GetSyncedFaviconForPageURL(url, &favicon));
// Now add a favicon.
@@ -1228,7 +1223,7 @@ TEST_F(ProfileSyncServiceSessionTest, Favicons) {
tab.mutable_tab()->set_favicon_type(sync_pb::SessionTab::TYPE_WEB_FAVICON);
tab.mutable_tab()->set_favicon("data");
model_associator_->AssociateForeignSpecifics(tab, base::Time());
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
ASSERT_TRUE(model_associator_->GetSyncedFaviconForPageURL(url, &favicon));
ASSERT_TRUE(CompareMemoryToString("data", favicon));
@@ -1239,7 +1234,7 @@ TEST_F(ProfileSyncServiceSessionTest, Favicons) {
tab.mutable_tab()->clear_favicon_type();
tab.mutable_tab()->clear_favicon();
model_associator_->AssociateForeignSpecifics(tab, base::Time());
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
ASSERT_TRUE(model_associator_->GetSyncedFaviconForPageURL(url, &favicon));
}

Powered by Google App Engine
This is Rietveld 408576698