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

Side by Side Diff: chrome/browser/sync/profile_sync_service_unittest.cc

Issue 338993007: Track when and how a profile is signed out via UMA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: SignOut() param in Android tests Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 oauth2_token_service, 201 oauth2_token_service,
202 behavior)); 202 behavior));
203 service_->SetClearingBrowseringDataForTesting( 203 service_->SetClearingBrowseringDataForTesting(
204 base::Bind(&ProfileSyncServiceTest::ClearBrowsingDataCallback, 204 base::Bind(&ProfileSyncServiceTest::ClearBrowsingDataCallback,
205 base::Unretained(this))); 205 base::Unretained(this)));
206 } 206 }
207 207
208 #if defined(OS_WIN) || defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_C HROMEOS)) 208 #if defined(OS_WIN) || defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_C HROMEOS))
209 void CreateServiceWithoutSignIn() { 209 void CreateServiceWithoutSignIn() {
210 CreateService(browser_sync::MANUAL_START); 210 CreateService(browser_sync::MANUAL_START);
211 SigninManagerFactory::GetForProfile(profile())->SignOut(); 211 SigninManagerFactory::GetForProfile(profile())->SignOut(
212 signin_metrics::SIGNOUT_TEST);
212 service()->SetBackupStartDelayForTest( 213 service()->SetBackupStartDelayForTest(
213 base::TimeDelta::FromMilliseconds(100)); 214 base::TimeDelta::FromMilliseconds(100));
214 } 215 }
215 #endif 216 #endif
216 217
217 void ShutdownAndDeleteService() { 218 void ShutdownAndDeleteService() {
218 if (service_) 219 if (service_)
219 service_->Shutdown(); 220 service_->Shutdown();
220 service_.reset(); 221 service_.reset();
221 } 222 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 ExpectDataTypeManagerCreation(2); 424 ExpectDataTypeManagerCreation(2);
424 ExpectSyncBackendHostCreation(2); 425 ExpectSyncBackendHostCreation(2);
425 IssueTestTokens(); 426 IssueTestTokens();
426 Initialize(); 427 Initialize();
427 428
428 EXPECT_TRUE(service()->sync_initialized()); 429 EXPECT_TRUE(service()->sync_initialized());
429 EXPECT_FALSE(profile()->GetPrefs()->GetBoolean( 430 EXPECT_FALSE(profile()->GetPrefs()->GetBoolean(
430 sync_driver::prefs::kSyncSuppressStart)); 431 sync_driver::prefs::kSyncSuppressStart));
431 EXPECT_EQ(ProfileSyncService::SYNC, service()->backend_mode()); 432 EXPECT_EQ(ProfileSyncService::SYNC, service()->backend_mode());
432 433
433 SigninManagerFactory::GetForProfile(profile())->SignOut(); 434 SigninManagerFactory::GetForProfile(profile())->SignOut(
435 signin_metrics::SIGNOUT_TEST);
434 EXPECT_TRUE(service()->sync_initialized()); 436 EXPECT_TRUE(service()->sync_initialized());
435 EXPECT_EQ(ProfileSyncService::BACKUP, service()->backend_mode()); 437 EXPECT_EQ(ProfileSyncService::BACKUP, service()->backend_mode());
436 } 438 }
437 #elif !defined (OS_CHROMEOS) 439 #elif !defined (OS_CHROMEOS)
438 TEST_F(ProfileSyncServiceTest, EnableSyncAndSignOut) { 440 TEST_F(ProfileSyncServiceTest, EnableSyncAndSignOut) {
439 CreateService(browser_sync::AUTO_START); 441 CreateService(browser_sync::AUTO_START);
440 ExpectDataTypeManagerCreation(1); 442 ExpectDataTypeManagerCreation(1);
441 ExpectSyncBackendHostCreation(1); 443 ExpectSyncBackendHostCreation(1);
442 IssueTestTokens(); 444 IssueTestTokens();
443 Initialize(); 445 Initialize();
444 446
445 EXPECT_TRUE(service()->sync_initialized()); 447 EXPECT_TRUE(service()->sync_initialized());
446 EXPECT_FALSE(profile()->GetPrefs()->GetBoolean( 448 EXPECT_FALSE(profile()->GetPrefs()->GetBoolean(
447 sync_driver::prefs::kSyncSuppressStart)); 449 sync_driver::prefs::kSyncSuppressStart));
448 450
449 SigninManagerFactory::GetForProfile(profile())->SignOut(); 451 SigninManagerFactory::GetForProfile(profile())->SignOut(
452 signin_metrics::SIGNOUT_TEST);
450 EXPECT_FALSE(service()->sync_initialized()); 453 EXPECT_FALSE(service()->sync_initialized());
451 } 454 }
452 #endif // !defined(OS_CHROMEOS) 455 #endif // !defined(OS_CHROMEOS)
453 456
454 TEST_F(ProfileSyncServiceTest, GetSyncTokenStatus) { 457 TEST_F(ProfileSyncServiceTest, GetSyncTokenStatus) {
455 CreateService(browser_sync::AUTO_START); 458 CreateService(browser_sync::AUTO_START);
456 IssueTestTokens(); 459 IssueTestTokens();
457 ExpectDataTypeManagerCreation(1); 460 ExpectDataTypeManagerCreation(1);
458 ExpectSyncBackendHostCreation(1); 461 ExpectSyncBackendHostCreation(1);
459 Initialize(); 462 Initialize();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 // See that we can override the URL with a flag. 593 // See that we can override the URL with a flag.
591 CommandLine command_line( 594 CommandLine command_line(
592 base::FilePath(base::FilePath(FILE_PATH_LITERAL("chrome.exe")))); 595 base::FilePath(base::FilePath(FILE_PATH_LITERAL("chrome.exe"))));
593 command_line.AppendSwitchASCII(switches::kSyncServiceURL, "https://foo/bar"); 596 command_line.AppendSwitchASCII(switches::kSyncServiceURL, "https://foo/bar");
594 EXPECT_EQ("https://foo/bar", 597 EXPECT_EQ("https://foo/bar",
595 ProfileSyncService::GetSyncServiceURL(command_line).spec()); 598 ProfileSyncService::GetSyncServiceURL(command_line).spec());
596 } 599 }
597 600
598 } // namespace 601 } // namespace
599 } // namespace browser_sync 602 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/ui/sync/one_click_signin_sync_starter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698