OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/sync/one_click_signin_sync_starter.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 OneClickSigninSyncStarterTest() | 27 OneClickSigninSyncStarterTest() |
28 : sync_starter_(NULL), | 28 : sync_starter_(NULL), |
29 failed_count_(0), | 29 failed_count_(0), |
30 succeeded_count_(0) {} | 30 succeeded_count_(0) {} |
31 | 31 |
32 // ChromeRenderViewHostTestHarness: | 32 // ChromeRenderViewHostTestHarness: |
33 void SetUp() override { | 33 void SetUp() override { |
34 ChromeRenderViewHostTestHarness::SetUp(); | 34 ChromeRenderViewHostTestHarness::SetUp(); |
35 | 35 |
36 // Disable sync to simplify the creation of a OneClickSigninSyncStarter. | 36 // Disable sync to simplify the creation of a OneClickSigninSyncStarter. |
37 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableSync); | 37 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 38 switches::kDisableSync); |
38 | 39 |
39 SigninManagerBase* signin_manager = static_cast<FakeSigninManager*>( | 40 SigninManagerBase* signin_manager = static_cast<FakeSigninManager*>( |
40 SigninManagerFactory::GetForProfile(profile())); | 41 SigninManagerFactory::GetForProfile(profile())); |
41 | 42 |
42 signin_manager->Initialize(NULL); | 43 signin_manager->Initialize(NULL); |
43 signin_manager->SetAuthenticatedUsername(kTestingUsername); | 44 signin_manager->SetAuthenticatedUsername(kTestingUsername); |
44 } | 45 } |
45 | 46 |
46 void Callback(OneClickSigninSyncStarter::SyncSetupResult result) { | 47 void Callback(OneClickSigninSyncStarter::SyncSetupResult result) { |
47 if (result == OneClickSigninSyncStarter::SYNC_SETUP_SUCCESS) | 48 if (result == OneClickSigninSyncStarter::SYNC_SETUP_SUCCESS) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 121 |
121 const GURL kTestURL = GURL("http://www.example.com"); | 122 const GURL kTestURL = GURL("http://www.example.com"); |
122 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback, | 123 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback, |
123 base::Unretained(this)), | 124 base::Unretained(this)), |
124 kTestURL); | 125 kTestURL); |
125 sync_starter_->MergeSessionComplete( | 126 sync_starter_->MergeSessionComplete( |
126 GoogleServiceAuthError(GoogleServiceAuthError::NONE)); | 127 GoogleServiceAuthError(GoogleServiceAuthError::NONE)); |
127 EXPECT_EQ(1, succeeded_count_); | 128 EXPECT_EQ(1, succeeded_count_); |
128 EXPECT_EQ(kTestURL, controller.GetPendingEntry()->GetURL()); | 129 EXPECT_EQ(kTestURL, controller.GetPendingEntry()->GetURL()); |
129 } | 130 } |
OLD | NEW |