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

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

Issue 964563002: Replace SetAuthenticatedUsername with SetAuthenticatedAccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@priv
Patch Set: Fix order of init Created 5 years, 8 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
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/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/signin/fake_signin_manager.h" 9 #include "chrome/browser/signin/fake_signin_manager.h"
10 #include "chrome/browser/signin/signin_error_controller_factory.h" 10 #include "chrome/browser/signin/signin_error_controller_factory.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // will return a unique combination of status and link messages from 332 // will return a unique combination of status and link messages from
333 // GetStatusLabels(). 333 // GetStatusLabels().
334 TEST_F(SyncUIUtilTest, DistinctCasesReportUniqueMessageSets) { 334 TEST_F(SyncUIUtilTest, DistinctCasesReportUniqueMessageSets) {
335 std::set<base::string16> messages; 335 std::set<base::string16> messages;
336 for (int idx = 0; idx != NUMBER_OF_STATUS_CASES; idx++) { 336 for (int idx = 0; idx != NUMBER_OF_STATUS_CASES; idx++) {
337 scoped_ptr<Profile> profile(new TestingProfile()); 337 scoped_ptr<Profile> profile(new TestingProfile());
338 ProfileSyncServiceMock service(profile.get()); 338 ProfileSyncServiceMock service(profile.get());
339 GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone(); 339 GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone();
340 EXPECT_CALL(service, GetAuthError()).WillRepeatedly(ReturnRef(error)); 340 EXPECT_CALL(service, GetAuthError()).WillRepeatedly(ReturnRef(error));
341 FakeSigninManagerForSyncUIUtilTest signin(profile.get()); 341 FakeSigninManagerForSyncUIUtilTest signin(profile.get());
342 signin.SetAuthenticatedUsername(kTestUser); 342 signin.SetAuthenticatedAccountInfo(kTestUser, kTestUser);
Nicolas Zea 2015/04/10 20:15:28 use a kTestUserId instead? (here and below)
Roger Tawa OOO till Jul 10th 2015/04/11 00:23:08 Done.
343 scoped_ptr<FakeAuthStatusProvider> provider(new FakeAuthStatusProvider( 343 scoped_ptr<FakeAuthStatusProvider> provider(new FakeAuthStatusProvider(
344 SigninErrorControllerFactory::GetForProfile(profile.get()))); 344 SigninErrorControllerFactory::GetForProfile(profile.get())));
345 GetDistinctCase(service, &signin, provider.get(), idx); 345 GetDistinctCase(service, &signin, provider.get(), idx);
346 base::string16 status_label; 346 base::string16 status_label;
347 base::string16 link_label; 347 base::string16 link_label;
348 sync_ui_util::GetStatusLabels(&service, 348 sync_ui_util::GetStatusLabels(&service,
349 signin, 349 signin,
350 sync_ui_util::WITH_HTML, 350 sync_ui_util::WITH_HTML,
351 &status_label, 351 &status_label,
352 &link_label); 352 &link_label);
(...skipping 18 matching lines...) Expand all
371 // This test ensures that the html_links parameter on GetStatusLabels() is 371 // This test ensures that the html_links parameter on GetStatusLabels() is
372 // honored. 372 // honored.
373 TEST_F(SyncUIUtilTest, HtmlNotIncludedInStatusIfNotRequested) { 373 TEST_F(SyncUIUtilTest, HtmlNotIncludedInStatusIfNotRequested) {
374 for (int idx = 0; idx != NUMBER_OF_STATUS_CASES; idx++) { 374 for (int idx = 0; idx != NUMBER_OF_STATUS_CASES; idx++) {
375 scoped_ptr<Profile> profile( 375 scoped_ptr<Profile> profile(
376 ProfileSyncServiceMock::MakeSignedInTestingProfile()); 376 ProfileSyncServiceMock::MakeSignedInTestingProfile());
377 ProfileSyncServiceMock service(profile.get()); 377 ProfileSyncServiceMock service(profile.get());
378 GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone(); 378 GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone();
379 EXPECT_CALL(service, GetAuthError()).WillRepeatedly(ReturnRef(error)); 379 EXPECT_CALL(service, GetAuthError()).WillRepeatedly(ReturnRef(error));
380 FakeSigninManagerForSyncUIUtilTest signin(profile.get()); 380 FakeSigninManagerForSyncUIUtilTest signin(profile.get());
381 signin.SetAuthenticatedUsername(kTestUser); 381 signin.SetAuthenticatedAccountInfo(kTestUser, kTestUser);
382 scoped_ptr<FakeAuthStatusProvider> provider(new FakeAuthStatusProvider( 382 scoped_ptr<FakeAuthStatusProvider> provider(new FakeAuthStatusProvider(
383 SigninErrorControllerFactory::GetForProfile(profile.get()))); 383 SigninErrorControllerFactory::GetForProfile(profile.get())));
384 GetDistinctCase(service, &signin, provider.get(), idx); 384 GetDistinctCase(service, &signin, provider.get(), idx);
385 base::string16 status_label; 385 base::string16 status_label;
386 base::string16 link_label; 386 base::string16 link_label;
387 sync_ui_util::GetStatusLabels(&service, 387 sync_ui_util::GetStatusLabels(&service,
388 signin, 388 signin,
389 sync_ui_util::PLAIN_TEXT, 389 sync_ui_util::PLAIN_TEXT,
390 &status_label, 390 &status_label,
391 &link_label); 391 &link_label);
392 392
393 // Ensures a search for string 'href' (found in links, not a string to be 393 // Ensures a search for string 'href' (found in links, not a string to be
394 // found in an English language message) fails when links are excluded from 394 // found in an English language message) fails when links are excluded from
395 // the status label. 395 // the status label.
396 EXPECT_FALSE(status_label.empty()); 396 EXPECT_FALSE(status_label.empty());
397 EXPECT_EQ(status_label.find(base::ASCIIToUTF16("href")), 397 EXPECT_EQ(status_label.find(base::ASCIIToUTF16("href")),
398 base::string16::npos); 398 base::string16::npos);
399 testing::Mock::VerifyAndClearExpectations(&service); 399 testing::Mock::VerifyAndClearExpectations(&service);
400 testing::Mock::VerifyAndClearExpectations(&signin); 400 testing::Mock::VerifyAndClearExpectations(&signin);
401 EXPECT_CALL(service, GetAuthError()).WillRepeatedly(ReturnRef(error)); 401 EXPECT_CALL(service, GetAuthError()).WillRepeatedly(ReturnRef(error));
402 provider.reset(); 402 provider.reset();
403 signin.Shutdown(); 403 signin.Shutdown();
404 } 404 }
405 } 405 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698