| 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 "base/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/extensions/api/identity/experimental_identity_api.h" | 8 #include "chrome/browser/extensions/api/identity/experimental_identity_api.h" |
| 9 #include "chrome/browser/extensions/api/identity/identity_api.h" | 9 #include "chrome/browser/extensions/api/identity/identity_api.h" |
| 10 #include "chrome/browser/extensions/api/identity/web_auth_flow.h" | 10 #include "chrome/browser/extensions/api/identity/web_auth_flow.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); | 312 EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); |
| 313 EXPECT_FALSE(func->login_ui_shown()); | 313 EXPECT_FALSE(func->login_ui_shown()); |
| 314 EXPECT_FALSE(func->install_ui_shown()); | 314 EXPECT_FALSE(func->install_ui_shown()); |
| 315 } | 315 } |
| 316 | 316 |
| 317 IN_PROC_BROWSER_TEST_F(ExperimentalGetAuthTokenFunctionTest, | 317 IN_PROC_BROWSER_TEST_F(ExperimentalGetAuthTokenFunctionTest, |
| 318 NonInteractiveMintAdviceSuccess) { | 318 NonInteractiveMintAdviceSuccess) { |
| 319 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES)); | 319 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES)); |
| 320 scoped_refptr<ExperimentalMockGetAuthTokenFunction> func( | 320 scoped_refptr<ExperimentalMockGetAuthTokenFunction> func( |
| 321 new ExperimentalMockGetAuthTokenFunction()); | 321 new ExperimentalMockGetAuthTokenFunction()); |
| 322 func->set_extension(extension); | 322 func->set_extension(extension.get()); |
| 323 EXPECT_CALL(*func.get(), HasLoginToken()).WillOnce(Return(true)); | 323 EXPECT_CALL(*func.get(), HasLoginToken()).WillOnce(Return(true)); |
| 324 TestOAuth2MintTokenFlow* flow = new TestOAuth2MintTokenFlow( | 324 TestOAuth2MintTokenFlow* flow = new TestOAuth2MintTokenFlow( |
| 325 TestOAuth2MintTokenFlow::ISSUE_ADVICE_SUCCESS, func.get()); | 325 TestOAuth2MintTokenFlow::ISSUE_ADVICE_SUCCESS, func.get()); |
| 326 EXPECT_CALL(*func.get(), CreateMintTokenFlow(_)).WillOnce(Return(flow)); | 326 EXPECT_CALL(*func.get(), CreateMintTokenFlow(_)).WillOnce(Return(flow)); |
| 327 std::string error = | 327 std::string error = |
| 328 utils::RunFunctionAndReturnError(func.get(), "[{}]", browser()); | 328 utils::RunFunctionAndReturnError(func.get(), "[{}]", browser()); |
| 329 EXPECT_EQ(std::string(errors::kNoGrant), error); | 329 EXPECT_EQ(std::string(errors::kNoGrant), error); |
| 330 EXPECT_FALSE(func->login_ui_shown()); | 330 EXPECT_FALSE(func->login_ui_shown()); |
| 331 EXPECT_FALSE(func->install_ui_shown()); | 331 EXPECT_FALSE(func->install_ui_shown()); |
| 332 | 332 |
| 333 const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(extension); | 333 const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(extension.get()); |
| 334 EXPECT_EQ( | 334 EXPECT_EQ( |
| 335 IdentityTokenCacheValue::CACHE_STATUS_NOTFOUND, | 335 IdentityTokenCacheValue::CACHE_STATUS_NOTFOUND, |
| 336 id_api()->GetCachedToken(extension->id(), oauth2_info.scopes).status()); | 336 id_api()->GetCachedToken(extension->id(), oauth2_info.scopes).status()); |
| 337 } | 337 } |
| 338 | 338 |
| 339 IN_PROC_BROWSER_TEST_F(ExperimentalGetAuthTokenFunctionTest, | 339 IN_PROC_BROWSER_TEST_F(ExperimentalGetAuthTokenFunctionTest, |
| 340 NonInteractiveMintBadCredentials) { | 340 NonInteractiveMintBadCredentials) { |
| 341 scoped_refptr<ExperimentalMockGetAuthTokenFunction> func( | 341 scoped_refptr<ExperimentalMockGetAuthTokenFunction> func( |
| 342 new ExperimentalMockGetAuthTokenFunction()); | 342 new ExperimentalMockGetAuthTokenFunction()); |
| 343 func->set_extension(CreateExtension(CLIENT_ID | SCOPES)); | 343 func->set_extension(CreateExtension(CLIENT_ID | SCOPES)); |
| 344 EXPECT_CALL(*func.get(), HasLoginToken()).WillOnce(Return(true)); | 344 EXPECT_CALL(*func.get(), HasLoginToken()).WillOnce(Return(true)); |
| 345 TestOAuth2MintTokenFlow* flow = new TestOAuth2MintTokenFlow( | 345 TestOAuth2MintTokenFlow* flow = new TestOAuth2MintTokenFlow( |
| 346 TestOAuth2MintTokenFlow::MINT_TOKEN_BAD_CREDENTIALS, func.get()); | 346 TestOAuth2MintTokenFlow::MINT_TOKEN_BAD_CREDENTIALS, func.get()); |
| 347 EXPECT_CALL(*func.get(), CreateMintTokenFlow(_)).WillOnce(Return(flow)); | 347 EXPECT_CALL(*func.get(), CreateMintTokenFlow(_)).WillOnce(Return(flow)); |
| 348 std::string error = | 348 std::string error = |
| 349 utils::RunFunctionAndReturnError(func.get(), "[{}]", browser()); | 349 utils::RunFunctionAndReturnError(func.get(), "[{}]", browser()); |
| 350 EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); | 350 EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); |
| 351 EXPECT_FALSE(func->login_ui_shown()); | 351 EXPECT_FALSE(func->login_ui_shown()); |
| 352 EXPECT_FALSE(func->install_ui_shown()); | 352 EXPECT_FALSE(func->install_ui_shown()); |
| 353 } | 353 } |
| 354 | 354 |
| 355 IN_PROC_BROWSER_TEST_F(ExperimentalGetAuthTokenFunctionTest, | 355 IN_PROC_BROWSER_TEST_F(ExperimentalGetAuthTokenFunctionTest, |
| 356 NonInteractiveSuccess) { | 356 NonInteractiveSuccess) { |
| 357 scoped_refptr<ExperimentalMockGetAuthTokenFunction> func( | 357 scoped_refptr<ExperimentalMockGetAuthTokenFunction> func( |
| 358 new ExperimentalMockGetAuthTokenFunction()); | 358 new ExperimentalMockGetAuthTokenFunction()); |
| 359 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES)); | 359 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES)); |
| 360 func->set_extension(extension); | 360 func->set_extension(extension.get()); |
| 361 const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(extension); | 361 const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(extension.get()); |
| 362 EXPECT_CALL(*func.get(), HasLoginToken()).WillOnce(Return(true)); | 362 EXPECT_CALL(*func.get(), HasLoginToken()).WillOnce(Return(true)); |
| 363 TestOAuth2MintTokenFlow* flow = new TestOAuth2MintTokenFlow( | 363 TestOAuth2MintTokenFlow* flow = new TestOAuth2MintTokenFlow( |
| 364 TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS, func.get()); | 364 TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS, func.get()); |
| 365 EXPECT_CALL(*func.get(), CreateMintTokenFlow(_)).WillOnce(Return(flow)); | 365 EXPECT_CALL(*func.get(), CreateMintTokenFlow(_)).WillOnce(Return(flow)); |
| 366 scoped_ptr<base::Value> value( | 366 scoped_ptr<base::Value> value( |
| 367 utils::RunFunctionAndReturnSingleResult(func.get(), "[{}]", browser())); | 367 utils::RunFunctionAndReturnSingleResult(func.get(), "[{}]", browser())); |
| 368 std::string access_token; | 368 std::string access_token; |
| 369 EXPECT_TRUE(value->GetAsString(&access_token)); | 369 EXPECT_TRUE(value->GetAsString(&access_token)); |
| 370 EXPECT_EQ(std::string(kAccessToken), access_token); | 370 EXPECT_EQ(std::string(kAccessToken), access_token); |
| 371 EXPECT_FALSE(func->login_ui_shown()); | 371 EXPECT_FALSE(func->login_ui_shown()); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); | 494 EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); |
| 495 EXPECT_TRUE(func->login_ui_shown()); | 495 EXPECT_TRUE(func->login_ui_shown()); |
| 496 EXPECT_TRUE(func->install_ui_shown()); | 496 EXPECT_TRUE(func->install_ui_shown()); |
| 497 } | 497 } |
| 498 | 498 |
| 499 IN_PROC_BROWSER_TEST_F(ExperimentalGetAuthTokenFunctionTest, | 499 IN_PROC_BROWSER_TEST_F(ExperimentalGetAuthTokenFunctionTest, |
| 500 InteractiveLoginSuccessApprovalDoneMintSuccess) { | 500 InteractiveLoginSuccessApprovalDoneMintSuccess) { |
| 501 scoped_refptr<ExperimentalMockGetAuthTokenFunction> func( | 501 scoped_refptr<ExperimentalMockGetAuthTokenFunction> func( |
| 502 new ExperimentalMockGetAuthTokenFunction()); | 502 new ExperimentalMockGetAuthTokenFunction()); |
| 503 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES)); | 503 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES)); |
| 504 func->set_extension(extension); | 504 func->set_extension(extension.get()); |
| 505 const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(extension); | 505 const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(extension.get()); |
| 506 EXPECT_CALL(*func.get(), HasLoginToken()).WillOnce(Return(false)); | 506 EXPECT_CALL(*func.get(), HasLoginToken()).WillOnce(Return(false)); |
| 507 func->set_login_ui_result(true); | 507 func->set_login_ui_result(true); |
| 508 TestOAuth2MintTokenFlow* flow1 = new TestOAuth2MintTokenFlow( | 508 TestOAuth2MintTokenFlow* flow1 = new TestOAuth2MintTokenFlow( |
| 509 TestOAuth2MintTokenFlow::ISSUE_ADVICE_SUCCESS, func.get()); | 509 TestOAuth2MintTokenFlow::ISSUE_ADVICE_SUCCESS, func.get()); |
| 510 TestOAuth2MintTokenFlow* flow2 = new TestOAuth2MintTokenFlow( | 510 TestOAuth2MintTokenFlow* flow2 = new TestOAuth2MintTokenFlow( |
| 511 TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS, func.get()); | 511 TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS, func.get()); |
| 512 EXPECT_CALL(*func.get(), CreateMintTokenFlow(_)).WillOnce(Return(flow1)) | 512 EXPECT_CALL(*func.get(), CreateMintTokenFlow(_)).WillOnce(Return(flow1)) |
| 513 .WillOnce(Return(flow2)); | 513 .WillOnce(Return(flow2)); |
| 514 | 514 |
| 515 func->set_install_ui_result(true); | 515 func->set_install_ui_result(true); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 content::NotificationService::AllSources()); | 599 content::NotificationService::AllSources()); |
| 600 | 600 |
| 601 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( | 601 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( |
| 602 new ExperimentalIdentityLaunchWebAuthFlowFunction()); | 602 new ExperimentalIdentityLaunchWebAuthFlowFunction()); |
| 603 | 603 |
| 604 std::string args = base::StringPrintf( | 604 std::string args = base::StringPrintf( |
| 605 "[{\"interactive\": true, \"url\": \"data:text/html,auth\"%s%s}]", | 605 "[{\"interactive\": true, \"url\": \"data:text/html,auth\"%s%s}]", |
| 606 extra_params.length() ? "," : "", | 606 extra_params.length() ? "," : "", |
| 607 extra_params.c_str()); | 607 extra_params.c_str()); |
| 608 | 608 |
| 609 RunFunctionAsync(function, args); | 609 RunFunctionAsync(function.get(), args); |
| 610 | 610 |
| 611 observer.Wait(); | 611 observer.Wait(); |
| 612 | 612 |
| 613 Browser* web_auth_flow_browser = | 613 Browser* web_auth_flow_browser = |
| 614 content::Source<Browser>(observer.source()).ptr(); | 614 content::Source<Browser>(observer.source()).ptr(); |
| 615 EXPECT_EQ(expected_x, web_auth_flow_browser->override_bounds().x()); | 615 EXPECT_EQ(expected_x, web_auth_flow_browser->override_bounds().x()); |
| 616 EXPECT_EQ(expected_y, web_auth_flow_browser->override_bounds().y()); | 616 EXPECT_EQ(expected_y, web_auth_flow_browser->override_bounds().y()); |
| 617 EXPECT_EQ(expected_width, web_auth_flow_browser->override_bounds().width()); | 617 EXPECT_EQ(expected_width, web_auth_flow_browser->override_bounds().width()); |
| 618 EXPECT_EQ(expected_height, | 618 EXPECT_EQ(expected_height, |
| 619 web_auth_flow_browser->override_bounds().height()); | 619 web_auth_flow_browser->override_bounds().height()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 637 IN_PROC_BROWSER_TEST_F(ExperimentalLaunchWebAuthFlowFunctionTest, | 637 IN_PROC_BROWSER_TEST_F(ExperimentalLaunchWebAuthFlowFunctionTest, |
| 638 UserCloseWindow) { | 638 UserCloseWindow) { |
| 639 content::WindowedNotificationObserver observer( | 639 content::WindowedNotificationObserver observer( |
| 640 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 640 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 641 content::NotificationService::AllSources()); | 641 content::NotificationService::AllSources()); |
| 642 | 642 |
| 643 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( | 643 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( |
| 644 new ExperimentalIdentityLaunchWebAuthFlowFunction()); | 644 new ExperimentalIdentityLaunchWebAuthFlowFunction()); |
| 645 | 645 |
| 646 RunFunctionAsync( | 646 RunFunctionAsync( |
| 647 function, "[{\"interactive\": true, \"url\": \"data:text/html,auth\"}]"); | 647 function.get(), |
| 648 "[{\"interactive\": true, \"url\": \"data:text/html,auth\"}]"); |
| 648 | 649 |
| 649 observer.Wait(); | 650 observer.Wait(); |
| 650 Browser* web_auth_flow_browser = | 651 Browser* web_auth_flow_browser = |
| 651 content::Source<Browser>(observer.source()).ptr(); | 652 content::Source<Browser>(observer.source()).ptr(); |
| 652 web_auth_flow_browser->window()->Close(); | 653 web_auth_flow_browser->window()->Close(); |
| 653 | 654 |
| 654 EXPECT_EQ(std::string(errors::kUserRejected), WaitForError(function)); | 655 EXPECT_EQ(std::string(errors::kUserRejected), WaitForError(function.get())); |
| 655 } | 656 } |
| 656 | 657 |
| 657 IN_PROC_BROWSER_TEST_F(ExperimentalLaunchWebAuthFlowFunctionTest, | 658 IN_PROC_BROWSER_TEST_F(ExperimentalLaunchWebAuthFlowFunctionTest, |
| 658 InteractionRequired) { | 659 InteractionRequired) { |
| 659 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( | 660 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( |
| 660 new ExperimentalIdentityLaunchWebAuthFlowFunction()); | 661 new ExperimentalIdentityLaunchWebAuthFlowFunction()); |
| 661 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); | 662 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); |
| 662 function->set_extension(empty_extension.get()); | 663 function->set_extension(empty_extension.get()); |
| 663 | 664 |
| 664 std::string error = utils::RunFunctionAndReturnError( | 665 std::string error = utils::RunFunctionAndReturnError( |
| 665 function, | 666 function.get(), |
| 666 "[{\"interactive\": false, \"url\": \"data:text/html,auth\"}]", | 667 "[{\"interactive\": false, \"url\": \"data:text/html,auth\"}]", |
| 667 browser()); | 668 browser()); |
| 668 | 669 |
| 669 EXPECT_EQ(std::string(errors::kInteractionRequired), error); | 670 EXPECT_EQ(std::string(errors::kInteractionRequired), error); |
| 670 } | 671 } |
| 671 | 672 |
| 672 IN_PROC_BROWSER_TEST_F(ExperimentalLaunchWebAuthFlowFunctionTest, | 673 IN_PROC_BROWSER_TEST_F(ExperimentalLaunchWebAuthFlowFunctionTest, |
| 673 NonInteractiveSuccess) { | 674 NonInteractiveSuccess) { |
| 674 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( | 675 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( |
| 675 new ExperimentalIdentityLaunchWebAuthFlowFunction()); | 676 new ExperimentalIdentityLaunchWebAuthFlowFunction()); |
| 676 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); | 677 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); |
| 677 function->set_extension(empty_extension.get()); | 678 function->set_extension(empty_extension.get()); |
| 678 | 679 |
| 679 function->InitFinalRedirectURLPrefixesForTest("abcdefghij"); | 680 function->InitFinalRedirectURLPrefixesForTest("abcdefghij"); |
| 680 scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult( | 681 scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult( |
| 681 function, | 682 function.get(), |
| 682 "[{\"interactive\": false," | 683 "[{\"interactive\": false," |
| 683 "\"url\": \"https://abcdefghij.chromiumapp.org/callback#test\"}]", | 684 "\"url\": \"https://abcdefghij.chromiumapp.org/callback#test\"}]", |
| 684 browser())); | 685 browser())); |
| 685 | 686 |
| 686 std::string url; | 687 std::string url; |
| 687 EXPECT_TRUE(value->GetAsString(&url)); | 688 EXPECT_TRUE(value->GetAsString(&url)); |
| 688 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 689 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
| 689 url); | 690 url); |
| 690 } | 691 } |
| 691 | 692 |
| 692 IN_PROC_BROWSER_TEST_F(ExperimentalLaunchWebAuthFlowFunctionTest, | 693 IN_PROC_BROWSER_TEST_F(ExperimentalLaunchWebAuthFlowFunctionTest, |
| 693 InteractiveFirstNavigationSuccess) { | 694 InteractiveFirstNavigationSuccess) { |
| 694 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( | 695 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( |
| 695 new ExperimentalIdentityLaunchWebAuthFlowFunction()); | 696 new ExperimentalIdentityLaunchWebAuthFlowFunction()); |
| 696 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); | 697 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); |
| 697 function->set_extension(empty_extension.get()); | 698 function->set_extension(empty_extension.get()); |
| 698 | 699 |
| 699 function->InitFinalRedirectURLPrefixesForTest("abcdefghij"); | 700 function->InitFinalRedirectURLPrefixesForTest("abcdefghij"); |
| 700 scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult( | 701 scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult( |
| 701 function, | 702 function.get(), |
| 702 "[{\"interactive\": true," | 703 "[{\"interactive\": true," |
| 703 "\"url\": \"https://abcdefghij.chromiumapp.org/callback#test\"}]", | 704 "\"url\": \"https://abcdefghij.chromiumapp.org/callback#test\"}]", |
| 704 browser())); | 705 browser())); |
| 705 | 706 |
| 706 std::string url; | 707 std::string url; |
| 707 EXPECT_TRUE(value->GetAsString(&url)); | 708 EXPECT_TRUE(value->GetAsString(&url)); |
| 708 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 709 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
| 709 url); | 710 url); |
| 710 } | 711 } |
| 711 | 712 |
| 712 IN_PROC_BROWSER_TEST_F(ExperimentalLaunchWebAuthFlowFunctionTest, | 713 IN_PROC_BROWSER_TEST_F(ExperimentalLaunchWebAuthFlowFunctionTest, |
| 713 InteractiveSecondNavigationSuccess) { | 714 InteractiveSecondNavigationSuccess) { |
| 714 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( | 715 scoped_refptr<ExperimentalIdentityLaunchWebAuthFlowFunction> function( |
| 715 new ExperimentalIdentityLaunchWebAuthFlowFunction()); | 716 new ExperimentalIdentityLaunchWebAuthFlowFunction()); |
| 716 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); | 717 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); |
| 717 function->set_extension(empty_extension.get()); | 718 function->set_extension(empty_extension.get()); |
| 718 | 719 |
| 719 function->InitFinalRedirectURLPrefixesForTest("abcdefghij"); | 720 function->InitFinalRedirectURLPrefixesForTest("abcdefghij"); |
| 720 scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult( | 721 scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult( |
| 721 function, | 722 function.get(), |
| 722 "[{\"interactive\": true," | 723 "[{\"interactive\": true," |
| 723 "\"url\": \"data:text/html,<script>window.location.replace('" | 724 "\"url\": \"data:text/html,<script>window.location.replace('" |
| 724 "https://abcdefghij.chromiumapp.org/callback#test')</script>\"}]", | 725 "https://abcdefghij.chromiumapp.org/callback#test')</script>\"}]", |
| 725 browser())); | 726 browser())); |
| 726 | 727 |
| 727 std::string url; | 728 std::string url; |
| 728 EXPECT_TRUE(value->GetAsString(&url)); | 729 EXPECT_TRUE(value->GetAsString(&url)); |
| 729 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 730 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
| 730 url); | 731 url); |
| 731 } | 732 } |
| 732 | 733 |
| 733 } // namespace extensions | 734 } // namespace extensions |
| OLD | NEW |