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

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

Issue 10823208: Reverting this as it causes browser tests on the Linux ChromiumOS builder to fail. (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
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 <set> 5 #include <set>
6 #include "base/basictypes.h" 6 #include "base/basictypes.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/signin/signin_manager.h" 9 #include "chrome/browser/signin/signin_manager.h"
10 #include "chrome/browser/signin/signin_manager_fake.h" 10 #include "chrome/browser/signin/signin_manager_fake.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 72
73 // Test that GetStatusLabelsForSyncGlobalError returns an error if a 73 // Test that GetStatusLabelsForSyncGlobalError returns an error if a
74 // passphrase is required. 74 // passphrase is required.
75 TEST(SyncUIUtilTest, PassphraseGlobalError) { 75 TEST(SyncUIUtilTest, PassphraseGlobalError) {
76 MessageLoopForUI message_loop; 76 MessageLoopForUI message_loop;
77 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); 77 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
78 scoped_ptr<Profile> profile( 78 scoped_ptr<Profile> profile(
79 ProfileSyncServiceMock::MakeSignedInTestingProfile()); 79 ProfileSyncServiceMock::MakeSignedInTestingProfile());
80 NiceMock<ProfileSyncServiceMock> service(profile.get()); 80 NiceMock<ProfileSyncServiceMock> service(profile.get());
81 FakeSigninManager signin(profile.get()); 81 FakeSigninManager signin;
82 browser_sync::SyncBackendHost::Status status; 82 browser_sync::SyncBackendHost::Status status;
83 EXPECT_CALL(service, QueryDetailedSyncStatus(_)) 83 EXPECT_CALL(service, QueryDetailedSyncStatus(_))
84 .WillRepeatedly(Return(false)); 84 .WillRepeatedly(Return(false));
85 85
86 EXPECT_CALL(service, IsPassphraseRequired()) 86 EXPECT_CALL(service, IsPassphraseRequired())
87 .WillRepeatedly(Return(true)); 87 .WillRepeatedly(Return(true));
88 EXPECT_CALL(service, IsPassphraseRequiredForDecryption()) 88 EXPECT_CALL(service, IsPassphraseRequiredForDecryption())
89 .WillRepeatedly(Return(true)); 89 .WillRepeatedly(Return(true));
90 VerifySyncGlobalErrorResult( 90 VerifySyncGlobalErrorResult(
91 &service, signin, GoogleServiceAuthError::NONE, true, true); 91 &service, signin, GoogleServiceAuthError::NONE, true, true);
92 } 92 }
93 93
94 // Test that GetStatusLabelsForSyncGlobalError returns an error if a 94 // Test that GetStatusLabelsForSyncGlobalError returns an error if a
95 // passphrase is required. 95 // passphrase is required.
96 TEST(SyncUIUtilTest, AuthAndPassphraseGlobalError) { 96 TEST(SyncUIUtilTest, AuthAndPassphraseGlobalError) {
97 MessageLoopForUI message_loop; 97 MessageLoopForUI message_loop;
98 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); 98 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
99 scoped_ptr<Profile> profile( 99 scoped_ptr<Profile> profile(
100 ProfileSyncServiceMock::MakeSignedInTestingProfile()); 100 ProfileSyncServiceMock::MakeSignedInTestingProfile());
101 NiceMock<ProfileSyncServiceMock> service(profile.get()); 101 NiceMock<ProfileSyncServiceMock> service(profile.get());
102 FakeSigninManager signin(profile.get()); 102 FakeSigninManager signin;
103 browser_sync::SyncBackendHost::Status status; 103 browser_sync::SyncBackendHost::Status status;
104 EXPECT_CALL(service, QueryDetailedSyncStatus(_)) 104 EXPECT_CALL(service, QueryDetailedSyncStatus(_))
105 .WillRepeatedly(Return(false)); 105 .WillRepeatedly(Return(false));
106 106
107 EXPECT_CALL(service, IsPassphraseRequired()) 107 EXPECT_CALL(service, IsPassphraseRequired())
108 .WillRepeatedly(Return(true)); 108 .WillRepeatedly(Return(true));
109 EXPECT_CALL(service, IsPassphraseRequiredForDecryption()) 109 EXPECT_CALL(service, IsPassphraseRequiredForDecryption())
110 .WillRepeatedly(Return(true)); 110 .WillRepeatedly(Return(true));
111 EXPECT_CALL(service, HasSyncSetupCompleted()) 111 EXPECT_CALL(service, HasSyncSetupCompleted())
112 .WillRepeatedly(Return(true)); 112 .WillRepeatedly(Return(true));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 { GoogleServiceAuthError::CONNECTION_FAILED, false }, 146 { GoogleServiceAuthError::CONNECTION_FAILED, false },
147 { GoogleServiceAuthError::CAPTCHA_REQUIRED, true }, 147 { GoogleServiceAuthError::CAPTCHA_REQUIRED, true },
148 { GoogleServiceAuthError::ACCOUNT_DELETED, true }, 148 { GoogleServiceAuthError::ACCOUNT_DELETED, true },
149 { GoogleServiceAuthError::ACCOUNT_DISABLED, true }, 149 { GoogleServiceAuthError::ACCOUNT_DISABLED, true },
150 { GoogleServiceAuthError::SERVICE_UNAVAILABLE, true }, 150 { GoogleServiceAuthError::SERVICE_UNAVAILABLE, true },
151 { GoogleServiceAuthError::TWO_FACTOR, true }, 151 { GoogleServiceAuthError::TWO_FACTOR, true },
152 { GoogleServiceAuthError::REQUEST_CANCELED, true }, 152 { GoogleServiceAuthError::REQUEST_CANCELED, true },
153 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, 153 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true },
154 }; 154 };
155 155
156 FakeSigninManager signin(profile.get()); 156 FakeSigninManager signin;
157 for (size_t i = 0; i < sizeof(table)/sizeof(*table); ++i) { 157 for (size_t i = 0; i < sizeof(table)/sizeof(*table); ++i) {
158 VerifySyncGlobalErrorResult( 158 VerifySyncGlobalErrorResult(
159 &service, signin, table[i].error_state, true, table[i].is_error); 159 &service, signin, table[i].error_state, true, table[i].is_error);
160 VerifySyncGlobalErrorResult( 160 VerifySyncGlobalErrorResult(
161 &service, signin, table[i].error_state, false, false); 161 &service, signin, table[i].error_state, false, false);
162 } 162 }
163 } 163 }
164 // Loads a ProfileSyncServiceMock to emulate one of a number of distinct cases 164 // Loads a ProfileSyncServiceMock to emulate one of a number of distinct cases
165 // in order to perform tests on the generated messages. 165 // in order to perform tests on the generated messages.
166 void GetDistinctCase(ProfileSyncServiceMock& service, 166 void GetDistinctCase(ProfileSyncServiceMock& service,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // Ensures a search for string 'href' (found in links, not a string to be 341 // Ensures a search for string 'href' (found in links, not a string to be
342 // found in an English language message) fails when links are excluded from 342 // found in an English language message) fails when links are excluded from
343 // the status label. 343 // the status label.
344 EXPECT_EQ(status_label.find(string16(ASCIIToUTF16("href"))), 344 EXPECT_EQ(status_label.find(string16(ASCIIToUTF16("href"))),
345 string16::npos); 345 string16::npos);
346 if (auth_error) { 346 if (auth_error) {
347 delete auth_error; 347 delete auth_error;
348 } 348 }
349 } 349 }
350 } 350 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_mock.cc ('k') | chrome/browser/ui/sync/one_click_signin_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698