summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/cocoa/bug_report_window_controller_unittest.mm6
-rw-r--r--chrome/browser/dom_ui/dom_ui_unittest.cc10
-rw-r--r--chrome/browser/sync/glue/autofill_data_type_controller.cc2
-rw-r--r--chrome/browser/sync/glue/autofill_model_associator.cc8
-rw-r--r--chrome/browser/sync/glue/autofill_model_associator.h2
-rw-r--r--chrome/browser/sync/glue/bookmark_change_processor.cc8
-rw-r--r--chrome/browser/sync/glue/bookmark_data_type_controller.cc6
-rw-r--r--chrome/browser/sync/glue/bookmark_model_associator.cc8
-rw-r--r--chrome/browser/sync/glue/bookmark_model_associator.h2
-rw-r--r--chrome/browser/sync/glue/preference_change_processor.cc10
-rw-r--r--chrome/browser/sync/glue/preference_change_processor.h2
-rw-r--r--chrome/browser/sync/glue/preference_data_type_controller.cc4
-rw-r--r--chrome/browser/sync/glue/preference_model_associator.cc9
-rw-r--r--chrome/browser/sync/glue/preference_model_associator.h2
-rw-r--r--chrome/browser/sync/glue/typed_url_data_type_controller.cc2
-rw-r--r--chrome/browser/sync/profile_sync_service.h6
-rw-r--r--chrome/browser/sync/profile_sync_service_mock.h3
-rw-r--r--chrome/browser/sync/profile_sync_service_typed_url_unittest.cc3
-rw-r--r--chrome/browser/tab_contents/render_view_host_manager_unittest.cc10
-rw-r--r--chrome/browser/tab_contents/web_contents_unittest.cc3
-rw-r--r--chrome/browser/views/bookmark_bar_view_test.cc1
-rw-r--r--chrome/test/testing_profile.cc19
-rw-r--r--chrome/test/testing_profile.h5
-rwxr-xr-xtools/valgrind/memcheck/suppressions.txt51
24 files changed, 74 insertions, 108 deletions
diff --git a/chrome/browser/cocoa/bug_report_window_controller_unittest.mm b/chrome/browser/cocoa/bug_report_window_controller_unittest.mm
index 65b0a87..941327f 100644
--- a/chrome/browser/cocoa/bug_report_window_controller_unittest.mm
+++ b/chrome/browser/cocoa/bug_report_window_controller_unittest.mm
@@ -14,12 +14,6 @@
namespace {
class BugReportWindowControllerUnittest : public RenderViewHostTestHarness {
- public:
- virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
- // This is needed since the new tab page queries the sync service.
- profile_->CreateProfileSyncService();
- }
};
// See http://crbug.com/29019 for why it's disabled.
diff --git a/chrome/browser/dom_ui/dom_ui_unittest.cc b/chrome/browser/dom_ui/dom_ui_unittest.cc
index 678229d4..0172837 100644
--- a/chrome/browser/dom_ui/dom_ui_unittest.cc
+++ b/chrome/browser/dom_ui/dom_ui_unittest.cc
@@ -84,9 +84,6 @@ class DOMUITest : public RenderViewHostTestHarness {
// TabContents when we first navigate to a DOM UI page, then to a standard
// non-DOM-UI page.
TEST_F(DOMUITest, DOMUIToStandard) {
- // The sync service must be created to host the sync NTP advertisement.
- profile_->CreateProfileSyncService();
-
DoNavigationTest(contents(), 1);
// Test the case where we're not doing the initial navigation. This is
@@ -99,9 +96,6 @@ TEST_F(DOMUITest, DOMUIToStandard) {
}
TEST_F(DOMUITest, DOMUIToDOMUI) {
- // The sync service must be created to host the sync NTP advertisement.
- profile_->CreateProfileSyncService();
-
// Do a load (this state is tested above).
GURL new_tab_url(chrome::kChromeUINewTabURL);
controller().LoadURL(new_tab_url, GURL(), PageTransition::LINK);
@@ -137,9 +131,6 @@ TEST_F(DOMUITest, StandardToDOMUI) {
EXPECT_FALSE(contents()->ShouldShowBookmarkBar());
EXPECT_FALSE(contents()->FocusLocationBarByDefault());
- // The sync service must be created to host the sync NTP advertisement.
- profile_->CreateProfileSyncService();
-
// Start a pending load for a DOMUI.
GURL new_tab_url(chrome::kChromeUINewTabURL);
controller().LoadURL(new_tab_url, GURL(), PageTransition::LINK);
@@ -172,7 +163,6 @@ TEST_F(DOMUITest, FocusOnNavigate) {
tc->controller().CopyStateFrom(controller());
scoped_ptr<TestTabContents> tc_scoped_ptr(tc);
contents_.swap(tc_scoped_ptr);
- profile_->CreateProfileSyncService();
int page_id = 200;
// Load the NTP.
diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.cc b/chrome/browser/sync/glue/autofill_data_type_controller.cc
index 3857459..10fb9ec 100644
--- a/chrome/browser/sync/glue/autofill_data_type_controller.cc
+++ b/chrome/browser/sync/glue/autofill_data_type_controller.cc
@@ -27,12 +27,14 @@ AutofillDataTypeController::AutofillDataTypeController(
sync_service_(sync_service),
state_(NOT_RUNNING),
merge_allowed_(false) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(profile_sync_factory);
DCHECK(profile);
DCHECK(sync_service);
}
AutofillDataTypeController::~AutofillDataTypeController() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
}
void AutofillDataTypeController::Start(bool merge_allowed,
diff --git a/chrome/browser/sync/glue/autofill_model_associator.cc b/chrome/browser/sync/glue/autofill_model_associator.cc
index 06d3427..25175e7 100644
--- a/chrome/browser/sync/glue/autofill_model_associator.cc
+++ b/chrome/browser/sync/glue/autofill_model_associator.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "base/utf_string_conversions.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/autofill_change_processor.h"
@@ -27,11 +28,16 @@ AutofillModelAssociator::AutofillModelAssociator(
web_database_(web_database),
error_handler_(error_handler),
autofill_node_id_(sync_api::kInvalidId) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB));
DCHECK(sync_service_);
DCHECK(web_database_);
DCHECK(error_handler_);
}
+AutofillModelAssociator::~AutofillModelAssociator() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB));
+}
+
bool AutofillModelAssociator::AssociateModels() {
LOG(INFO) << "Associating Autofill Models";
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB));
@@ -193,6 +199,7 @@ int64 AutofillModelAssociator::GetSyncIdFromChromeId(
void AutofillModelAssociator::Associate(
const AutofillKey* autofill, int64 sync_id) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB));
DCHECK_NE(sync_api::kInvalidId, sync_id);
DCHECK(id_map_.find(*autofill) == id_map_.end());
DCHECK(id_map_inverse_.find(sync_id) == id_map_inverse_.end());
@@ -201,6 +208,7 @@ void AutofillModelAssociator::Associate(
}
void AutofillModelAssociator::Disassociate(int64 sync_id) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB));
SyncIdToAutofillMap::iterator iter = id_map_inverse_.find(sync_id);
if (iter == id_map_inverse_.end())
return;
diff --git a/chrome/browser/sync/glue/autofill_model_associator.h b/chrome/browser/sync/glue/autofill_model_associator.h
index 41a6387..b9031ed 100644
--- a/chrome/browser/sync/glue/autofill_model_associator.h
+++ b/chrome/browser/sync/glue/autofill_model_associator.h
@@ -38,7 +38,7 @@ class AutofillModelAssociator
AutofillModelAssociator(ProfileSyncService* sync_service,
WebDatabase* web_database,
UnrecoverableErrorHandler* error_handler);
- virtual ~AutofillModelAssociator() { }
+ virtual ~AutofillModelAssociator();
// PerDataTypeAssociatorInterface implementation.
//
diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/chrome/browser/sync/glue/bookmark_change_processor.cc
index 5a84923..92a633f 100644
--- a/chrome/browser/sync/glue/bookmark_change_processor.cc
+++ b/chrome/browser/sync/glue/bookmark_change_processor.cc
@@ -9,6 +9,7 @@
#include "base/string_util.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/favicon_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
@@ -23,11 +24,13 @@ BookmarkChangeProcessor::BookmarkChangeProcessor(
: ChangeProcessor(error_handler),
bookmark_model_(NULL),
model_associator_(model_associator) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(model_associator);
DCHECK(error_handler);
}
void BookmarkChangeProcessor::StartImpl(Profile* profile) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(!bookmark_model_);
bookmark_model_ = profile->GetBookmarkModel();
DCHECK(bookmark_model_->IsLoaded());
@@ -35,6 +38,7 @@ void BookmarkChangeProcessor::StartImpl(Profile* profile) {
}
void BookmarkChangeProcessor::StopImpl() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(bookmark_model_);
bookmark_model_->RemoveObserver(this);
bookmark_model_ = NULL;
@@ -128,8 +132,8 @@ void BookmarkChangeProcessor::BookmarkModelBeingDeleted(
}
void BookmarkChangeProcessor::BookmarkNodeAdded(BookmarkModel* model,
- const BookmarkNode* parent,
- int index) {
+ const BookmarkNode* parent,
+ int index) {
DCHECK(running());
DCHECK(share_handle());
diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller.cc b/chrome/browser/sync/glue/bookmark_data_type_controller.cc
index 60ed68d..3705b31 100644
--- a/chrome/browser/sync/glue/bookmark_data_type_controller.cc
+++ b/chrome/browser/sync/glue/bookmark_data_type_controller.cc
@@ -29,12 +29,14 @@ BookmarkDataTypeController::BookmarkDataTypeController(
state_(NOT_RUNNING),
merge_allowed_(false),
unrecoverable_error_detected_(false) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(profile_sync_factory);
DCHECK(profile);
DCHECK(sync_service);
}
BookmarkDataTypeController::~BookmarkDataTypeController() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
}
void BookmarkDataTypeController::Start(bool merge_allowed,
@@ -103,12 +105,14 @@ void BookmarkDataTypeController::OnUnrecoverableError() {
void BookmarkDataTypeController::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK_EQ(NotificationType::BOOKMARK_MODEL_LOADED, type.value);
registrar_.RemoveAll();
Associate();
}
void BookmarkDataTypeController::Associate() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK_EQ(state_, MODEL_STARTING);
state_ = ASSOCIATING;
@@ -148,11 +152,13 @@ void BookmarkDataTypeController::Associate() {
}
void BookmarkDataTypeController::FinishStart(StartResult result) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
start_callback_->Run(result);
start_callback_.reset();
}
void BookmarkDataTypeController::StartFailed(StartResult result) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
model_associator_.reset();
change_processor_.reset();
state_ = NOT_RUNNING;
diff --git a/chrome/browser/sync/glue/bookmark_model_associator.cc b/chrome/browser/sync/glue/bookmark_model_associator.cc
index aaddd40..ab38942 100644
--- a/chrome/browser/sync/glue/bookmark_model_associator.cc
+++ b/chrome/browser/sync/glue/bookmark_model_associator.cc
@@ -10,6 +10,7 @@
#include "base/message_loop.h"
#include "base/task.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/bookmark_change_processor.h"
@@ -158,9 +159,14 @@ BookmarkModelAssociator::BookmarkModelAssociator(
: sync_service_(sync_service),
error_handler_(error_handler),
ALLOW_THIS_IN_INITIALIZER_LIST(persist_associations_(this)) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(sync_service_);
}
+BookmarkModelAssociator::~BookmarkModelAssociator() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+}
+
bool BookmarkModelAssociator::DisassociateModels() {
id_map_.clear();
id_map_inverse_.clear();
@@ -194,6 +200,7 @@ bool BookmarkModelAssociator::InitSyncNodeFromChromeId(
void BookmarkModelAssociator::Associate(const BookmarkNode* node,
int64 sync_id) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
int64 node_id = node->id();
DCHECK_NE(sync_id, sync_api::kInvalidId);
DCHECK(id_map_.find(node_id) == id_map_.end());
@@ -205,6 +212,7 @@ void BookmarkModelAssociator::Associate(const BookmarkNode* node,
}
void BookmarkModelAssociator::Disassociate(int64 sync_id) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
SyncIdToBookmarkNodeMap::iterator iter = id_map_inverse_.find(sync_id);
if (iter == id_map_inverse_.end())
return;
diff --git a/chrome/browser/sync/glue/bookmark_model_associator.h b/chrome/browser/sync/glue/bookmark_model_associator.h
index 2fd96bd..9df77cd 100644
--- a/chrome/browser/sync/glue/bookmark_model_associator.h
+++ b/chrome/browser/sync/glue/bookmark_model_associator.h
@@ -38,7 +38,7 @@ class BookmarkModelAssociator
static syncable::ModelType model_type() { return syncable::BOOKMARKS; }
BookmarkModelAssociator(ProfileSyncService* sync_service,
UnrecoverableErrorHandler* error_handler);
- virtual ~BookmarkModelAssociator() { }
+ virtual ~BookmarkModelAssociator();
// AssociatorInterface implementation.
//
diff --git a/chrome/browser/sync/glue/preference_change_processor.cc b/chrome/browser/sync/glue/preference_change_processor.cc
index d363c06..00ca62c 100644
--- a/chrome/browser/sync/glue/preference_change_processor.cc
+++ b/chrome/browser/sync/glue/preference_change_processor.cc
@@ -9,6 +9,7 @@
#include "base/json/json_reader.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/glue/preference_model_associator.h"
#include "chrome/browser/sync/profile_sync_service.h"
@@ -25,13 +26,19 @@ PreferenceChangeProcessor::PreferenceChangeProcessor(
: ChangeProcessor(error_handler),
pref_service_(NULL),
model_associator_(model_associator) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(model_associator);
DCHECK(error_handler);
}
+PreferenceChangeProcessor::~PreferenceChangeProcessor(){
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+}
+
void PreferenceChangeProcessor::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(running());
DCHECK(NotificationType::PREF_CHANGED == type);
DCHECK_EQ(pref_service_, Source<PrefService>(source).ptr());
@@ -68,6 +75,7 @@ void PreferenceChangeProcessor::ApplyChangesFromSyncModel(
const sync_api::BaseTransaction* trans,
const sync_api::SyncManager::ChangeRecord* changes,
int change_count) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
if (!running())
return;
StopObserving();
@@ -146,11 +154,13 @@ Value* PreferenceChangeProcessor::ReadPreference(
}
void PreferenceChangeProcessor::StartImpl(Profile* profile) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
pref_service_ = profile->GetPrefs();
StartObserving();
}
void PreferenceChangeProcessor::StopImpl() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
StopObserving();
pref_service_ = NULL;
}
diff --git a/chrome/browser/sync/glue/preference_change_processor.h b/chrome/browser/sync/glue/preference_change_processor.h
index eaae008..f00ca2e 100644
--- a/chrome/browser/sync/glue/preference_change_processor.h
+++ b/chrome/browser/sync/glue/preference_change_processor.h
@@ -25,7 +25,7 @@ class PreferenceChangeProcessor : public ChangeProcessor,
public:
PreferenceChangeProcessor(PreferenceModelAssociator* model_associator,
UnrecoverableErrorHandler* error_handler);
- virtual ~PreferenceChangeProcessor() {}
+ virtual ~PreferenceChangeProcessor();
// NotificationObserver implementation.
// PrefService -> sync_api model change application.
diff --git a/chrome/browser/sync/glue/preference_data_type_controller.cc b/chrome/browser/sync/glue/preference_data_type_controller.cc
index e7ddb1f..a3c52c6 100644
--- a/chrome/browser/sync/glue/preference_data_type_controller.cc
+++ b/chrome/browser/sync/glue/preference_data_type_controller.cc
@@ -22,11 +22,13 @@ PreferenceDataTypeController::PreferenceDataTypeController(
sync_service_(sync_service),
state_(NOT_RUNNING),
unrecoverable_error_detected_(false) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(profile_sync_factory);
DCHECK(sync_service);
}
PreferenceDataTypeController::~PreferenceDataTypeController() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
}
void PreferenceDataTypeController::Start(bool merge_allowed,
@@ -105,11 +107,13 @@ void PreferenceDataTypeController::OnUnrecoverableError() {
}
void PreferenceDataTypeController::FinishStart(StartResult result) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
start_callback_->Run(result);
start_callback_.reset();
}
void PreferenceDataTypeController::StartFailed(StartResult result) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
model_associator_.reset();
change_processor_.reset();
start_callback_->Run(result);
diff --git a/chrome/browser/sync/glue/preference_model_associator.cc b/chrome/browser/sync/glue/preference_model_associator.cc
index ffd30f0..28ba96f 100644
--- a/chrome/browser/sync/glue/preference_model_associator.cc
+++ b/chrome/browser/sync/glue/preference_model_associator.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/values.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/engine/syncapi.h"
@@ -24,6 +25,7 @@ PreferenceModelAssociator::PreferenceModelAssociator(
: sync_service_(sync_service),
error_handler_(error_handler),
preferences_node_id_(sync_api::kInvalidId) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(sync_service_);
synced_preferences_.insert(prefs::kHomePageIsNewTabPage);
synced_preferences_.insert(prefs::kHomePage);
@@ -33,7 +35,12 @@ PreferenceModelAssociator::PreferenceModelAssociator(
synced_preferences_.insert(prefs::kShowHomeButton);
}
+PreferenceModelAssociator::~PreferenceModelAssociator() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+}
+
bool PreferenceModelAssociator::AssociateModels() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
PrefService* pref_service = sync_service_->profile()->GetPrefs();
int64 root_id;
@@ -167,6 +174,7 @@ int64 PreferenceModelAssociator::GetSyncIdFromChromeId(
void PreferenceModelAssociator::Associate(
const PrefService::Preference* preference, int64 sync_id) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK_NE(sync_api::kInvalidId, sync_id);
DCHECK(id_map_.find(preference->name()) == id_map_.end());
DCHECK(id_map_inverse_.find(sync_id) == id_map_inverse_.end());
@@ -175,6 +183,7 @@ void PreferenceModelAssociator::Associate(
}
void PreferenceModelAssociator::Disassociate(int64 sync_id) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
SyncIdToPreferenceNameMap::iterator iter = id_map_inverse_.find(sync_id);
if (iter == id_map_inverse_.end())
return;
diff --git a/chrome/browser/sync/glue/preference_model_associator.h b/chrome/browser/sync/glue/preference_model_associator.h
index 8f0bbca..ca66e30 100644
--- a/chrome/browser/sync/glue/preference_model_associator.h
+++ b/chrome/browser/sync/glue/preference_model_associator.h
@@ -32,7 +32,7 @@ class PreferenceModelAssociator
static syncable::ModelType model_type() { return syncable::PREFERENCES; }
PreferenceModelAssociator(ProfileSyncService* sync_service,
UnrecoverableErrorHandler* error_handler);
- virtual ~PreferenceModelAssociator() { }
+ virtual ~PreferenceModelAssociator();
// Returns the list of preference names that should be monitored for changes.
const std::set<std::wstring>& synced_preferences() {
diff --git a/chrome/browser/sync/glue/typed_url_data_type_controller.cc b/chrome/browser/sync/glue/typed_url_data_type_controller.cc
index 831f2ae..ec5c4e1 100644
--- a/chrome/browser/sync/glue/typed_url_data_type_controller.cc
+++ b/chrome/browser/sync/glue/typed_url_data_type_controller.cc
@@ -54,12 +54,14 @@ TypedUrlDataTypeController::TypedUrlDataTypeController(
sync_service_(sync_service),
state_(NOT_RUNNING),
merge_allowed_(false) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(profile_sync_factory);
DCHECK(profile);
DCHECK(sync_service);
}
TypedUrlDataTypeController::~TypedUrlDataTypeController() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
}
void TypedUrlDataTypeController::Start(bool merge_allowed,
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
index d9d8f65..283c4bd 100644
--- a/chrome/browser/sync/profile_sync_service.h
+++ b/chrome/browser/sync/profile_sync_service.h
@@ -104,7 +104,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
virtual void DisableForUser();
// Whether sync is enabled by user or not.
- bool HasSyncSetupCompleted() const;
+ virtual bool HasSyncSetupCompleted() const;
void SetSyncSetupCompleted();
// SyncFrontend implementation.
@@ -186,8 +186,8 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
// Adds/removes an observer. ProfileSyncService does not take ownership of
// the observer.
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
+ virtual void AddObserver(Observer* observer);
+ virtual void RemoveObserver(Observer* observer);
// Record stats on various events.
static void SyncEvent(SyncEventCodes code);
diff --git a/chrome/browser/sync/profile_sync_service_mock.h b/chrome/browser/sync/profile_sync_service_mock.h
index 22e7f9e..2be8b23 100644
--- a/chrome/browser/sync/profile_sync_service_mock.h
+++ b/chrome/browser/sync/profile_sync_service_mock.h
@@ -39,6 +39,9 @@ class ProfileSyncServiceMock : public ProfileSyncService {
browser_sync::ChangeProcessor* change_processor));
MOCK_METHOD0(InitializeBackend, void());
+ MOCK_METHOD1(AddObserver, void(Observer*));
+ MOCK_METHOD1(RemoveObserver, void(Observer*));
+ MOCK_CONST_METHOD0(HasSyncSetupCompleted, bool());
};
#endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_
diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
index fe04d94ac3..716cbe2 100644
--- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
@@ -93,10 +93,11 @@ class RunOnDBThreadTask : public Task {
: backend_(backend), task_(task) {}
virtual void Run() {
task_->RunOnDBThread(backend_, NULL);
+ task_ = NULL;
}
private:
HistoryBackend* backend_;
- HistoryDBTask* task_;
+ scoped_refptr<HistoryDBTask> task_;
};
ACTION_P2(RunTaskOnDBThread, thread, backend) {
diff --git a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
index 6e2c9cd..668406d 100644
--- a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
@@ -35,9 +35,6 @@ TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) {
GURL ntp(chrome::kChromeUINewTabURL);
GURL dest("http://www.google.com/");
- // The sync service must be created to host the sync NTP advertisement.
- profile_->CreateProfileSyncService();
-
// Navigate our first tab to the new tab page and then to the destination.
NavigateActiveAndCommit(ntp);
NavigateActiveAndCommit(dest);
@@ -83,9 +80,6 @@ TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) {
const GURL kNtpUrl(chrome::kChromeUINewTabURL);
const GURL kUrl("view-source:http://foo");
- // The sync service must be created to host the sync NTP advertisement.
- profile_->CreateProfileSyncService();
-
// We have to navigate to some page at first since without this, the first
// navigation will reuse the SiteInstance created by Init(), and the second
// one will create a new SiteInstance. Because current_instance and
@@ -95,8 +89,6 @@ TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) {
NavigateActiveAndCommit(kNtpUrl);
// Navigate.
- // The sync service must be available to show the NTP sync advertisement.
- profile_->CreateProfileSyncService();
controller().LoadURL(kUrl, GURL() /* referer */, PageTransition::TYPED);
// Simulate response from RenderView for FirePageBeforeUnload.
rvh()->TestOnMessageReceived(
@@ -238,8 +230,6 @@ TEST_F(RenderViewHostManagerTest, DOMUI) {
manager.Init(profile_.get(), instance, MSG_ROUTING_NONE);
- // The sync service must be created to host the sync advertisement on the NTP.
- profile_->CreateProfileSyncService();
GURL url("chrome://newtab");
NavigationEntry entry(NULL /* instance */, -1 /* page_id */, url,
GURL() /* referrer */, string16() /* title */,
diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc
index 754cced..0ab3faf 100644
--- a/chrome/browser/tab_contents/web_contents_unittest.cc
+++ b/chrome/browser/tab_contents/web_contents_unittest.cc
@@ -203,9 +203,6 @@ class TabContentsTest : public RenderViewHostTestHarness {
virtual void SetUp() {
profile_.reset(new TabContentsTestingProfile());
- // The sync service must be created to host the sync NTP advertisement.
- profile_->CreateProfileSyncService();
-
RenderViewHostTestHarness::SetUp();
}
diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/views/bookmark_bar_view_test.cc
index 5d6cbdb..c0d116d 100644
--- a/chrome/browser/views/bookmark_bar_view_test.cc
+++ b/chrome/browser/views/bookmark_bar_view_test.cc
@@ -86,7 +86,6 @@ class BookmarkBarViewEventTestBase : public ViewEventTestBase {
profile_->CreateBookmarkModel(true);
profile_->BlockUntilBookmarkModelLoaded();
profile_->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true);
- profile_->CreateProfileSyncService();
model_ = profile_->GetBookmarkModel();
model_->ClearStore();
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index 4a7484e..a69e2e2 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -13,11 +13,11 @@
#include "chrome/browser/history/history_backend.h"
#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/sessions/session_service.h"
-#include "chrome/browser/sync/profile_sync_factory_impl.h"
-#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_mock.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/notification_service.h"
#include "net/url_request/url_request_context.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "webkit/database/database_tracker.h"
#if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)
@@ -25,6 +25,7 @@
#endif
using base::Time;
+using testing::Return;
namespace {
@@ -329,18 +330,12 @@ void TestingProfile::BlockUntilHistoryProcessesPendingRequests() {
MessageLoop::current()->Run();
}
-void TestingProfile::CreateProfileSyncService() {
+ProfileSyncService* TestingProfile::GetProfileSyncService() {
if (!profile_sync_service_.get()) {
- profile_sync_factory_.reset(
- new ProfileSyncFactoryImpl(this,
- CommandLine::ForCurrentProcess()));
- profile_sync_service_.reset(
- profile_sync_factory_->CreateProfileSyncService());
- profile_sync_service_->Initialize();
+ ProfileSyncServiceMock* pss = new ProfileSyncServiceMock();
+ ON_CALL(*pss, HasSyncSetupCompleted()).WillByDefault(Return(false));
+ profile_sync_service_.reset(pss);
}
-}
-
-ProfileSyncService* TestingProfile::GetProfileSyncService() {
return profile_sync_service_.get();
}
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index 02cf1fd..2099948 100644
--- a/chrome/test/testing_profile.h
+++ b/chrome/test/testing_profile.h
@@ -23,7 +23,6 @@
#include "chrome/browser/search_engines/template_url_model.h"
#include "net/base/cookie_monster.h"
-class ProfileSyncFactory;
class ProfileSyncService;
class SessionService;
@@ -249,7 +248,6 @@ class TestingProfile : public Profile {
void BlockUntilHistoryProcessesPendingRequests();
// Creates and initializes a profile sync service if the tests require one.
- void CreateProfileSyncService();
virtual ProfileSyncService* GetProfileSyncService();
protected:
@@ -280,9 +278,6 @@ class TestingProfile : public Profile {
// The BookmarkModel. Only created if CreateBookmarkModel is invoked.
scoped_ptr<BookmarkModel> bookmark_bar_model_;
- // The ProfileSyncFactory. Created by CreateProfileSyncService.
- scoped_ptr<ProfileSyncFactory> profile_sync_factory_;
-
// The ProfileSyncService. Created by CreateProfileSyncService.
scoped_ptr<ProfileSyncService> profile_sync_service_;
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt
index 9eab175..5c56c32 100755
--- a/tools/valgrind/memcheck/suppressions.txt
+++ b/tools/valgrind/memcheck/suppressions.txt
@@ -2520,13 +2520,6 @@
fun:_ZN2v88internal4Heap24PerformGarbageCollectionENS0_15AllocationSpaceENS0_16GarbageCollectorEPNS0_8GCTracerE
}
{
- bug_37168
- Memcheck:Leak
- fun:_Znw*
- fun:_ZN22ProfileSyncFactoryImpl24CreateProfileSyncServiceEv
- fun:_ZN14TestingProfile24CreateProfileSyncServiceEv
-}
-{
bug_37439
Memcheck:Leak
fun:malloc
@@ -2601,50 +2594,6 @@
fun:_ZN148_GLOBAL__N__b_slave_chromium_rel_chromeos_valgrind_tests_1_build_src_chrome_browser_autofill_autofill_infobar_delegate_unittest.cc_00000000_D76CE52B27AutoFillInfoBarDelegateTest5SetUpEv
}
{
- bug_38487
- Memcheck:Leak
- fun:_Znw*
- fun:_ZN12browser_sync26TypedUrlDataTypeController4StopEv
- fun:_ZN12browser_sync19DataTypeManagerImpl10FinishStopEv
- fun:_ZN12browser_sync19DataTypeManagerImpl4StopEv
- fun:_ZN18ProfileSyncService8ShutdownEb
- fun:_ZN18ProfileSyncServiceD2Ev
- fun:_ZN25TestingProfileSyncServiceD0Ev
- fun:_ZN10scoped_ptrI25TestingProfileSyncServiceE5resetEPS0_
- fun:_ZN30ProfileSyncServiceTypedUrlTest8TearDownEv
- fun:_ZN7testing4Test3RunEv
- fun:_ZN7testing8internal12TestInfoImpl3RunEv
- fun:_ZN7testing8TestCase3RunEv
- fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
- fun:_ZN7testing8UnitTest3RunEv
- fun:_ZN9TestSuite3RunEv
- fun:main
-}
-{
- bug_38490
- Memcheck:Leak
- fun:_Znw*
- fun:_ZN12browser_sync26TypedUrlDataTypeController5StartEbP14CallbackRunnerI6Tuple1INS_18DataTypeController11StartResultEEE
- fun:_ZN12browser_sync19DataTypeManagerImpl13StartNextTypeEv
- fun:_ZN12browser_sync19DataTypeManagerImpl7ObserveE16NotificationTypeRK18NotificationSourceRK19NotificationDetails
- fun:_ZN19NotificationService6NotifyE16NotificationTypeRK18NotificationSourceRK19NotificationDetails
- fun:_ZNK13NotifyActionPIN16NotificationType4TypeEE10gmock_ImplIFvvEE17gmock_PerformImplIN7testing8internal12ExcessiveArgES9_S9_S9_S9_S9_S9_S9_S9_S9_EEvRKNSt3tr15tupleINSA_10_NullClassESC_SC_SC_SC_SC_SC_SC_SC_SC_EET_T0_T1_T2_T3_T4_T5_T6_T7_T8_
- fun:_ZN7testing8internal12ActionHelperIvN13NotifyActionPIN16NotificationType4TypeEE10gmock_ImplIFvvEEEE7PerformEPS8_RKNSt3tr15tupleINSB_10_NullClassESD_SD_SD_SD_SD_SD_SD_SD_SD_EE
- fun:_ZN13NotifyActionPIN16NotificationType4TypeEE10gmock_ImplIFvvEE7PerformERKNSt3tr15tupleINS6_10_NullClassES8_S8_S8_S8_S8_S8_S8_S8_S8_EE
- fun:_ZNK7testing6ActionIFvvEE7PerformERKNSt3tr15tupleINS3_10_NullClassES5_S5_S5_S5_S5_S5_S5_S5_S5_EE
- fun:_ZN7testing8internal12DoBothActionI13NotifyActionPIN16NotificationType4TypeEENS0_12ReturnActionIbEEE4ImplIFbvEE7PerformERKNSt3tr15tupleINSC_10_NullClassESE_SE_SE_SE_SE_SE_SE_SE_SE_EE
- fun:_ZNK7testing6ActionIFbvEE7PerformERKNSt3tr15tupleINS3_10_NullClassES5_S5_S5_S5_S5_S5_S5_S5_S5_EE
- fun:_ZNK7testing8internal18FunctionMockerBaseIFbvEE20PerformDefaultActionERKNSt3tr15tupleINS4_10_NullClassES6_S6_S6_S6_S6_S6_S6_S6_S6_EERKSs
- fun:_ZN7testing8internal18ActionResultHolderIbE20PerformDefaultActionIFbvENSt3tr15tupleINS5_10_NullClassES7_S7_S7_S7_S7_S7_S7_S7_S7_EEEES2_PKNS0_18FunctionMockerBaseIT_EERKT0_RKSs
- fun:_ZN7testing8internal18FunctionMockerBaseIFbvEE10InvokeWithERKNSt3tr15tupleINS4_10_NullClassES6_S6_S6_S6_S6_S6_S6_S6_S6_EE
- fun:_ZN7testing8internal14FunctionMockerIFbvEE6InvokeEv
- fun:_ZN12browser_sync19SyncBackendHostMock12RequestPauseEv
- ...
- fun:_ZN18ProfileSyncService29StartProcessingChangesIfReadyEv
- fun:_ZN18ProfileSyncService20OnBackendInitializedEv
- fun:_ZN12browser_sync15SyncBackendHost4Core14NotifyFrontendENS1_20FrontendNotificationE
-}
-{
bug_30633_39325
Memcheck:Leak
fun:_Znw*