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

Side by Side Diff: chrome/browser/signin/signin_global_error_unittest.cc

Issue 1117453002: Add gaia_id to ProfileInfoCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments Created 5 years, 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/signin/signin_global_error.h" 5 #include "chrome/browser/signin/signin_global_error.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/test/histogram_tester.h" 10 #include "base/test/histogram_tester.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/test/base/testing_browser_process.h" 24 #include "chrome/test/base/testing_browser_process.h"
25 #include "chrome/test/base/testing_profile.h" 25 #include "chrome/test/base/testing_profile.h"
26 #include "chrome/test/base/testing_profile_manager.h" 26 #include "chrome/test/base/testing_profile_manager.h"
27 #include "components/signin/core/browser/fake_auth_status_provider.h" 27 #include "components/signin/core/browser/fake_auth_status_provider.h"
28 #include "components/signin/core/browser/signin_error_controller.h" 28 #include "components/signin/core/browser/signin_error_controller.h"
29 #include "components/signin/core/browser/signin_manager.h" 29 #include "components/signin/core/browser/signin_manager.h"
30 #include "content/public/test/test_browser_thread_bundle.h" 30 #include "content/public/test/test_browser_thread_bundle.h"
31 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
32 32
33 static const char kTestAccountId[] = "id-testuser@test.com"; 33 static const char kTestAccountId[] = "id-testuser@test.com";
34 static const char kTestGaiaId[] = "gaiaid-testuser@test.com";
34 static const char kTestUsername[] = "testuser@test.com"; 35 static const char kTestUsername[] = "testuser@test.com";
35 36
36 class SigninGlobalErrorTest : public testing::Test { 37 class SigninGlobalErrorTest : public testing::Test {
37 public: 38 public:
38 SigninGlobalErrorTest() : 39 SigninGlobalErrorTest() :
39 profile_manager_(TestingBrowserProcess::GetGlobal()) {} 40 profile_manager_(TestingBrowserProcess::GetGlobal()) {}
40 41
41 void SetUp() override { 42 void SetUp() override {
42 ASSERT_TRUE(profile_manager_.SetUp()); 43 ASSERT_TRUE(profile_manager_.SetUp());
43 44
44 // Create a signed-in profile. 45 // Create a signed-in profile.
45 TestingProfile::TestingFactories testing_factories; 46 TestingProfile::TestingFactories testing_factories;
46 testing_factories.push_back(std::make_pair( 47 testing_factories.push_back(std::make_pair(
47 ProfileOAuth2TokenServiceFactory::GetInstance(), 48 ProfileOAuth2TokenServiceFactory::GetInstance(),
48 BuildFakeProfileOAuth2TokenService)); 49 BuildFakeProfileOAuth2TokenService));
49 testing_factories.push_back(std::make_pair( 50 testing_factories.push_back(std::make_pair(
50 SigninManagerFactory::GetInstance(), 51 SigninManagerFactory::GetInstance(),
51 FakeSigninManagerBase::Build)); 52 FakeSigninManagerBase::Build));
52 profile_ = profile_manager_.CreateTestingProfile( 53 profile_ = profile_manager_.CreateTestingProfile(
53 "Person 1", scoped_ptr<PrefServiceSyncable>(), 54 "Person 1", scoped_ptr<PrefServiceSyncable>(),
54 base::UTF8ToUTF16("Person 1"), 0, std::string(), testing_factories); 55 base::UTF8ToUTF16("Person 1"), 0, std::string(), testing_factories);
55 56
56 SigninManagerFactory::GetForProfile(profile()) 57 SigninManagerFactory::GetForProfile(profile())
57 ->SetAuthenticatedAccountInfo(kTestAccountId, kTestUsername); 58 ->SetAuthenticatedAccountInfo(kTestAccountId, kTestUsername);
58 ProfileInfoCache& cache = 59 ProfileInfoCache& cache =
59 profile_manager_.profile_manager()->GetProfileInfoCache(); 60 profile_manager_.profile_manager()->GetProfileInfoCache();
60 cache.SetUserNameOfProfileAtIndex( 61 cache.SetAuthInfoOfProfileAtIndex(
61 cache.GetIndexOfProfileWithPath(profile()->GetPath()), 62 cache.GetIndexOfProfileWithPath(profile()->GetPath()),
62 base::UTF8ToUTF16(kTestUsername)); 63 kTestGaiaId, base::UTF8ToUTF16(kTestUsername));
63 64
64 global_error_ = SigninGlobalErrorFactory::GetForProfile(profile()); 65 global_error_ = SigninGlobalErrorFactory::GetForProfile(profile());
65 error_controller_ = SigninErrorControllerFactory::GetForProfile(profile()); 66 error_controller_ = SigninErrorControllerFactory::GetForProfile(profile());
66 } 67 }
67 68
68 TestingProfile* profile() { return profile_; } 69 TestingProfile* profile() { return profile_; }
69 TestingProfileManager* testing_profile_manager() { 70 TestingProfileManager* testing_profile_manager() {
70 return &profile_manager_; 71 return &profile_manager_;
71 } 72 }
72 SigninGlobalError* global_error() { return global_error_; } 73 SigninGlobalError* global_error() { return global_error_; }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 162
162 ProfileMetrics::LogNumberOfProfiles( 163 ProfileMetrics::LogNumberOfProfiles(
163 testing_profile_manager()->profile_manager()); 164 testing_profile_manager()->profile_manager());
164 165
165 if (table[i].is_error) 166 if (table[i].is_error)
166 histogram_tester.ExpectBucketCount("Signin.AuthError", i, 1); 167 histogram_tester.ExpectBucketCount("Signin.AuthError", i, 1);
167 histogram_tester.ExpectBucketCount( 168 histogram_tester.ExpectBucketCount(
168 "Profile.NumberOfProfilesWithAuthErrors", table[i].is_error, 1); 169 "Profile.NumberOfProfilesWithAuthErrors", table[i].is_error, 1);
169 } 170 }
170 } 171 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.cc ('k') | chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698