OLD | NEW |
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 <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 bool HasResponse() { | 79 bool HasResponse() { |
80 return response_.get() != NULL; | 80 return response_.get() != NULL; |
81 } | 81 } |
82 | 82 |
83 bool GetResponse() { | 83 bool GetResponse() { |
84 EXPECT_TRUE(HasResponse()); | 84 EXPECT_TRUE(HasResponse()); |
85 return *response_.get(); | 85 return *response_.get(); |
86 } | 86 } |
87 | 87 |
88 virtual void OnSendResponse(UIThreadExtensionFunction* function, | 88 void OnSendResponse(UIThreadExtensionFunction* function, |
89 bool success, | 89 bool success, |
90 bool bad_message) override { | 90 bool bad_message) override { |
91 ASSERT_FALSE(bad_message); | 91 ASSERT_FALSE(bad_message); |
92 ASSERT_FALSE(HasResponse()); | 92 ASSERT_FALSE(HasResponse()); |
93 response_.reset(new bool); | 93 response_.reset(new bool); |
94 *response_ = success; | 94 *response_ = success; |
95 if (should_post_quit_) { | 95 if (should_post_quit_) { |
96 base::MessageLoopForUI::current()->Quit(); | 96 base::MessageLoopForUI::current()->Quit(); |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 private: | 100 private: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 | 158 |
159 scoped_ptr<SendResponseDelegate> response_delegate_; | 159 scoped_ptr<SendResponseDelegate> response_delegate_; |
160 }; | 160 }; |
161 | 161 |
162 class TestHangOAuth2MintTokenFlow : public OAuth2MintTokenFlow { | 162 class TestHangOAuth2MintTokenFlow : public OAuth2MintTokenFlow { |
163 public: | 163 public: |
164 TestHangOAuth2MintTokenFlow() | 164 TestHangOAuth2MintTokenFlow() |
165 : OAuth2MintTokenFlow(NULL, OAuth2MintTokenFlow::Parameters()) {} | 165 : OAuth2MintTokenFlow(NULL, OAuth2MintTokenFlow::Parameters()) {} |
166 | 166 |
167 virtual void Start(net::URLRequestContextGetter* context, | 167 void Start(net::URLRequestContextGetter* context, |
168 const std::string& access_token) override { | 168 const std::string& access_token) override { |
169 // Do nothing, simulating a hanging network call. | 169 // Do nothing, simulating a hanging network call. |
170 } | 170 } |
171 }; | 171 }; |
172 | 172 |
173 class TestOAuth2MintTokenFlow : public OAuth2MintTokenFlow { | 173 class TestOAuth2MintTokenFlow : public OAuth2MintTokenFlow { |
174 public: | 174 public: |
175 enum ResultType { | 175 enum ResultType { |
176 ISSUE_ADVICE_SUCCESS, | 176 ISSUE_ADVICE_SUCCESS, |
177 MINT_TOKEN_SUCCESS, | 177 MINT_TOKEN_SUCCESS, |
178 MINT_TOKEN_FAILURE, | 178 MINT_TOKEN_FAILURE, |
179 MINT_TOKEN_BAD_CREDENTIALS, | 179 MINT_TOKEN_BAD_CREDENTIALS, |
180 MINT_TOKEN_SERVICE_ERROR | 180 MINT_TOKEN_SERVICE_ERROR |
181 }; | 181 }; |
182 | 182 |
183 TestOAuth2MintTokenFlow(ResultType result, | 183 TestOAuth2MintTokenFlow(ResultType result, |
184 OAuth2MintTokenFlow::Delegate* delegate) | 184 OAuth2MintTokenFlow::Delegate* delegate) |
185 : OAuth2MintTokenFlow(delegate, OAuth2MintTokenFlow::Parameters()), | 185 : OAuth2MintTokenFlow(delegate, OAuth2MintTokenFlow::Parameters()), |
186 result_(result), | 186 result_(result), |
187 delegate_(delegate) {} | 187 delegate_(delegate) {} |
188 | 188 |
189 virtual void Start(net::URLRequestContextGetter* context, | 189 void Start(net::URLRequestContextGetter* context, |
190 const std::string& access_token) override { | 190 const std::string& access_token) override { |
191 switch (result_) { | 191 switch (result_) { |
192 case ISSUE_ADVICE_SUCCESS: { | 192 case ISSUE_ADVICE_SUCCESS: { |
193 IssueAdviceInfo info; | 193 IssueAdviceInfo info; |
194 delegate_->OnIssueAdviceSuccess(info); | 194 delegate_->OnIssueAdviceSuccess(info); |
195 break; | 195 break; |
196 } | 196 } |
197 case MINT_TOKEN_SUCCESS: { | 197 case MINT_TOKEN_SUCCESS: { |
198 delegate_->OnMintTokenSuccess(kAccessToken, 3600); | 198 delegate_->OnMintTokenSuccess(kAccessToken, 3600); |
199 break; | 199 break; |
200 } | 200 } |
(...skipping 27 matching lines...) Expand all Loading... |
228 // closed. | 228 // closed. |
229 class WaitForGURLAndCloseWindow : public content::WindowedNotificationObserver { | 229 class WaitForGURLAndCloseWindow : public content::WindowedNotificationObserver { |
230 public: | 230 public: |
231 explicit WaitForGURLAndCloseWindow(GURL url) | 231 explicit WaitForGURLAndCloseWindow(GURL url) |
232 : WindowedNotificationObserver( | 232 : WindowedNotificationObserver( |
233 content::NOTIFICATION_LOAD_STOP, | 233 content::NOTIFICATION_LOAD_STOP, |
234 content::NotificationService::AllSources()), | 234 content::NotificationService::AllSources()), |
235 url_(url) {} | 235 url_(url) {} |
236 | 236 |
237 // NotificationObserver: | 237 // NotificationObserver: |
238 virtual void Observe(int type, | 238 void Observe(int type, |
239 const content::NotificationSource& source, | 239 const content::NotificationSource& source, |
240 const content::NotificationDetails& details) override { | 240 const content::NotificationDetails& details) override { |
241 content::NavigationController* web_auth_flow_controller = | 241 content::NavigationController* web_auth_flow_controller = |
242 content::Source<content::NavigationController>(source).ptr(); | 242 content::Source<content::NavigationController>(source).ptr(); |
243 content::WebContents* web_contents = | 243 content::WebContents* web_contents = |
244 web_auth_flow_controller->GetWebContents(); | 244 web_auth_flow_controller->GetWebContents(); |
245 | 245 |
246 if (web_contents->GetURL() == url_) { | 246 if (web_contents->GetURL() == url_) { |
247 // It is safe to keep the pointer here, because we know in a test, that | 247 // It is safe to keep the pointer here, because we know in a test, that |
248 // the WebContents won't go away before CloseEmbedderWebContents is | 248 // the WebContents won't go away before CloseEmbedderWebContents is |
249 // called. Don't copy this code to production. | 249 // called. Don't copy this code to production. |
250 GuestViewBase* guest = GuestViewBase::FromWebContents(web_contents); | 250 GuestViewBase* guest = GuestViewBase::FromWebContents(web_contents); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 scope_ui_failure_ = GaiaWebAuthFlow::OAUTH_ERROR; | 309 scope_ui_failure_ = GaiaWebAuthFlow::OAUTH_ERROR; |
310 scope_ui_oauth_error_ = oauth_error; | 310 scope_ui_oauth_error_ = oauth_error; |
311 } | 311 } |
312 | 312 |
313 bool login_ui_shown() const { return login_ui_shown_; } | 313 bool login_ui_shown() const { return login_ui_shown_; } |
314 | 314 |
315 bool scope_ui_shown() const { return scope_ui_shown_; } | 315 bool scope_ui_shown() const { return scope_ui_shown_; } |
316 | 316 |
317 std::string login_access_token() const { return login_access_token_; } | 317 std::string login_access_token() const { return login_access_token_; } |
318 | 318 |
319 virtual void StartLoginAccessTokenRequest() override { | 319 void StartLoginAccessTokenRequest() override { |
320 if (auto_login_access_token_) { | 320 if (auto_login_access_token_) { |
321 if (login_access_token_result_) { | 321 if (login_access_token_result_) { |
322 OnGetTokenSuccess(login_token_request_.get(), | 322 OnGetTokenSuccess(login_token_request_.get(), |
323 "access_token", | 323 "access_token", |
324 base::Time::Now() + base::TimeDelta::FromHours(1LL)); | 324 base::Time::Now() + base::TimeDelta::FromHours(1LL)); |
325 } else { | 325 } else { |
326 GoogleServiceAuthError error( | 326 GoogleServiceAuthError error( |
327 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); | 327 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
328 OnGetTokenFailure(login_token_request_.get(), error); | 328 OnGetTokenFailure(login_token_request_.get(), error); |
329 } | 329 } |
330 } else { | 330 } else { |
331 // Make a request to the token service. The test now must tell | 331 // Make a request to the token service. The test now must tell |
332 // the token service to issue an access token (or an error). | 332 // the token service to issue an access token (or an error). |
333 IdentityGetAuthTokenFunction::StartLoginAccessTokenRequest(); | 333 IdentityGetAuthTokenFunction::StartLoginAccessTokenRequest(); |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 virtual void ShowLoginPopup() override { | 337 void ShowLoginPopup() override { |
338 EXPECT_FALSE(login_ui_shown_); | 338 EXPECT_FALSE(login_ui_shown_); |
339 login_ui_shown_ = true; | 339 login_ui_shown_ = true; |
340 if (login_ui_result_) | 340 if (login_ui_result_) |
341 SigninSuccess(); | 341 SigninSuccess(); |
342 else | 342 else |
343 SigninFailed(); | 343 SigninFailed(); |
344 } | 344 } |
345 | 345 |
346 virtual void ShowOAuthApprovalDialog( | 346 void ShowOAuthApprovalDialog(const IssueAdviceInfo& issue_advice) override { |
347 const IssueAdviceInfo& issue_advice) override { | |
348 scope_ui_shown_ = true; | 347 scope_ui_shown_ = true; |
349 | 348 |
350 if (scope_ui_result_) { | 349 if (scope_ui_result_) { |
351 OnGaiaFlowCompleted(kAccessToken, "3600"); | 350 OnGaiaFlowCompleted(kAccessToken, "3600"); |
352 } else if (scope_ui_failure_ == GaiaWebAuthFlow::SERVICE_AUTH_ERROR) { | 351 } else if (scope_ui_failure_ == GaiaWebAuthFlow::SERVICE_AUTH_ERROR) { |
353 GoogleServiceAuthError error(GoogleServiceAuthError::CONNECTION_FAILED); | 352 GoogleServiceAuthError error(GoogleServiceAuthError::CONNECTION_FAILED); |
354 OnGaiaFlowFailure(scope_ui_failure_, error, ""); | 353 OnGaiaFlowFailure(scope_ui_failure_, error, ""); |
355 } else { | 354 } else { |
356 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); | 355 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); |
357 OnGaiaFlowFailure(scope_ui_failure_, error, scope_ui_oauth_error_); | 356 OnGaiaFlowFailure(scope_ui_failure_, error, scope_ui_oauth_error_); |
358 } | 357 } |
359 } | 358 } |
360 | 359 |
361 virtual void StartGaiaRequest( | 360 void StartGaiaRequest(const std::string& login_access_token) override { |
362 const std::string& login_access_token) override { | |
363 EXPECT_TRUE(login_access_token_.empty()); | 361 EXPECT_TRUE(login_access_token_.empty()); |
364 // Save the login token used in the mint token flow so tests can see | 362 // Save the login token used in the mint token flow so tests can see |
365 // what account was used. | 363 // what account was used. |
366 login_access_token_ = login_access_token; | 364 login_access_token_ = login_access_token; |
367 IdentityGetAuthTokenFunction::StartGaiaRequest(login_access_token); | 365 IdentityGetAuthTokenFunction::StartGaiaRequest(login_access_token); |
368 } | 366 } |
369 | 367 |
370 virtual OAuth2MintTokenFlow* CreateMintTokenFlow() override { | 368 OAuth2MintTokenFlow* CreateMintTokenFlow() override { |
371 return flow_.release(); | 369 return flow_.release(); |
372 } | 370 } |
373 | 371 |
374 private: | 372 private: |
375 virtual ~FakeGetAuthTokenFunction() {} | 373 ~FakeGetAuthTokenFunction() override {} |
376 bool login_access_token_result_; | 374 bool login_access_token_result_; |
377 bool auto_login_access_token_; | 375 bool auto_login_access_token_; |
378 bool login_ui_result_; | 376 bool login_ui_result_; |
379 bool scope_ui_result_; | 377 bool scope_ui_result_; |
380 GaiaWebAuthFlow::Failure scope_ui_failure_; | 378 GaiaWebAuthFlow::Failure scope_ui_failure_; |
381 std::string scope_ui_oauth_error_; | 379 std::string scope_ui_oauth_error_; |
382 bool login_ui_shown_; | 380 bool login_ui_shown_; |
383 bool scope_ui_shown_; | 381 bool scope_ui_shown_; |
384 | 382 |
385 scoped_ptr<OAuth2MintTokenFlow> flow_; | 383 scoped_ptr<OAuth2MintTokenFlow> flow_; |
386 | 384 |
387 std::string login_access_token_; | 385 std::string login_access_token_; |
388 }; | 386 }; |
389 | 387 |
390 class MockQueuedMintRequest : public IdentityMintRequestQueue::Request { | 388 class MockQueuedMintRequest : public IdentityMintRequestQueue::Request { |
391 public: | 389 public: |
392 MOCK_METHOD1(StartMintToken, void(IdentityMintRequestQueue::MintType)); | 390 MOCK_METHOD1(StartMintToken, void(IdentityMintRequestQueue::MintType)); |
393 }; | 391 }; |
394 | 392 |
395 gaia::AccountIds CreateIds(std::string email, std::string obfid) { | 393 gaia::AccountIds CreateIds(std::string email, std::string obfid) { |
396 gaia::AccountIds ids; | 394 gaia::AccountIds ids; |
397 ids.account_key = email; | 395 ids.account_key = email; |
398 ids.email = email; | 396 ids.email = email; |
399 ids.gaia = obfid; | 397 ids.gaia = obfid; |
400 return ids; | 398 return ids; |
401 } | 399 } |
402 | 400 |
403 class IdentityGetAccountsFunctionTest : public ExtensionBrowserTest { | 401 class IdentityGetAccountsFunctionTest : public ExtensionBrowserTest { |
404 virtual void SetUpCommandLine(CommandLine* command_line) override { | 402 void SetUpCommandLine(CommandLine* command_line) override { |
405 ExtensionBrowserTest::SetUpCommandLine(command_line); | 403 ExtensionBrowserTest::SetUpCommandLine(command_line); |
406 command_line->AppendSwitch(switches::kExtensionsMultiAccount); | 404 command_line->AppendSwitch(switches::kExtensionsMultiAccount); |
407 } | 405 } |
408 | 406 |
409 protected: | 407 protected: |
410 void SetAccountState(gaia::AccountIds ids, bool is_signed_in) { | 408 void SetAccountState(gaia::AccountIds ids, bool is_signed_in) { |
411 IdentityAPI::GetFactoryInstance()->Get(profile())->SetAccountStateForTest( | 409 IdentityAPI::GetFactoryInstance()->Get(profile())->SetAccountStateForTest( |
412 ids, is_signed_in); | 410 ids, is_signed_in); |
413 } | 411 } |
414 | 412 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 SetAccountState(CreateIds("primary@example.com", "1"), true); | 504 SetAccountState(CreateIds("primary@example.com", "1"), true); |
507 SetAccountState(CreateIds("secondary@example.com", "2"), true); | 505 SetAccountState(CreateIds("secondary@example.com", "2"), true); |
508 std::vector<std::string> two_accounts; | 506 std::vector<std::string> two_accounts; |
509 two_accounts.push_back("1"); | 507 two_accounts.push_back("1"); |
510 two_accounts.push_back("2"); | 508 two_accounts.push_back("2"); |
511 EXPECT_TRUE(ExpectGetAccounts(two_accounts)); | 509 EXPECT_TRUE(ExpectGetAccounts(two_accounts)); |
512 } | 510 } |
513 | 511 |
514 class IdentityOldProfilesGetAccountsFunctionTest | 512 class IdentityOldProfilesGetAccountsFunctionTest |
515 : public IdentityGetAccountsFunctionTest { | 513 : public IdentityGetAccountsFunctionTest { |
516 virtual void SetUpCommandLine(CommandLine* command_line) override { | 514 void SetUpCommandLine(CommandLine* command_line) override { |
517 // Don't add the multi-account switch that parent class would have. | 515 // Don't add the multi-account switch that parent class would have. |
518 } | 516 } |
519 }; | 517 }; |
520 | 518 |
521 IN_PROC_BROWSER_TEST_F(IdentityOldProfilesGetAccountsFunctionTest, | 519 IN_PROC_BROWSER_TEST_F(IdentityOldProfilesGetAccountsFunctionTest, |
522 MultiAccountOff) { | 520 MultiAccountOff) { |
523 EXPECT_FALSE(switches::IsExtensionsMultiAccount()); | 521 EXPECT_FALSE(switches::IsExtensionsMultiAccount()); |
524 } | 522 } |
525 | 523 |
526 IN_PROC_BROWSER_TEST_F(IdentityOldProfilesGetAccountsFunctionTest, | 524 IN_PROC_BROWSER_TEST_F(IdentityOldProfilesGetAccountsFunctionTest, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUserAccountId, | 593 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUserAccountId, |
596 "12345"); | 594 "12345"); |
597 | 595 |
598 scoped_ptr<api::identity::ProfileUserInfo> info = RunGetProfileUserInfo(); | 596 scoped_ptr<api::identity::ProfileUserInfo> info = RunGetProfileUserInfo(); |
599 EXPECT_TRUE(info->email.empty()); | 597 EXPECT_TRUE(info->email.empty()); |
600 EXPECT_EQ("12345", info->id); | 598 EXPECT_EQ("12345", info->id); |
601 } | 599 } |
602 | 600 |
603 class GetAuthTokenFunctionTest : public AsyncExtensionBrowserTest { | 601 class GetAuthTokenFunctionTest : public AsyncExtensionBrowserTest { |
604 public: | 602 public: |
605 virtual void SetUpCommandLine(CommandLine* command_line) override { | 603 void SetUpCommandLine(CommandLine* command_line) override { |
606 AsyncExtensionBrowserTest::SetUpCommandLine(command_line); | 604 AsyncExtensionBrowserTest::SetUpCommandLine(command_line); |
607 command_line->AppendSwitch(switches::kExtensionsMultiAccount); | 605 command_line->AppendSwitch(switches::kExtensionsMultiAccount); |
608 } | 606 } |
609 | 607 |
610 virtual void SetUpInProcessBrowserTestFixture() override { | 608 void SetUpInProcessBrowserTestFixture() override { |
611 AsyncExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); | 609 AsyncExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); |
612 | 610 |
613 will_create_browser_context_services_subscription_ = | 611 will_create_browser_context_services_subscription_ = |
614 BrowserContextDependencyManager::GetInstance() | 612 BrowserContextDependencyManager::GetInstance() |
615 ->RegisterWillCreateBrowserContextServicesCallbackForTesting( | 613 ->RegisterWillCreateBrowserContextServicesCallbackForTesting( |
616 base::Bind(&GetAuthTokenFunctionTest:: | 614 base::Bind(&GetAuthTokenFunctionTest:: |
617 OnWillCreateBrowserContextServices, | 615 OnWillCreateBrowserContextServices, |
618 base::Unretained(this))) | 616 base::Unretained(this))) |
619 .Pass(); | 617 .Pass(); |
620 } | 618 } |
621 | 619 |
622 void OnWillCreateBrowserContextServices(content::BrowserContext* context) { | 620 void OnWillCreateBrowserContextServices(content::BrowserContext* context) { |
623 // Replace the signin manager and token service with fakes. Do this ahead of | 621 // Replace the signin manager and token service with fakes. Do this ahead of |
624 // creating the browser so that a bunch of classes don't register as | 622 // creating the browser so that a bunch of classes don't register as |
625 // observers and end up needing to unregister when the fake is substituted. | 623 // observers and end up needing to unregister when the fake is substituted. |
626 SigninManagerFactory::GetInstance()->SetTestingFactory( | 624 SigninManagerFactory::GetInstance()->SetTestingFactory( |
627 context, &FakeSigninManagerBase::Build); | 625 context, &FakeSigninManagerBase::Build); |
628 ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory( | 626 ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory( |
629 context, &BuildFakeProfileOAuth2TokenService); | 627 context, &BuildFakeProfileOAuth2TokenService); |
630 AccountReconcilorFactory::GetInstance()->SetTestingFactory( | 628 AccountReconcilorFactory::GetInstance()->SetTestingFactory( |
631 context, &FakeAccountReconcilor::Build); | 629 context, &FakeAccountReconcilor::Build); |
632 } | 630 } |
633 | 631 |
634 virtual void SetUpOnMainThread() override { | 632 void SetUpOnMainThread() override { |
635 AsyncExtensionBrowserTest::SetUpOnMainThread(); | 633 AsyncExtensionBrowserTest::SetUpOnMainThread(); |
636 | 634 |
637 // Grab references to the fake signin manager and token service. | 635 // Grab references to the fake signin manager and token service. |
638 signin_manager_ = static_cast<FakeSigninManagerForTesting*>( | 636 signin_manager_ = static_cast<FakeSigninManagerForTesting*>( |
639 SigninManagerFactory::GetInstance()->GetForProfile(profile())); | 637 SigninManagerFactory::GetInstance()->GetForProfile(profile())); |
640 ASSERT_TRUE(signin_manager_); | 638 ASSERT_TRUE(signin_manager_); |
641 token_service_ = static_cast<FakeProfileOAuth2TokenService*>( | 639 token_service_ = static_cast<FakeProfileOAuth2TokenService*>( |
642 ProfileOAuth2TokenServiceFactory::GetInstance()->GetForProfile( | 640 ProfileOAuth2TokenServiceFactory::GetInstance()->GetForProfile( |
643 profile())); | 641 profile())); |
644 ASSERT_TRUE(token_service_); | 642 ASSERT_TRUE(token_service_); |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 SetCachedToken(token); | 1650 SetCachedToken(token); |
1653 EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_TOKEN, | 1651 EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_TOKEN, |
1654 GetCachedToken().status()); | 1652 GetCachedToken().status()); |
1655 EXPECT_TRUE(InvalidateDefaultToken()); | 1653 EXPECT_TRUE(InvalidateDefaultToken()); |
1656 EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_NOTFOUND, | 1654 EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_NOTFOUND, |
1657 GetCachedToken().status()); | 1655 GetCachedToken().status()); |
1658 } | 1656 } |
1659 | 1657 |
1660 class LaunchWebAuthFlowFunctionTest : public AsyncExtensionBrowserTest { | 1658 class LaunchWebAuthFlowFunctionTest : public AsyncExtensionBrowserTest { |
1661 public: | 1659 public: |
1662 virtual void SetUpCommandLine(CommandLine* command_line) override { | 1660 void SetUpCommandLine(CommandLine* command_line) override { |
1663 AsyncExtensionBrowserTest::SetUpCommandLine(command_line); | 1661 AsyncExtensionBrowserTest::SetUpCommandLine(command_line); |
1664 // Reduce performance test variance by disabling background networking. | 1662 // Reduce performance test variance by disabling background networking. |
1665 command_line->AppendSwitch(switches::kDisableBackgroundNetworking); | 1663 command_line->AppendSwitch(switches::kDisableBackgroundNetworking); |
1666 } | 1664 } |
1667 }; | 1665 }; |
1668 | 1666 |
1669 IN_PROC_BROWSER_TEST_F(LaunchWebAuthFlowFunctionTest, UserCloseWindow) { | 1667 IN_PROC_BROWSER_TEST_F(LaunchWebAuthFlowFunctionTest, UserCloseWindow) { |
1670 net::SpawnedTestServer https_server( | 1668 net::SpawnedTestServer https_server( |
1671 net::SpawnedTestServer::TYPE_HTTPS, | 1669 net::SpawnedTestServer::TYPE_HTTPS, |
1672 net::SpawnedTestServer::kLocalhost, | 1670 net::SpawnedTestServer::kLocalhost, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1813 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 1811 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
1814 url); | 1812 url); |
1815 } | 1813 } |
1816 | 1814 |
1817 } // namespace extensions | 1815 } // namespace extensions |
1818 | 1816 |
1819 // Tests the chrome.identity API implemented by custom JS bindings . | 1817 // Tests the chrome.identity API implemented by custom JS bindings . |
1820 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { | 1818 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { |
1821 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; | 1819 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; |
1822 } | 1820 } |
OLD | NEW |