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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_helper_unittest.cc

Issue 10823212: Relanding this as this did not fix the chromiumos breakage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
Property Changes:
Added: svn:mergeinfo
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/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/content_settings/cookie_settings.h" 6 #include "chrome/browser/content_settings/cookie_settings.h"
7 #include "chrome/browser/prefs/pref_service.h" 7 #include "chrome/browser/prefs/pref_service.h"
8 #include "chrome/browser/prefs/scoped_user_pref_update.h" 8 #include "chrome/browser/prefs/scoped_user_pref_update.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_info_cache.h" 10 #include "chrome/browser/profiles/profile_info_cache.h"
(...skipping 17 matching lines...) Expand all
28 using ::testing::_; 28 using ::testing::_;
29 using ::testing::Mock; 29 using ::testing::Mock;
30 using ::testing::Return; 30 using ::testing::Return;
31 using ::testing::ReturnRef; 31 using ::testing::ReturnRef;
32 using ::testing::Values; 32 using ::testing::Values;
33 33
34 namespace { 34 namespace {
35 35
36 class SigninManagerMock : public FakeSigninManager { 36 class SigninManagerMock : public FakeSigninManager {
37 public: 37 public:
38 SigninManagerMock() {} 38 explicit SigninManagerMock(Profile* profile)
39 : FakeSigninManager(profile) {}
39 MOCK_CONST_METHOD1(IsAllowedUsername, bool(const std::string& username)); 40 MOCK_CONST_METHOD1(IsAllowedUsername, bool(const std::string& username));
40 }; 41 };
41 42
42 class OneClickSigninHelperTest : public content::RenderViewHostTestHarness { 43 class OneClickSigninHelperTest : public content::RenderViewHostTestHarness {
43 public: 44 public:
44 OneClickSigninHelperTest(); 45 OneClickSigninHelperTest();
45 46
46 virtual void SetUp() OVERRIDE; 47 virtual void SetUp() OVERRIDE;
47 48
48 protected: 49 protected:
(...skipping 22 matching lines...) Expand all
71 : ui_thread_(content::BrowserThread::UI, &message_loop_) { 72 : ui_thread_(content::BrowserThread::UI, &message_loop_) {
72 } 73 }
73 74
74 void OneClickSigninHelperTest::SetUp() { 75 void OneClickSigninHelperTest::SetUp() {
75 // Don't call base class so that default browser context and test WebContents 76 // Don't call base class so that default browser context and test WebContents
76 // are not created now. They will be created in CreateMockWebContents() 77 // are not created now. They will be created in CreateMockWebContents()
77 // as needed. 78 // as needed.
78 } 79 }
79 80
80 static ProfileKeyedService* BuildSigninManagerMock(Profile* profile) { 81 static ProfileKeyedService* BuildSigninManagerMock(Profile* profile) {
81 return new SigninManagerMock(); 82 return new SigninManagerMock(profile);
82 } 83 }
83 84
84 content::WebContents* OneClickSigninHelperTest::CreateMockWebContents( 85 content::WebContents* OneClickSigninHelperTest::CreateMockWebContents(
85 bool use_incognito, 86 bool use_incognito,
86 const std::string& username) { 87 const std::string& username) {
87 TestingProfile* testing_profile = new TestingProfile(); 88 TestingProfile* testing_profile = new TestingProfile();
88 browser_context_.reset(testing_profile); 89 browser_context_.reset(testing_profile);
89 90
90 testing_profile->set_incognito(use_incognito); 91 testing_profile->set_incognito(use_incognito);
91 signin_manager_ = static_cast<SigninManagerMock*>( 92 signin_manager_ = static_cast<SigninManagerMock*>(
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 content::WebContents* web_contents = CreateMockWebContents(false, ""); 209 content::WebContents* web_contents = CreateMockWebContents(false, "");
209 AllowSigninCookies(false); 210 AllowSigninCookies(false);
210 211
211 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). 212 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)).
212 WillRepeatedly(Return(true)); 213 WillRepeatedly(Return(true));
213 214
214 EXPECT_FALSE(OneClickSigninHelper::CanOffer(web_contents, "user@gmail.com", 215 EXPECT_FALSE(OneClickSigninHelper::CanOffer(web_contents, "user@gmail.com",
215 true)); 216 true));
216 EXPECT_FALSE(OneClickSigninHelper::CanOffer(web_contents, "", false)); 217 EXPECT_FALSE(OneClickSigninHelper::CanOffer(web_contents, "", false));
217 } 218 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_ui_util_unittest.cc ('k') | chrome/browser/ui/webui/sync_setup_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698