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

Side by Side Diff: components/signin/core/browser/signin_header_helper_unittest.cc

Issue 2944383006: [Signin] Rename obfuscated_gaia_id into gaia_id (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « components/signin/core/browser/signin_header_helper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/signin/core/browser/signin_header_helper.h" 5 #include "components/signin/core/browser/signin_header_helper.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 237
238 TEST_F(SigninHeaderHelperTest, TestDiceInvalidResponseParams) { 238 TEST_F(SigninHeaderHelperTest, TestDiceInvalidResponseParams) {
239 DiceResponseParams params = BuildDiceResponseParams("blah"); 239 DiceResponseParams params = BuildDiceResponseParams("blah");
240 EXPECT_EQ(DiceAction::NONE, params.user_intention); 240 EXPECT_EQ(DiceAction::NONE, params.user_intention);
241 } 241 }
242 242
243 TEST_F(SigninHeaderHelperTest, TestBuildDiceResponseParams) { 243 TEST_F(SigninHeaderHelperTest, TestBuildDiceResponseParams) {
244 const char kAuthorizationCode[] = "authorization_code"; 244 const char kAuthorizationCode[] = "authorization_code";
245 const char kEmail[] = "foo@example.com"; 245 const char kEmail[] = "foo@example.com";
246 const char kObfuscatedGaiaID[] = "obfuscated_gaia_id"; 246 const char kGaiaID[] = "gaia_id";
247 const int kSessionIndex = 42; 247 const int kSessionIndex = 42;
248 248
249 { 249 {
250 // Signin response. 250 // Signin response.
251 DiceResponseParams params = BuildDiceResponseParams(base::StringPrintf( 251 DiceResponseParams params = BuildDiceResponseParams(base::StringPrintf(
252 "action=SIGNIN,id=%s,email=%s,authuser=%i,authorization_code=%s", 252 "action=SIGNIN,id=%s,email=%s,authuser=%i,authorization_code=%s",
253 kObfuscatedGaiaID, kEmail, kSessionIndex, kAuthorizationCode)); 253 kGaiaID, kEmail, kSessionIndex, kAuthorizationCode));
254 EXPECT_EQ(DiceAction::SIGNIN, params.user_intention); 254 EXPECT_EQ(DiceAction::SIGNIN, params.user_intention);
255 EXPECT_EQ(kObfuscatedGaiaID, params.obfuscated_gaia_id); 255 EXPECT_EQ(kGaiaID, params.gaia_id);
256 EXPECT_EQ(kEmail, params.email); 256 EXPECT_EQ(kEmail, params.email);
257 EXPECT_EQ(kSessionIndex, params.session_index); 257 EXPECT_EQ(kSessionIndex, params.session_index);
258 EXPECT_EQ(kAuthorizationCode, params.authorization_code); 258 EXPECT_EQ(kAuthorizationCode, params.authorization_code);
259 } 259 }
260 260
261 { 261 {
262 // Signout response. 262 // Signout response.
263 DiceResponseParams params = BuildDiceResponseParams( 263 DiceResponseParams params = BuildDiceResponseParams(
264 base::StringPrintf("action=SIGNOUT,id=%s,email=%s,authuser=%i", 264 base::StringPrintf("action=SIGNOUT,id=%s,email=%s,authuser=%i", kGaiaID,
265 kObfuscatedGaiaID, kEmail, kSessionIndex)); 265 kEmail, kSessionIndex));
266 EXPECT_EQ(DiceAction::SIGNOUT, params.user_intention); 266 EXPECT_EQ(DiceAction::SIGNOUT, params.user_intention);
267 EXPECT_EQ(kObfuscatedGaiaID, params.obfuscated_gaia_id); 267 EXPECT_EQ(kGaiaID, params.gaia_id);
268 EXPECT_EQ(kEmail, params.email); 268 EXPECT_EQ(kEmail, params.email);
269 EXPECT_EQ(kSessionIndex, params.session_index); 269 EXPECT_EQ(kSessionIndex, params.session_index);
270 EXPECT_EQ("", params.authorization_code); 270 EXPECT_EQ("", params.authorization_code);
271 } 271 }
272 272
273 { 273 {
274 // Missing authorization code. 274 // Missing authorization code.
275 DiceResponseParams params = BuildDiceResponseParams( 275 DiceResponseParams params = BuildDiceResponseParams(
276 base::StringPrintf("action=SIGNIN,id=%s,email=%s,authuser=%i", 276 base::StringPrintf("action=SIGNIN,id=%s,email=%s,authuser=%i", kGaiaID,
277 kObfuscatedGaiaID, kEmail, kSessionIndex)); 277 kEmail, kSessionIndex));
278 EXPECT_EQ(DiceAction::NONE, params.user_intention); 278 EXPECT_EQ(DiceAction::NONE, params.user_intention);
279 } 279 }
280 280
281 { 281 {
282 // Missing non-optional field (email). 282 // Missing non-optional field (email).
283 DiceResponseParams params = BuildDiceResponseParams(base::StringPrintf( 283 DiceResponseParams params = BuildDiceResponseParams(base::StringPrintf(
284 "action=SIGNIN,id=%s,authuser=%i,authorization_code=%s", 284 "action=SIGNIN,id=%s,authuser=%i,authorization_code=%s", kGaiaID,
285 kObfuscatedGaiaID, kSessionIndex, kAuthorizationCode)); 285 kSessionIndex, kAuthorizationCode));
286 EXPECT_EQ(DiceAction::NONE, params.user_intention); 286 EXPECT_EQ(DiceAction::NONE, params.user_intention);
287 } 287 }
288 } 288 }
289 289
290 #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) 290 #endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
291 291
292 // Tests that the Mirror header request is returned normally when the redirect 292 // Tests that the Mirror header request is returned normally when the redirect
293 // URL is eligible. 293 // URL is eligible.
294 TEST_F(SigninHeaderHelperTest, TestMirrorHeaderEligibleRedirectURL) { 294 TEST_F(SigninHeaderHelperTest, TestMirrorHeaderEligibleRedirectURL) {
295 switches::EnableAccountConsistencyMirrorForTesting( 295 switches::EnableAccountConsistencyMirrorForTesting(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 "action=REAUTH,email=%s,is_saml=true,is_same_tab=true,continue_url=%s", 361 "action=REAUTH,email=%s,is_saml=true,is_same_tab=true,continue_url=%s",
362 kEmail, kContinueURL)); 362 kEmail, kContinueURL));
363 EXPECT_EQ(GAIA_SERVICE_TYPE_REAUTH, params.service_type); 363 EXPECT_EQ(GAIA_SERVICE_TYPE_REAUTH, params.service_type);
364 EXPECT_EQ(kEmail, params.email); 364 EXPECT_EQ(kEmail, params.email);
365 EXPECT_EQ(true, params.is_saml); 365 EXPECT_EQ(true, params.is_saml);
366 EXPECT_EQ(true, params.is_same_tab); 366 EXPECT_EQ(true, params.is_same_tab);
367 EXPECT_EQ(GURL(kContinueURL), params.continue_url); 367 EXPECT_EQ(GURL(kContinueURL), params.continue_url);
368 } 368 }
369 369
370 } // namespace signin 370 } // namespace signin
OLDNEW
« no previous file with comments | « components/signin/core/browser/signin_header_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698