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 12 matching lines...) Expand all Loading... |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 class OneClickSigninSyncStarterTest : public ChromeRenderViewHostTestHarness { | 25 class OneClickSigninSyncStarterTest : public ChromeRenderViewHostTestHarness { |
26 public: | 26 public: |
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 virtual 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 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableSync); |
38 | 38 |
39 SigninManagerBase* signin_manager = static_cast<FakeSigninManager*>( | 39 SigninManagerBase* signin_manager = static_cast<FakeSigninManager*>( |
40 SigninManagerFactory::GetForProfile(profile())); | 40 SigninManagerFactory::GetForProfile(profile())); |
41 | 41 |
42 signin_manager->Initialize(NULL); | 42 signin_manager->Initialize(NULL); |
43 signin_manager->SetAuthenticatedUsername(kTestingUsername); | 43 signin_manager->SetAuthenticatedUsername(kTestingUsername); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 const GURL kTestURL = GURL("http://www.example.com"); | 121 const GURL kTestURL = GURL("http://www.example.com"); |
122 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback, | 122 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback, |
123 base::Unretained(this)), | 123 base::Unretained(this)), |
124 kTestURL); | 124 kTestURL); |
125 sync_starter_->MergeSessionComplete( | 125 sync_starter_->MergeSessionComplete( |
126 GoogleServiceAuthError(GoogleServiceAuthError::NONE)); | 126 GoogleServiceAuthError(GoogleServiceAuthError::NONE)); |
127 EXPECT_EQ(1, succeeded_count_); | 127 EXPECT_EQ(1, succeeded_count_); |
128 EXPECT_EQ(kTestURL, controller.GetPendingEntry()->GetURL()); | 128 EXPECT_EQ(kTestURL, controller.GetPendingEntry()->GetURL()); |
129 } | 129 } |
OLD | NEW |