OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 void CreateService(ProfileSyncServiceStartBehavior behavior) { | 189 void CreateService(ProfileSyncServiceStartBehavior behavior) { |
190 SigninManagerBase* signin = | 190 SigninManagerBase* signin = |
191 SigninManagerFactory::GetForProfile(profile_); | 191 SigninManagerFactory::GetForProfile(profile_); |
192 signin->SetAuthenticatedUsername("test"); | 192 signin->SetAuthenticatedUsername("test"); |
193 ProfileOAuth2TokenService* oauth2_token_service = | 193 ProfileOAuth2TokenService* oauth2_token_service = |
194 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); | 194 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
195 components_factory_ = new StrictMock<ProfileSyncComponentsFactoryMock>(); | 195 components_factory_ = new StrictMock<ProfileSyncComponentsFactoryMock>(); |
196 service_.reset(new ProfileSyncService( | 196 service_.reset(new ProfileSyncService( |
197 components_factory_, | 197 components_factory_, |
198 profile_, | 198 profile_, |
199 new ManagedUserSigninManagerWrapper(profile_, signin), | 199 make_scoped_ptr(new ManagedUserSigninManagerWrapper(profile_, signin)), |
200 oauth2_token_service, | 200 oauth2_token_service, |
201 behavior)); | 201 behavior)); |
202 service_->SetClearingBrowseringDataForTesting( | 202 service_->SetClearingBrowseringDataForTesting( |
203 base::Bind(&ProfileSyncServiceTest::ClearBrowsingDataCallback, | 203 base::Bind(&ProfileSyncServiceTest::ClearBrowsingDataCallback, |
204 base::Unretained(this))); | 204 base::Unretained(this))); |
205 } | 205 } |
206 | 206 |
207 #if defined(OS_WIN) || defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_C
HROMEOS)) | 207 #if defined(OS_WIN) || defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_C
HROMEOS)) |
208 void CreateServiceWithoutSignIn() { | 208 void CreateServiceWithoutSignIn() { |
209 CreateService(browser_sync::MANUAL_START); | 209 CreateService(browser_sync::MANUAL_START); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 // First sync time is erased once backup starts. | 578 // First sync time is erased once backup starts. |
579 EXPECT_TRUE(sync_prefs.GetFirstSyncTime().is_null()); | 579 EXPECT_TRUE(sync_prefs.GetFirstSyncTime().is_null()); |
580 | 580 |
581 EXPECT_EQ(3u, delete_dir_param.size()); | 581 EXPECT_EQ(3u, delete_dir_param.size()); |
582 EXPECT_FALSE(delete_dir_param[0]); | 582 EXPECT_FALSE(delete_dir_param[0]); |
583 EXPECT_FALSE(delete_dir_param[1]); | 583 EXPECT_FALSE(delete_dir_param[1]); |
584 EXPECT_TRUE(delete_dir_param[2]); | 584 EXPECT_TRUE(delete_dir_param[2]); |
585 } | 585 } |
586 #endif | 586 #endif |
587 | 587 |
| 588 TEST_F(ProfileSyncServiceTest, GetSyncServiceURL) { |
| 589 CommandLine command_line(*CommandLine::ForCurrentProcess()); |
| 590 |
| 591 // See that it defaults to a "dev" URL. |
| 592 // |
| 593 // Yes, we're hardcoding the URL here so this test will have to be updated |
| 594 // when/if the URL ever changes. |
| 595 EXPECT_EQ("https://clients4.google.com/chrome-sync/dev", |
| 596 ProfileSyncService::GetSyncServiceURL(command_line).spec()); |
| 597 |
| 598 // See that we can override the URL with a flag. |
| 599 command_line.AppendSwitchASCII("--sync-url", "https://foo/bar"); |
| 600 EXPECT_EQ("https://foo/bar", |
| 601 ProfileSyncService::GetSyncServiceURL(command_line).spec()); |
| 602 } |
| 603 |
588 } // namespace | 604 } // namespace |
589 } // namespace browser_sync | 605 } // namespace browser_sync |
OLD | NEW |