diff options
author | brg@chromium.com <brg@chromium.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 09:11:44 +0000 |
---|---|---|
committer | brg@chromium.com <brg@chromium.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 09:11:44 +0000 |
commit | 345a8b7973e6693d115d20573f7cef17e4525cb3 (patch) | |
tree | 2a77dcf7842d660688a9775569f1adee43a82184 | |
parent | 2c365900efc2d9aeba3df9c7f5afd1e45d9b530d (diff) | |
download | chromium_src-345a8b7973e6693d115d20573f7cef17e4525cb3.zip chromium_src-345a8b7973e6693d115d20573f7cef17e4525cb3.tar.gz chromium_src-345a8b7973e6693d115d20573f7cef17e4525cb3.tar.bz2 |
Remove the enable-sync flag from the Chrome command line and enable sync by default.
BUG=none
Test=Sync my bookmarks should be enabled by default.
Review URL: http://codereview.chromium.org/248024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27472 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/dom_ui/dom_ui_unittest.cc | 10 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 2 | ||||
-rw-r--r-- | chrome/browser/profile.cc | 2 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_host_manager_unittest.cc | 11 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 2 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 4 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 2 | ||||
-rw-r--r-- | chrome/test/live_sync/live_bookmarks_sync_test.h | 1 | ||||
-rw-r--r-- | chrome/test/testing_profile.cc | 17 | ||||
-rw-r--r-- | chrome/test/testing_profile.h | 11 |
11 files changed, 56 insertions, 10 deletions
diff --git a/chrome/browser/dom_ui/dom_ui_unittest.cc b/chrome/browser/dom_ui/dom_ui_unittest.cc index 4b7015d..665c7c5 100644 --- a/chrome/browser/dom_ui/dom_ui_unittest.cc +++ b/chrome/browser/dom_ui/dom_ui_unittest.cc @@ -82,6 +82,9 @@ 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 @@ -94,6 +97,9 @@ 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); @@ -113,6 +119,7 @@ TEST_F(DOMUITest, DOMUIToDOMUI) { TEST_F(DOMUITest, StandardToDOMUI) { // Start a pending navigation to a regular page. GURL std_url("http://google.com/"); + controller().LoadURL(std_url, GURL(), PageTransition::LINK); // The state should now reflect the default. @@ -128,6 +135,9 @@ TEST_F(DOMUITest, StandardToDOMUI) { EXPECT_FALSE(contents()->IsBookmarkBarAlwaysVisible()); 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); diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 18d935c..073594a 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -1671,7 +1671,7 @@ NewTabUI::NewTabUI(TabContents* contents) } #ifdef CHROME_PERSONALIZATION - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableSync)) { + if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableSync)) { AddMessageHandler((new NewTabPageSyncHandler())->Attach(this)); } #endif diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index 8d33985..d84be9c 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -1369,7 +1369,7 @@ void ProfileImpl::StopCreateSessionServiceTimer() { ProfileSyncService* ProfileImpl::GetProfileSyncService() { #ifdef CHROME_PERSONALIZATION - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableSync)) { + if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableSync)) { if (!sync_service_.get()) InitSyncService(); return sync_service_.get(); 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 556b8bf..e75a4bb 100644 --- a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc +++ b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc @@ -15,6 +15,10 @@ class RenderViewHostManagerTest : public RenderViewHostTestHarness { public: void NavigateActiveAndCommit(const GURL& url) { + // Navigating to an empty URL opens the NTP. The sync service must be + // created to host the sync advertisement. + profile_->CreateProfileSyncService(); + // Note: we navigate the active RenderViewHost because previous navigations // won't have committed yet, so NavigateAndCommit does the wrong thing // for us. @@ -34,6 +38,9 @@ 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); @@ -87,6 +94,8 @@ 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( @@ -227,6 +236,8 @@ 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 c7e089c..ef1de03 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -222,6 +222,10 @@ TEST_F(TabContentsTest, NTPViewSource) { const GURL kGURL(kUrl); process()->sink().ClearMessages(); + + // The sync service must be created to host the sync NTP advertisement. + profile_->CreateProfileSyncService(); + controller().LoadURL(kGURL, GURL(), PageTransition::TYPED); rvh()->delegate()->RenderViewCreated(rvh()); // Did we get the expected message? diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 8ee898d..fdf61b2 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -1073,7 +1073,7 @@ void ToolbarView::CreateAppMenu() { IDS_SHOW_DOWNLOADS); app_menu_contents_->AddSeparator(); #ifdef CHROME_PERSONALIZATION - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableSync)) { + if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableSync)) { app_menu_contents_->AddItem(IDC_SYNC_BOOKMARKS, l10n_util::GetString(IDS_SYNC_MY_BOOKMARKS_LABEL) + L"..."); app_menu_contents_->AddSeparator(); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index e79f345..72d6a5f 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -381,8 +381,8 @@ const wchar_t kGearsPluginPathOverride[] = L"gears-plugin-path"; // Enable the fastback page cache. const wchar_t kEnableFastback[] = L"enable-fastback"; -// Enable syncing bookmarks to a Google Account. -const wchar_t kEnableSync[] = L"enable-sync"; +// Disable syncing bookmarks to a Google Account. +const wchar_t kDisableSync[] = L"disable-sync"; // Use the SyncerThread implementation that matches up with the old pthread // impl semantics, but using Chrome synchronization primitives. The only diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 3696066..79b185e 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -142,7 +142,7 @@ extern const wchar_t kGearsPluginPathOverride[]; extern const wchar_t kEnableFastback[]; -extern const wchar_t kEnableSync[]; +extern const wchar_t kDisableSync[]; extern const wchar_t kSyncerThreadTimedStop[]; extern const wchar_t kSyncerThreadPthreads[]; diff --git a/chrome/test/live_sync/live_bookmarks_sync_test.h b/chrome/test/live_sync/live_bookmarks_sync_test.h index 3ea534a..a21f8bf 100644 --- a/chrome/test/live_sync/live_bookmarks_sync_test.h +++ b/chrome/test/live_sync/live_bookmarks_sync_test.h @@ -50,7 +50,6 @@ class LiveBookmarksSyncTest : public InProcessBrowserTest { // Append command line flag to enable sync. virtual void SetUpCommandLine(CommandLine* command_line) { - command_line->AppendSwitch(switches::kEnableSync); } // Helper to get a handle on a bookmark in |m| when the url is known to be diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc index 1eb312d..cb380fc 100644 --- a/chrome/test/testing_profile.cc +++ b/chrome/test/testing_profile.cc @@ -8,6 +8,7 @@ #include "base/string_util.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/history/history_backend.h" +#include "chrome/browser/sync/profile_sync_service.h" #include "chrome/common/chrome_constants.h" #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) @@ -199,3 +200,19 @@ void TestingProfile::BlockUntilHistoryProcessesPendingRequests() { history_service_->ScheduleDBTask(new QuittingHistoryDBTask(), &consumer); MessageLoop::current()->Run(); } + +void TestingProfile::CreateProfileSyncService() { +#ifdef CHROME_PERSONALIZATION + if (!profile_sync_service_.get()) { + profile_sync_service_.reset(new ProfileSyncService(this)); + profile_sync_service_->Initialize(); + } +#endif +} + +ProfileSyncService* TestingProfile::GetProfileSyncService() { +#ifdef CHROME_PERSONALIZATION + return profile_sync_service_.get(); +#endif + return NULL; +} diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h index b894d7b..f766f469 100644 --- a/chrome/test/testing_profile.h +++ b/chrome/test/testing_profile.h @@ -241,9 +241,9 @@ class TestingProfile : public Profile { // history service processes all pending requests. void BlockUntilHistoryProcessesPendingRequests(); - virtual ProfileSyncService* GetProfileSyncService() { - return NULL; - } + // Creates and initializes a profile sync service if the tests require one. + void CreateProfileSyncService(); + virtual ProfileSyncService* GetProfileSyncService(); protected: // The path of the profile; the various database and other files are relative @@ -263,6 +263,11 @@ class TestingProfile : public Profile { // The BookmarkModel. Only created if CreateBookmarkModel is invoked. scoped_ptr<BookmarkModel> bookmark_bar_model_; + // The ProfileSyncService. Created by CreateProfileSyncService. +#ifdef CHROME_PERSONALIZATION + scoped_ptr<ProfileSyncService> profile_sync_service_; +#endif + // The TemplateURLFetcher. Only created if CreateTemplateURLModel is invoked. scoped_ptr<TemplateURLModel> template_url_model_; |