OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/extensions/api/identity/account_tracker.h" | 5 #include "chrome/browser/extensions/api/identity/account_tracker.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // TODO(courage): Account removal really only applies to the primary account, | 26 // TODO(courage): Account removal really only applies to the primary account, |
27 // because that's the only account tracked by the SigninManager. Many of the | 27 // because that's the only account tracked by the SigninManager. Many of the |
28 // tests here remove non-primary accounts. They still properly test the account | 28 // tests here remove non-primary accounts. They still properly test the account |
29 // state machine, but it may be confusing to readers. Update these tests to | 29 // state machine, but it may be confusing to readers. Update these tests to |
30 // avoid causing confusion. | 30 // avoid causing confusion. |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 const char kPrimaryAccountKey[] = "primary_account@example.com"; | 34 const char kPrimaryAccountKey[] = "primary_account@example.com"; |
35 const char kFakeGaiaId[] = "8675309"; | |
36 | 35 |
37 enum TrackingEventType { | 36 enum TrackingEventType { |
38 ADDED, | 37 ADDED, |
39 REMOVED, | 38 REMOVED, |
40 SIGN_IN, | 39 SIGN_IN, |
41 SIGN_OUT | 40 SIGN_OUT |
42 }; | 41 }; |
43 | 42 |
| 43 std::string AccountKeyToObfuscatedId(const std::string email) { |
| 44 return "obfid-" + email; |
| 45 } |
| 46 |
44 class TrackingEvent { | 47 class TrackingEvent { |
45 public: | 48 public: |
46 TrackingEvent(TrackingEventType type, | 49 TrackingEvent(TrackingEventType type, |
47 const std::string& account_key, | 50 const std::string& account_key, |
48 const std::string& gaia_id) | 51 const std::string& gaia_id) |
49 : type_(type), | 52 : type_(type), |
50 account_key_(account_key), | 53 account_key_(account_key), |
51 gaia_id_(gaia_id) {} | 54 gaia_id_(gaia_id) {} |
52 | 55 |
53 TrackingEvent(TrackingEventType type, | 56 TrackingEvent(TrackingEventType type, |
54 const std::string& account_key) | 57 const std::string& account_key) |
55 : type_(type), | 58 : type_(type), |
56 account_key_(account_key), | 59 account_key_(account_key), |
57 gaia_id_(kFakeGaiaId) {} | 60 gaia_id_(AccountKeyToObfuscatedId(account_key)) {} |
58 | 61 |
59 bool operator==(const TrackingEvent& event) const { | 62 bool operator==(const TrackingEvent& event) const { |
60 return type_ == event.type_ && account_key_ == event.account_key_ && | 63 return type_ == event.type_ && account_key_ == event.account_key_ && |
61 gaia_id_ == event.gaia_id_; | 64 gaia_id_ == event.gaia_id_; |
62 } | 65 } |
63 | 66 |
64 std::string ToString() const { | 67 std::string ToString() const { |
65 const char * typestr = "INVALID"; | 68 const char * typestr = "INVALID"; |
66 switch (type_) { | 69 switch (type_) { |
67 case ADDED: | 70 case ADDED: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 const TrackingEvent& e2, | 136 const TrackingEvent& e2, |
134 const TrackingEvent& e3, | 137 const TrackingEvent& e3, |
135 const TrackingEvent& e4, | 138 const TrackingEvent& e4, |
136 const TrackingEvent& e5); | 139 const TrackingEvent& e5); |
137 testing::AssertionResult CheckEvents(const TrackingEvent& e1, | 140 testing::AssertionResult CheckEvents(const TrackingEvent& e1, |
138 const TrackingEvent& e2, | 141 const TrackingEvent& e2, |
139 const TrackingEvent& e3, | 142 const TrackingEvent& e3, |
140 const TrackingEvent& e4, | 143 const TrackingEvent& e4, |
141 const TrackingEvent& e5, | 144 const TrackingEvent& e5, |
142 const TrackingEvent& e6); | 145 const TrackingEvent& e6); |
| 146 void Clear(); |
143 void SortEventsByUser(); | 147 void SortEventsByUser(); |
144 | 148 |
145 // AccountTracker::Observer implementation | 149 // AccountTracker::Observer implementation |
146 virtual void OnAccountAdded(const AccountIds& ids) OVERRIDE; | 150 virtual void OnAccountAdded(const AccountIds& ids) OVERRIDE; |
147 virtual void OnAccountRemoved(const AccountIds& ids) OVERRIDE; | 151 virtual void OnAccountRemoved(const AccountIds& ids) OVERRIDE; |
148 virtual void OnAccountSignInChanged(const AccountIds& ids, bool is_signed_in) | 152 virtual void OnAccountSignInChanged(const AccountIds& ids, bool is_signed_in) |
149 OVERRIDE; | 153 OVERRIDE; |
150 | 154 |
151 private: | 155 private: |
152 testing::AssertionResult CheckEvents( | 156 testing::AssertionResult CheckEvents( |
153 const std::vector<TrackingEvent>& events); | 157 const std::vector<TrackingEvent>& events); |
154 | 158 |
155 std::vector<TrackingEvent> events_; | 159 std::vector<TrackingEvent> events_; |
156 }; | 160 }; |
157 | 161 |
158 void AccountTrackerObserver::OnAccountAdded(const AccountIds& ids) { | 162 void AccountTrackerObserver::OnAccountAdded(const AccountIds& ids) { |
159 events_.push_back(TrackingEvent(ADDED, ids.email, ids.gaia)); | 163 events_.push_back(TrackingEvent(ADDED, ids.email, ids.gaia)); |
160 } | 164 } |
161 | 165 |
162 void AccountTrackerObserver::OnAccountRemoved(const AccountIds& ids) { | 166 void AccountTrackerObserver::OnAccountRemoved(const AccountIds& ids) { |
163 events_.push_back(TrackingEvent(REMOVED, ids.email, ids.gaia)); | 167 events_.push_back(TrackingEvent(REMOVED, ids.email, ids.gaia)); |
164 } | 168 } |
165 | 169 |
166 void AccountTrackerObserver::OnAccountSignInChanged(const AccountIds& ids, | 170 void AccountTrackerObserver::OnAccountSignInChanged(const AccountIds& ids, |
167 bool is_signed_in) { | 171 bool is_signed_in) { |
168 events_.push_back( | 172 events_.push_back( |
169 TrackingEvent(is_signed_in ? SIGN_IN : SIGN_OUT, ids.email, ids.gaia)); | 173 TrackingEvent(is_signed_in ? SIGN_IN : SIGN_OUT, ids.email, ids.gaia)); |
170 } | 174 } |
171 | 175 |
| 176 void AccountTrackerObserver::Clear() { |
| 177 events_.clear(); |
| 178 } |
| 179 |
172 void AccountTrackerObserver::SortEventsByUser() { | 180 void AccountTrackerObserver::SortEventsByUser() { |
173 std::stable_sort(events_.begin(), events_.end(), CompareByUser); | 181 std::stable_sort(events_.begin(), events_.end(), CompareByUser); |
174 } | 182 } |
175 | 183 |
176 testing::AssertionResult AccountTrackerObserver::CheckEvents() { | 184 testing::AssertionResult AccountTrackerObserver::CheckEvents() { |
177 std::vector<TrackingEvent> events; | 185 std::vector<TrackingEvent> events; |
178 return CheckEvents(events); | 186 return CheckEvents(events); |
179 } | 187 } |
180 | 188 |
181 testing::AssertionResult AccountTrackerObserver::CheckEvents( | 189 testing::AssertionResult AccountTrackerObserver::CheckEvents( |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), | 284 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), |
277 FakeSigninManagerBase::Build); | 285 FakeSigninManagerBase::Build); |
278 | 286 |
279 test_profile_ = builder.Build(); | 287 test_profile_ = builder.Build(); |
280 | 288 |
281 fake_oauth2_token_service_ = static_cast<FakeProfileOAuth2TokenService*>( | 289 fake_oauth2_token_service_ = static_cast<FakeProfileOAuth2TokenService*>( |
282 ProfileOAuth2TokenServiceFactory::GetForProfile(test_profile_.get())); | 290 ProfileOAuth2TokenServiceFactory::GetForProfile(test_profile_.get())); |
283 | 291 |
284 fake_signin_manager_ = static_cast<FakeSigninManagerForTesting*>( | 292 fake_signin_manager_ = static_cast<FakeSigninManagerForTesting*>( |
285 SigninManagerFactory::GetForProfile(test_profile_.get())); | 293 SigninManagerFactory::GetForProfile(test_profile_.get())); |
| 294 #if defined(OS_CHROMEOS) |
| 295 // We don't sign the primary user in and out on ChromeOS, so set the |
| 296 // username once in setup. |
286 fake_signin_manager_->SetAuthenticatedUsername(kPrimaryAccountKey); | 297 fake_signin_manager_->SetAuthenticatedUsername(kPrimaryAccountKey); |
| 298 #endif |
287 | 299 |
288 account_tracker_.reset(new AccountTracker(test_profile_.get())); | 300 account_tracker_.reset(new AccountTracker(test_profile_.get())); |
289 account_tracker_->AddObserver(&observer_); | 301 account_tracker_->AddObserver(&observer_); |
| 302 |
| 303 // Start off signed into the primary account, because most tests need the |
| 304 // profile to be signed in. Remove the initial sign-in events that the |
| 305 // tests don't care about. |
| 306 NotifyTokenAvailable(kPrimaryAccountKey); |
| 307 ReturnOAuthUrlFetchSuccess(kPrimaryAccountKey); |
| 308 observer()->Clear(); |
290 } | 309 } |
291 | 310 |
292 virtual void TearDown() OVERRIDE { | 311 virtual void TearDown() OVERRIDE { |
293 account_tracker_->RemoveObserver(&observer_); | 312 account_tracker_->RemoveObserver(&observer_); |
294 account_tracker_->Shutdown(); | 313 account_tracker_->Shutdown(); |
295 } | 314 } |
296 | 315 |
297 Profile* profile() { | 316 Profile* profile() { |
298 return test_profile_.get(); | 317 return test_profile_.get(); |
299 } | 318 } |
(...skipping 27 matching lines...) Expand all Loading... |
327 fake_signin_manager_->OnExternalSigninCompleted(username); | 346 fake_signin_manager_->OnExternalSigninCompleted(username); |
328 #endif | 347 #endif |
329 } | 348 } |
330 | 349 |
331 void NotifyTokenRevoked(const std::string& username) { | 350 void NotifyTokenRevoked(const std::string& username) { |
332 fake_oauth2_token_service_->IssueRefreshTokenForUser(username, | 351 fake_oauth2_token_service_->IssueRefreshTokenForUser(username, |
333 std::string()); | 352 std::string()); |
334 } | 353 } |
335 | 354 |
336 // Helpers to fake access token and user info fetching | 355 // Helpers to fake access token and user info fetching |
337 void IssueAccessToken() { | 356 void IssueAccessToken(const std::string& username) { |
338 fake_oauth2_token_service_->IssueTokenForAllPendingRequests( | 357 fake_oauth2_token_service_->IssueAllTokensForAccount( |
339 "access_token", base::Time::Max()); | 358 username, "access_token-" + username, base::Time::Max()); |
340 } | 359 } |
341 | 360 |
342 std::string GetValidTokenInfoResponse(const std::string email) { | 361 std::string GetValidTokenInfoResponse(const std::string account_key) { |
343 return std::string("{ \"id\": \"") + kFakeGaiaId + "\" }"; | 362 return std::string("{ \"id\": \"") + AccountKeyToObfuscatedId(account_key) + |
| 363 "\" }"; |
344 } | 364 } |
345 | 365 |
346 void ReturnOAuthUrlFetchResults(int fetcher_id, | 366 void ReturnOAuthUrlFetchResults(int fetcher_id, |
347 net::HttpStatusCode response_code, | 367 net::HttpStatusCode response_code, |
348 const std::string& response_string); | 368 const std::string& response_string); |
349 | 369 |
350 void ReturnOAuthUrlFetchSuccess(const std::string& account_key); | 370 void ReturnOAuthUrlFetchSuccess(const std::string& account_key); |
351 void ReturnOAuthUrlFetchFailure(const std::string& account_key); | 371 void ReturnOAuthUrlFetchFailure(const std::string& account_key); |
352 | 372 |
353 private: | 373 private: |
(...skipping 15 matching lines...) Expand all Loading... |
369 net::TestURLFetcher* fetcher = | 389 net::TestURLFetcher* fetcher = |
370 test_fetcher_factory_.GetFetcherByID(fetcher_id); | 390 test_fetcher_factory_.GetFetcherByID(fetcher_id); |
371 ASSERT_TRUE(fetcher); | 391 ASSERT_TRUE(fetcher); |
372 fetcher->set_response_code(response_code); | 392 fetcher->set_response_code(response_code); |
373 fetcher->SetResponseString(response_string); | 393 fetcher->SetResponseString(response_string); |
374 fetcher->delegate()->OnURLFetchComplete(fetcher); | 394 fetcher->delegate()->OnURLFetchComplete(fetcher); |
375 } | 395 } |
376 | 396 |
377 void IdentityAccountTrackerTest::ReturnOAuthUrlFetchSuccess( | 397 void IdentityAccountTrackerTest::ReturnOAuthUrlFetchSuccess( |
378 const std::string& account_key) { | 398 const std::string& account_key) { |
379 IssueAccessToken(); | 399 IssueAccessToken(account_key); |
380 ReturnOAuthUrlFetchResults(gaia::GaiaOAuthClient::kUrlFetcherId, | 400 ReturnOAuthUrlFetchResults(gaia::GaiaOAuthClient::kUrlFetcherId, |
381 net::HTTP_OK, | 401 net::HTTP_OK, |
382 GetValidTokenInfoResponse(account_key)); | 402 GetValidTokenInfoResponse(account_key)); |
383 } | 403 } |
384 | 404 |
385 void IdentityAccountTrackerTest::ReturnOAuthUrlFetchFailure( | 405 void IdentityAccountTrackerTest::ReturnOAuthUrlFetchFailure( |
386 const std::string& account_key) { | 406 const std::string& account_key) { |
387 IssueAccessToken(); | 407 IssueAccessToken(account_key); |
388 ReturnOAuthUrlFetchResults( | 408 ReturnOAuthUrlFetchResults( |
389 gaia::GaiaOAuthClient::kUrlFetcherId, net::HTTP_BAD_REQUEST, ""); | 409 gaia::GaiaOAuthClient::kUrlFetcherId, net::HTTP_BAD_REQUEST, ""); |
390 } | 410 } |
391 | 411 |
392 TEST_F(IdentityAccountTrackerTest, Available) { | 412 TEST_F(IdentityAccountTrackerTest, Available) { |
393 NotifyTokenAvailable("user@example.com"); | 413 NotifyTokenAvailable("user@example.com"); |
394 EXPECT_TRUE(observer()->CheckEvents()); | 414 EXPECT_TRUE(observer()->CheckEvents()); |
395 | 415 |
396 ReturnOAuthUrlFetchSuccess("user@example.com"); | 416 ReturnOAuthUrlFetchSuccess("user@example.com"); |
397 EXPECT_TRUE(observer()->CheckEvents( | 417 EXPECT_TRUE(observer()->CheckEvents( |
398 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), | 418 TrackingEvent(ADDED, "user@example.com"), |
399 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId))); | 419 TrackingEvent(SIGN_IN, "user@example.com"))); |
400 } | 420 } |
401 | 421 |
402 TEST_F(IdentityAccountTrackerTest, Revoke) { | 422 TEST_F(IdentityAccountTrackerTest, Revoke) { |
403 account_tracker()->OnRefreshTokenRevoked("user@example.com"); | 423 account_tracker()->OnRefreshTokenRevoked("user@example.com"); |
404 EXPECT_TRUE(observer()->CheckEvents()); | 424 EXPECT_TRUE(observer()->CheckEvents()); |
405 } | 425 } |
406 | 426 |
407 TEST_F(IdentityAccountTrackerTest, Remove) { | 427 TEST_F(IdentityAccountTrackerTest, Remove) { |
408 NotifyRemoveAccount("user@example.com"); | 428 NotifyRemoveAccount("user@example.com"); |
409 EXPECT_TRUE(observer()->CheckEvents()); | 429 EXPECT_TRUE(observer()->CheckEvents()); |
410 } | 430 } |
411 | 431 |
412 TEST_F(IdentityAccountTrackerTest, AvailableRemoveFetchCancelAvailable) { | 432 TEST_F(IdentityAccountTrackerTest, AvailableRemoveFetchCancelAvailable) { |
413 NotifyTokenAvailable("user@example.com"); | 433 NotifyTokenAvailable("user@example.com"); |
414 NotifyRemoveAccount("user@example.com"); | 434 NotifyRemoveAccount("user@example.com"); |
415 EXPECT_TRUE(observer()->CheckEvents()); | 435 EXPECT_TRUE(observer()->CheckEvents()); |
416 | 436 |
417 NotifyTokenAvailable("user@example.com"); | 437 NotifyTokenAvailable("user@example.com"); |
418 ReturnOAuthUrlFetchSuccess("user@example.com"); | 438 ReturnOAuthUrlFetchSuccess("user@example.com"); |
419 EXPECT_TRUE(observer()->CheckEvents( | 439 EXPECT_TRUE(observer()->CheckEvents( |
420 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), | 440 TrackingEvent(ADDED, "user@example.com"), |
421 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId))); | 441 TrackingEvent(SIGN_IN, "user@example.com"))); |
422 } | 442 } |
423 | 443 |
424 TEST_F(IdentityAccountTrackerTest, AvailableRemoveAvailable) { | 444 TEST_F(IdentityAccountTrackerTest, AvailableRemoveAvailable) { |
425 NotifyTokenAvailable("user@example.com"); | 445 NotifyTokenAvailable("user@example.com"); |
426 ReturnOAuthUrlFetchSuccess("user@example.com"); | 446 ReturnOAuthUrlFetchSuccess("user@example.com"); |
427 NotifyRemoveAccount("user@example.com"); | 447 NotifyRemoveAccount("user@example.com"); |
428 EXPECT_TRUE(observer()->CheckEvents( | 448 EXPECT_TRUE(observer()->CheckEvents( |
429 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), | 449 TrackingEvent(ADDED, "user@example.com"), |
430 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId), | 450 TrackingEvent(SIGN_IN, "user@example.com"), |
431 TrackingEvent(SIGN_OUT, "user@example.com", kFakeGaiaId), | 451 TrackingEvent(SIGN_OUT, "user@example.com"), |
432 TrackingEvent(REMOVED, "user@example.com", kFakeGaiaId))); | 452 TrackingEvent(REMOVED, "user@example.com"))); |
433 | 453 |
434 NotifyTokenAvailable("user@example.com"); | 454 NotifyTokenAvailable("user@example.com"); |
435 ReturnOAuthUrlFetchSuccess("user@example.com"); | 455 ReturnOAuthUrlFetchSuccess("user@example.com"); |
436 EXPECT_TRUE(observer()->CheckEvents( | 456 EXPECT_TRUE(observer()->CheckEvents( |
437 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), | 457 TrackingEvent(ADDED, "user@example.com"), |
438 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId))); | 458 TrackingEvent(SIGN_IN, "user@example.com"))); |
439 } | 459 } |
440 | 460 |
441 TEST_F(IdentityAccountTrackerTest, AvailableRevokeAvailable) { | 461 TEST_F(IdentityAccountTrackerTest, AvailableRevokeAvailable) { |
442 NotifyTokenAvailable("user@example.com"); | 462 NotifyTokenAvailable("user@example.com"); |
443 ReturnOAuthUrlFetchSuccess("user@example.com"); | 463 ReturnOAuthUrlFetchSuccess("user@example.com"); |
444 NotifyTokenRevoked("user@example.com"); | 464 NotifyTokenRevoked("user@example.com"); |
445 EXPECT_TRUE(observer()->CheckEvents( | 465 EXPECT_TRUE(observer()->CheckEvents( |
446 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), | 466 TrackingEvent(ADDED, "user@example.com"), |
447 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId), | 467 TrackingEvent(SIGN_IN, "user@example.com"), |
448 TrackingEvent(SIGN_OUT, "user@example.com", kFakeGaiaId))); | 468 TrackingEvent(SIGN_OUT, "user@example.com"))); |
449 | 469 |
450 NotifyTokenAvailable("user@example.com"); | 470 NotifyTokenAvailable("user@example.com"); |
451 EXPECT_TRUE(observer()->CheckEvents( | 471 EXPECT_TRUE(observer()->CheckEvents( |
452 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId))); | 472 TrackingEvent(SIGN_IN, "user@example.com"))); |
453 } | 473 } |
454 | 474 |
455 TEST_F(IdentityAccountTrackerTest, AvailableRevokeAvailableWithPendingFetch) { | 475 TEST_F(IdentityAccountTrackerTest, AvailableRevokeAvailableWithPendingFetch) { |
456 NotifyTokenAvailable("user@example.com"); | 476 NotifyTokenAvailable("user@example.com"); |
457 NotifyTokenRevoked("user@example.com"); | 477 NotifyTokenRevoked("user@example.com"); |
458 EXPECT_TRUE(observer()->CheckEvents()); | 478 EXPECT_TRUE(observer()->CheckEvents()); |
459 | 479 |
460 NotifyTokenAvailable("user@example.com"); | 480 NotifyTokenAvailable("user@example.com"); |
461 ReturnOAuthUrlFetchSuccess("user@example.com"); | 481 ReturnOAuthUrlFetchSuccess("user@example.com"); |
462 EXPECT_TRUE(observer()->CheckEvents( | 482 EXPECT_TRUE(observer()->CheckEvents( |
463 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), | 483 TrackingEvent(ADDED, "user@example.com"), |
464 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId))); | 484 TrackingEvent(SIGN_IN, "user@example.com"))); |
465 } | 485 } |
466 | 486 |
467 TEST_F(IdentityAccountTrackerTest, AvailableRevokeRemove) { | 487 TEST_F(IdentityAccountTrackerTest, AvailableRevokeRemove) { |
468 NotifyTokenAvailable("user@example.com"); | 488 NotifyTokenAvailable("user@example.com"); |
469 ReturnOAuthUrlFetchSuccess("user@example.com"); | 489 ReturnOAuthUrlFetchSuccess("user@example.com"); |
470 NotifyTokenRevoked("user@example.com"); | 490 NotifyTokenRevoked("user@example.com"); |
471 EXPECT_TRUE(observer()->CheckEvents( | 491 EXPECT_TRUE(observer()->CheckEvents( |
472 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), | 492 TrackingEvent(ADDED, "user@example.com"), |
473 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId), | 493 TrackingEvent(SIGN_IN, "user@example.com"), |
474 TrackingEvent(SIGN_OUT, "user@example.com", kFakeGaiaId))); | 494 TrackingEvent(SIGN_OUT, "user@example.com"))); |
475 | 495 |
476 NotifyRemoveAccount("user@example.com"); | 496 NotifyRemoveAccount("user@example.com"); |
477 EXPECT_TRUE(observer()->CheckEvents( | 497 EXPECT_TRUE(observer()->CheckEvents( |
478 TrackingEvent(REMOVED, "user@example.com", kFakeGaiaId))); | 498 TrackingEvent(REMOVED, "user@example.com"))); |
479 } | 499 } |
480 | 500 |
481 TEST_F(IdentityAccountTrackerTest, AvailableRevokeRevoke) { | 501 TEST_F(IdentityAccountTrackerTest, AvailableRevokeRevoke) { |
482 NotifyTokenAvailable("user@example.com"); | 502 NotifyTokenAvailable("user@example.com"); |
483 ReturnOAuthUrlFetchSuccess("user@example.com"); | 503 ReturnOAuthUrlFetchSuccess("user@example.com"); |
484 NotifyTokenRevoked("user@example.com"); | 504 NotifyTokenRevoked("user@example.com"); |
485 EXPECT_TRUE(observer()->CheckEvents( | 505 EXPECT_TRUE(observer()->CheckEvents( |
486 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), | 506 TrackingEvent(ADDED, "user@example.com"), |
487 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId), | 507 TrackingEvent(SIGN_IN, "user@example.com"), |
488 TrackingEvent(SIGN_OUT, "user@example.com", kFakeGaiaId))); | 508 TrackingEvent(SIGN_OUT, "user@example.com"))); |
489 | 509 |
490 NotifyTokenRevoked("user@example.com"); | 510 NotifyTokenRevoked("user@example.com"); |
491 EXPECT_TRUE(observer()->CheckEvents()); | 511 EXPECT_TRUE(observer()->CheckEvents()); |
492 } | 512 } |
493 | 513 |
494 TEST_F(IdentityAccountTrackerTest, AvailableAvailable) { | 514 TEST_F(IdentityAccountTrackerTest, AvailableAvailable) { |
495 NotifyTokenAvailable("user@example.com"); | 515 NotifyTokenAvailable("user@example.com"); |
496 ReturnOAuthUrlFetchSuccess("user@example.com"); | 516 ReturnOAuthUrlFetchSuccess("user@example.com"); |
497 EXPECT_TRUE(observer()->CheckEvents( | 517 EXPECT_TRUE(observer()->CheckEvents( |
498 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), | 518 TrackingEvent(ADDED, "user@example.com"), |
499 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId))); | 519 TrackingEvent(SIGN_IN, "user@example.com"))); |
500 | 520 |
501 NotifyTokenAvailable("user@example.com"); | 521 NotifyTokenAvailable("user@example.com"); |
502 EXPECT_TRUE(observer()->CheckEvents()); | 522 EXPECT_TRUE(observer()->CheckEvents()); |
503 } | 523 } |
504 | 524 |
505 TEST_F(IdentityAccountTrackerTest, TwoAccounts) { | 525 TEST_F(IdentityAccountTrackerTest, TwoAccounts) { |
506 NotifyTokenAvailable("alpha@example.com"); | 526 NotifyTokenAvailable("alpha@example.com"); |
507 ReturnOAuthUrlFetchSuccess("alpha@example.com"); | 527 ReturnOAuthUrlFetchSuccess("alpha@example.com"); |
508 EXPECT_TRUE(observer()->CheckEvents( | 528 EXPECT_TRUE(observer()->CheckEvents( |
509 TrackingEvent(ADDED, "alpha@example.com", kFakeGaiaId), | 529 TrackingEvent(ADDED, "alpha@example.com"), |
510 TrackingEvent(SIGN_IN, "alpha@example.com", kFakeGaiaId))); | 530 TrackingEvent(SIGN_IN, "alpha@example.com"))); |
511 | 531 |
512 NotifyTokenAvailable("beta@example.com"); | 532 NotifyTokenAvailable("beta@example.com"); |
513 ReturnOAuthUrlFetchSuccess("beta@example.com"); | 533 ReturnOAuthUrlFetchSuccess("beta@example.com"); |
514 EXPECT_TRUE(observer()->CheckEvents( | 534 EXPECT_TRUE(observer()->CheckEvents( |
515 TrackingEvent(ADDED, "beta@example.com", kFakeGaiaId), | 535 TrackingEvent(ADDED, "beta@example.com"), |
516 TrackingEvent(SIGN_IN, "beta@example.com", kFakeGaiaId))); | 536 TrackingEvent(SIGN_IN, "beta@example.com"))); |
517 | 537 |
518 NotifyRemoveAccount("alpha@example.com"); | 538 NotifyRemoveAccount("alpha@example.com"); |
519 EXPECT_TRUE(observer()->CheckEvents( | 539 EXPECT_TRUE(observer()->CheckEvents( |
520 TrackingEvent(SIGN_OUT, "alpha@example.com", kFakeGaiaId), | 540 TrackingEvent(SIGN_OUT, "alpha@example.com"), |
521 TrackingEvent(REMOVED, "alpha@example.com", kFakeGaiaId))); | 541 TrackingEvent(REMOVED, "alpha@example.com"))); |
522 | 542 |
523 NotifyRemoveAccount("beta@example.com"); | 543 NotifyRemoveAccount("beta@example.com"); |
524 EXPECT_TRUE(observer()->CheckEvents( | 544 EXPECT_TRUE(observer()->CheckEvents( |
525 TrackingEvent(SIGN_OUT, "beta@example.com", kFakeGaiaId), | 545 TrackingEvent(SIGN_OUT, "beta@example.com"), |
526 TrackingEvent(REMOVED, "beta@example.com", kFakeGaiaId))); | 546 TrackingEvent(REMOVED, "beta@example.com"))); |
527 } | 547 } |
528 | 548 |
529 TEST_F(IdentityAccountTrackerTest, GlobalErrors) { | 549 TEST_F(IdentityAccountTrackerTest, GlobalErrors) { |
530 NotifyTokenAvailable("alpha@example.com"); | 550 NotifyTokenAvailable("alpha@example.com"); |
531 ReturnOAuthUrlFetchSuccess("alpha@example.com"); | 551 ReturnOAuthUrlFetchSuccess("alpha@example.com"); |
532 EXPECT_TRUE(observer()->CheckEvents( | 552 EXPECT_TRUE(observer()->CheckEvents( |
533 TrackingEvent(ADDED, "alpha@example.com", kFakeGaiaId), | 553 TrackingEvent(ADDED, "alpha@example.com"), |
534 TrackingEvent(SIGN_IN, "alpha@example.com", kFakeGaiaId))); | 554 TrackingEvent(SIGN_IN, "alpha@example.com"))); |
535 NotifyTokenAvailable("beta@example.com"); | 555 NotifyTokenAvailable("beta@example.com"); |
536 ReturnOAuthUrlFetchSuccess("beta@example.com"); | 556 ReturnOAuthUrlFetchSuccess("beta@example.com"); |
537 EXPECT_TRUE(observer()->CheckEvents( | 557 EXPECT_TRUE(observer()->CheckEvents( |
538 TrackingEvent(ADDED, "beta@example.com", kFakeGaiaId), | 558 TrackingEvent(ADDED, "beta@example.com"), |
539 TrackingEvent(SIGN_IN, "beta@example.com", kFakeGaiaId))); | 559 TrackingEvent(SIGN_IN, "beta@example.com"))); |
540 | 560 |
541 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), | 561 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), |
542 account_tracker()->GetAuthStatus()); | 562 account_tracker()->GetAuthStatus()); |
543 | 563 |
544 account_tracker()->ReportAuthError( | 564 account_tracker()->ReportAuthError( |
545 "beta@example.com", | 565 "beta@example.com", |
546 GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED)); | 566 GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED)); |
547 EXPECT_TRUE(observer()->CheckEvents( | 567 EXPECT_TRUE(observer()->CheckEvents( |
548 TrackingEvent(SIGN_OUT, "beta@example.com", kFakeGaiaId))); | 568 TrackingEvent(SIGN_OUT, "beta@example.com"))); |
549 EXPECT_EQ(GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), | 569 EXPECT_EQ(GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), |
550 account_tracker()->GetAuthStatus()); | 570 account_tracker()->GetAuthStatus()); |
551 | 571 |
552 account_tracker()->ReportAuthError( | 572 account_tracker()->ReportAuthError( |
553 "alpha@example.com", | 573 "alpha@example.com", |
554 GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED)); | 574 GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED)); |
555 EXPECT_TRUE(observer()->CheckEvents( | 575 EXPECT_TRUE(observer()->CheckEvents( |
556 TrackingEvent(SIGN_OUT, "alpha@example.com", kFakeGaiaId))); | 576 TrackingEvent(SIGN_OUT, "alpha@example.com"))); |
557 EXPECT_EQ(GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), | 577 EXPECT_EQ(GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), |
558 account_tracker()->GetAuthStatus()); | 578 account_tracker()->GetAuthStatus()); |
559 | 579 |
560 NotifyRemoveAccount("alpha@example.com"); | 580 NotifyRemoveAccount("alpha@example.com"); |
561 EXPECT_EQ(GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), | 581 EXPECT_EQ(GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), |
562 account_tracker()->GetAuthStatus()); | 582 account_tracker()->GetAuthStatus()); |
563 | 583 |
564 NotifyTokenAvailable("beta@example.com"); | 584 NotifyTokenAvailable("beta@example.com"); |
565 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), | 585 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), |
566 account_tracker()->GetAuthStatus()); | 586 account_tracker()->GetAuthStatus()); |
567 } | 587 } |
568 | 588 |
569 TEST_F(IdentityAccountTrackerTest, AvailableTokenFetchFailAvailable) { | 589 TEST_F(IdentityAccountTrackerTest, AvailableTokenFetchFailAvailable) { |
570 NotifyTokenAvailable("alpha@example.com"); | 590 NotifyTokenAvailable("alpha@example.com"); |
571 ReturnOAuthUrlFetchFailure("alpha@example.com"); | 591 ReturnOAuthUrlFetchFailure("alpha@example.com"); |
572 EXPECT_TRUE(observer()->CheckEvents()); | 592 EXPECT_TRUE(observer()->CheckEvents()); |
573 | 593 |
574 NotifyTokenAvailable("user@example.com"); | 594 NotifyTokenAvailable("user@example.com"); |
575 ReturnOAuthUrlFetchSuccess("user@example.com"); | 595 ReturnOAuthUrlFetchSuccess("user@example.com"); |
576 EXPECT_TRUE(observer()->CheckEvents( | 596 EXPECT_TRUE(observer()->CheckEvents( |
577 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), | 597 TrackingEvent(ADDED, "user@example.com"), |
578 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId))); | 598 TrackingEvent(SIGN_IN, "user@example.com"))); |
579 } | 599 } |
580 | 600 |
581 // The Chrome OS fake sign-in manager doesn't do sign-in or sign-out. | 601 // The Chrome OS fake sign-in manager doesn't do sign-in or sign-out. |
582 #if !defined(OS_CHROMEOS) | 602 #if !defined(OS_CHROMEOS) |
583 | 603 |
584 TEST_F(IdentityAccountTrackerTest, PrimarySignOutSignIn) { | 604 TEST_F(IdentityAccountTrackerTest, PrimarySignOutSignIn) { |
585 // Initial sign-in wasn't tracked due to test set-up, so there are no events. | |
586 NotifyRemoveAccount(kPrimaryAccountKey); | 605 NotifyRemoveAccount(kPrimaryAccountKey); |
587 EXPECT_TRUE(observer()->CheckEvents()); | 606 EXPECT_TRUE(observer()->CheckEvents( |
| 607 TrackingEvent(SIGN_OUT, kPrimaryAccountKey), |
| 608 TrackingEvent(REMOVED, kPrimaryAccountKey))); |
588 | 609 |
589 NotifyTokenAvailable(kPrimaryAccountKey); | 610 NotifyTokenAvailable(kPrimaryAccountKey); |
590 ReturnOAuthUrlFetchSuccess(kPrimaryAccountKey); | 611 ReturnOAuthUrlFetchSuccess(kPrimaryAccountKey); |
591 EXPECT_TRUE(observer()->CheckEvents( | 612 EXPECT_TRUE(observer()->CheckEvents( |
592 TrackingEvent(ADDED, kPrimaryAccountKey, kFakeGaiaId), | 613 TrackingEvent(ADDED, kPrimaryAccountKey), |
593 TrackingEvent(SIGN_IN, kPrimaryAccountKey, kFakeGaiaId))); | 614 TrackingEvent(SIGN_IN, kPrimaryAccountKey))); |
594 | |
595 NotifyRemoveAccount(kPrimaryAccountKey); | |
596 EXPECT_TRUE(observer()->CheckEvents( | |
597 TrackingEvent(SIGN_OUT, kPrimaryAccountKey, kFakeGaiaId), | |
598 TrackingEvent(REMOVED, kPrimaryAccountKey, kFakeGaiaId))); | |
599 } | 615 } |
600 | 616 |
601 TEST_F(IdentityAccountTrackerTest, PrimarySignOutSignInTwoAccounts) { | 617 TEST_F(IdentityAccountTrackerTest, PrimarySignOutSignInTwoAccounts) { |
602 NotifyTokenAvailable("alpha@example.com"); | 618 NotifyTokenAvailable("alpha@example.com"); |
603 ReturnOAuthUrlFetchSuccess("alpha@example.com"); | 619 ReturnOAuthUrlFetchSuccess("alpha@example.com"); |
604 NotifyTokenAvailable("beta@example.com"); | 620 NotifyTokenAvailable("beta@example.com"); |
605 ReturnOAuthUrlFetchSuccess("beta@example.com"); | 621 ReturnOAuthUrlFetchSuccess("beta@example.com"); |
606 | 622 |
607 observer()->SortEventsByUser(); | 623 observer()->SortEventsByUser(); |
608 EXPECT_TRUE(observer()->CheckEvents( | 624 EXPECT_TRUE(observer()->CheckEvents( |
609 TrackingEvent(ADDED, "alpha@example.com", kFakeGaiaId), | 625 TrackingEvent(ADDED, "alpha@example.com"), |
610 TrackingEvent(SIGN_IN, "alpha@example.com", kFakeGaiaId), | 626 TrackingEvent(SIGN_IN, "alpha@example.com"), |
611 TrackingEvent(ADDED, "beta@example.com", kFakeGaiaId), | 627 TrackingEvent(ADDED, "beta@example.com"), |
612 TrackingEvent(SIGN_IN, "beta@example.com", kFakeGaiaId))); | 628 TrackingEvent(SIGN_IN, "beta@example.com"))); |
613 | 629 |
614 // Initial sign-in wasn't tracked due to test set-up, so there are no events | |
615 // for that account yet. | |
616 NotifyRemoveAccount(kPrimaryAccountKey); | 630 NotifyRemoveAccount(kPrimaryAccountKey); |
617 observer()->SortEventsByUser(); | 631 observer()->SortEventsByUser(); |
618 EXPECT_TRUE(observer()->CheckEvents( | 632 EXPECT_TRUE(observer()->CheckEvents( |
619 TrackingEvent(SIGN_OUT, "alpha@example.com", kFakeGaiaId), | 633 TrackingEvent(SIGN_OUT, "alpha@example.com"), |
620 TrackingEvent(REMOVED, "alpha@example.com", kFakeGaiaId), | 634 TrackingEvent(REMOVED, "alpha@example.com"), |
621 TrackingEvent(SIGN_OUT, "beta@example.com", kFakeGaiaId), | 635 TrackingEvent(SIGN_OUT, "beta@example.com"), |
622 TrackingEvent(REMOVED, "beta@example.com", kFakeGaiaId))); | 636 TrackingEvent(REMOVED, "beta@example.com"), |
| 637 TrackingEvent(SIGN_OUT, kPrimaryAccountKey), |
| 638 TrackingEvent(REMOVED, kPrimaryAccountKey))); |
623 | 639 |
624 // No events fire at all while profile is signed out. | 640 // No events fire at all while profile is signed out. |
625 NotifyTokenRevoked("alpha@example.com"); | 641 NotifyTokenRevoked("alpha@example.com"); |
626 NotifyTokenAvailable("gamma@example.com"); | 642 NotifyTokenAvailable("gamma@example.com"); |
627 EXPECT_TRUE(observer()->CheckEvents()); | 643 EXPECT_TRUE(observer()->CheckEvents()); |
628 | 644 |
629 // Signing the profile in again will resume tracking all accounts. | 645 // Signing the profile in again will resume tracking all accounts. |
630 NotifyTokenAvailable(kPrimaryAccountKey); | 646 NotifyTokenAvailable(kPrimaryAccountKey); |
631 ReturnOAuthUrlFetchSuccess("beta@example.com"); | 647 ReturnOAuthUrlFetchSuccess("beta@example.com"); |
632 ReturnOAuthUrlFetchSuccess("gamma@example.com"); | 648 ReturnOAuthUrlFetchSuccess("gamma@example.com"); |
633 ReturnOAuthUrlFetchSuccess(kPrimaryAccountKey); | 649 ReturnOAuthUrlFetchSuccess(kPrimaryAccountKey); |
634 observer()->SortEventsByUser(); | 650 observer()->SortEventsByUser(); |
635 EXPECT_TRUE(observer()->CheckEvents( | 651 EXPECT_TRUE(observer()->CheckEvents( |
636 TrackingEvent(ADDED, "beta@example.com", kFakeGaiaId), | 652 TrackingEvent(ADDED, "beta@example.com"), |
637 TrackingEvent(SIGN_IN, "beta@example.com", kFakeGaiaId), | 653 TrackingEvent(SIGN_IN, "beta@example.com"), |
638 TrackingEvent(ADDED, "gamma@example.com", kFakeGaiaId), | 654 TrackingEvent(ADDED, "gamma@example.com"), |
639 TrackingEvent(SIGN_IN, "gamma@example.com", kFakeGaiaId), | 655 TrackingEvent(SIGN_IN, "gamma@example.com"), |
640 TrackingEvent(ADDED, kPrimaryAccountKey, kFakeGaiaId), | 656 TrackingEvent(ADDED, kPrimaryAccountKey), |
641 TrackingEvent(SIGN_IN, kPrimaryAccountKey, kFakeGaiaId))); | 657 TrackingEvent(SIGN_IN, kPrimaryAccountKey))); |
642 | 658 |
643 // Revoking the primary token does not affect other accounts. | 659 // Revoking the primary token does not affect other accounts. |
644 NotifyTokenRevoked(kPrimaryAccountKey); | 660 NotifyTokenRevoked(kPrimaryAccountKey); |
645 EXPECT_TRUE(observer()->CheckEvents( | 661 EXPECT_TRUE(observer()->CheckEvents( |
646 TrackingEvent(SIGN_OUT, kPrimaryAccountKey, kFakeGaiaId))); | 662 TrackingEvent(SIGN_OUT, kPrimaryAccountKey))); |
647 | 663 |
648 NotifyTokenAvailable(kPrimaryAccountKey); | 664 NotifyTokenAvailable(kPrimaryAccountKey); |
649 EXPECT_TRUE(observer()->CheckEvents( | 665 EXPECT_TRUE(observer()->CheckEvents( |
650 TrackingEvent(SIGN_IN, kPrimaryAccountKey, kFakeGaiaId))); | 666 TrackingEvent(SIGN_IN, kPrimaryAccountKey))); |
651 } | 667 } |
652 | 668 |
653 #endif // !defined(OS_CHROMEOS) | 669 #endif // !defined(OS_CHROMEOS) |
654 | 670 |
| 671 TEST_F(IdentityAccountTrackerTest, GetAccountsPrimary) { |
| 672 std::vector<AccountIds> ids = account_tracker()->GetAccounts(); |
| 673 EXPECT_EQ(1ul, ids.size()); |
| 674 EXPECT_EQ(kPrimaryAccountKey, ids[0].account_key); |
| 675 EXPECT_EQ(AccountKeyToObfuscatedId(kPrimaryAccountKey), ids[0].gaia); |
| 676 } |
| 677 |
| 678 TEST_F(IdentityAccountTrackerTest, GetAccountsSignedOut) { |
| 679 NotifyTokenRevoked(kPrimaryAccountKey); |
| 680 |
| 681 std::vector<AccountIds> ids = account_tracker()->GetAccounts(); |
| 682 EXPECT_EQ(0ul, ids.size()); |
| 683 } |
| 684 |
| 685 TEST_F(IdentityAccountTrackerTest, GetAccountsOnlyReturnAccountsWithTokens) { |
| 686 NotifyTokenAvailable("alpha@example.com"); |
| 687 NotifyTokenAvailable("beta@example.com"); |
| 688 ReturnOAuthUrlFetchSuccess("beta@example.com"); |
| 689 |
| 690 std::vector<AccountIds> ids = account_tracker()->GetAccounts(); |
| 691 EXPECT_EQ(2ul, ids.size()); |
| 692 EXPECT_EQ(kPrimaryAccountKey, ids[0].account_key); |
| 693 EXPECT_EQ(AccountKeyToObfuscatedId(kPrimaryAccountKey), ids[0].gaia); |
| 694 EXPECT_EQ("beta@example.com", ids[1].account_key); |
| 695 EXPECT_EQ(AccountKeyToObfuscatedId("beta@example.com"), ids[1].gaia); |
| 696 } |
| 697 |
| 698 TEST_F(IdentityAccountTrackerTest, GetAccountsSortOrder) { |
| 699 NotifyTokenAvailable("zeta@example.com"); |
| 700 ReturnOAuthUrlFetchSuccess("zeta@example.com"); |
| 701 NotifyTokenAvailable("alpha@example.com"); |
| 702 ReturnOAuthUrlFetchSuccess("alpha@example.com"); |
| 703 |
| 704 // The primary account will be first in the vector. Remaining accounts |
| 705 // will be sorted by gaia ID. |
| 706 std::vector<AccountIds> ids = account_tracker()->GetAccounts(); |
| 707 EXPECT_EQ(3ul, ids.size()); |
| 708 EXPECT_EQ(kPrimaryAccountKey, ids[0].account_key); |
| 709 EXPECT_EQ(AccountKeyToObfuscatedId(kPrimaryAccountKey), ids[0].gaia); |
| 710 EXPECT_EQ("alpha@example.com", ids[1].account_key); |
| 711 EXPECT_EQ(AccountKeyToObfuscatedId("alpha@example.com"), ids[1].gaia); |
| 712 EXPECT_EQ("zeta@example.com", ids[2].account_key); |
| 713 EXPECT_EQ(AccountKeyToObfuscatedId("zeta@example.com"), ids[2].gaia); |
| 714 } |
| 715 |
| 716 TEST_F(IdentityAccountTrackerTest, |
| 717 GetAccountsReturnNothingWhenPrimarySignedOut) { |
| 718 NotifyTokenAvailable("zeta@example.com"); |
| 719 ReturnOAuthUrlFetchSuccess("zeta@example.com"); |
| 720 NotifyTokenAvailable("alpha@example.com"); |
| 721 ReturnOAuthUrlFetchSuccess("alpha@example.com"); |
| 722 |
| 723 NotifyTokenRevoked(kPrimaryAccountKey); |
| 724 |
| 725 std::vector<AccountIds> ids = account_tracker()->GetAccounts(); |
| 726 EXPECT_EQ(0ul, ids.size()); |
| 727 } |
| 728 |
655 } // namespace extensions | 729 } // namespace extensions |
OLD | NEW |