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

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

Issue 1094103005: Profile chooser on mac was passing wrong value to signin error controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 TEST_F(SigninGlobalErrorTest, ErrorAuthStatusProvider) { 97 TEST_F(SigninGlobalErrorTest, ErrorAuthStatusProvider) {
98 scoped_ptr<FakeAuthStatusProvider> provider; 98 scoped_ptr<FakeAuthStatusProvider> provider;
99 scoped_ptr<FakeAuthStatusProvider> error_provider; 99 scoped_ptr<FakeAuthStatusProvider> error_provider;
100 100
101 provider.reset(new FakeAuthStatusProvider(error_controller())); 101 provider.reset(new FakeAuthStatusProvider(error_controller()));
102 ASSERT_FALSE(global_error()->HasMenuItem()); 102 ASSERT_FALSE(global_error()->HasMenuItem());
103 103
104 error_provider.reset(new FakeAuthStatusProvider(error_controller())); 104 error_provider.reset(new FakeAuthStatusProvider(error_controller()));
105 error_provider->SetAuthError( 105 error_provider->SetAuthError(
106 kTestAccountId, 106 kTestAccountId,
107 kTestUsername,
108 GoogleServiceAuthError( 107 GoogleServiceAuthError(
109 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); 108 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
110 ASSERT_TRUE(global_error()->HasMenuItem()); 109 ASSERT_TRUE(global_error()->HasMenuItem());
111 110
112 error_provider.reset(); 111 error_provider.reset();
113 ASSERT_FALSE(global_error()->HasMenuItem()); 112 ASSERT_FALSE(global_error()->HasMenuItem());
114 113
115 provider.reset(); 114 provider.reset();
116 error_provider.reset(); 115 error_provider.reset();
117 ASSERT_FALSE(global_error()->HasMenuItem()); 116 ASSERT_FALSE(global_error()->HasMenuItem());
(...skipping 25 matching lines...) Expand all
143 static_assert(arraysize(table) == GoogleServiceAuthError::NUM_STATES, 142 static_assert(arraysize(table) == GoogleServiceAuthError::NUM_STATES,
144 "table size should match number of auth error types"); 143 "table size should match number of auth error types");
145 144
146 // Mark the profile with an active timestamp so profile_metrics logs it. 145 // Mark the profile with an active timestamp so profile_metrics logs it.
147 testing_profile_manager()->UpdateLastUser(profile()); 146 testing_profile_manager()->UpdateLastUser(profile());
148 147
149 for (size_t i = 0; i < arraysize(table); ++i) { 148 for (size_t i = 0; i < arraysize(table); ++i) {
150 base::HistogramTester histogram_tester; 149 base::HistogramTester histogram_tester;
151 FakeAuthStatusProvider provider(error_controller()); 150 FakeAuthStatusProvider provider(error_controller());
152 provider.SetAuthError(kTestAccountId, 151 provider.SetAuthError(kTestAccountId,
153 kTestUsername,
154 GoogleServiceAuthError(table[i].error_state)); 152 GoogleServiceAuthError(table[i].error_state));
155 153
156 EXPECT_EQ(global_error()->HasMenuItem(), table[i].is_error); 154 EXPECT_EQ(global_error()->HasMenuItem(), table[i].is_error);
157 EXPECT_EQ(global_error()->MenuItemLabel().empty(), !table[i].is_error); 155 EXPECT_EQ(global_error()->MenuItemLabel().empty(), !table[i].is_error);
158 EXPECT_EQ(global_error()->GetBubbleViewMessages().empty(), 156 EXPECT_EQ(global_error()->GetBubbleViewMessages().empty(),
159 !table[i].is_error); 157 !table[i].is_error);
160 EXPECT_FALSE(global_error()->GetBubbleViewTitle().empty()); 158 EXPECT_FALSE(global_error()->GetBubbleViewTitle().empty());
161 EXPECT_FALSE(global_error()->GetBubbleViewAcceptButtonLabel().empty()); 159 EXPECT_FALSE(global_error()->GetBubbleViewAcceptButtonLabel().empty());
162 EXPECT_TRUE(global_error()->GetBubbleViewCancelButtonLabel().empty()); 160 EXPECT_TRUE(global_error()->GetBubbleViewCancelButtonLabel().empty());
163 161
164 ProfileMetrics::LogNumberOfProfiles( 162 ProfileMetrics::LogNumberOfProfiles(
165 testing_profile_manager()->profile_manager()); 163 testing_profile_manager()->profile_manager());
166 164
167 if (table[i].is_error) 165 if (table[i].is_error)
168 histogram_tester.ExpectBucketCount("Signin.AuthError", i, 1); 166 histogram_tester.ExpectBucketCount("Signin.AuthError", i, 1);
169 histogram_tester.ExpectBucketCount( 167 histogram_tester.ExpectBucketCount(
170 "Profile.NumberOfProfilesWithAuthErrors", table[i].is_error, 1); 168 "Profile.NumberOfProfilesWithAuthErrors", table[i].is_error, 1);
171 } 169 }
172 } 170 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_error_notifier_ash_unittest.cc ('k') | chrome/browser/sync/sync_ui_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698