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

Side by Side Diff: chrome/browser/apps/web_view_browsertest.cc

Issue 22793018: <webview>: Implement support for package-local chrome-extension:// URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a test to verify that a privileged partition can access a local resource Created 7 years, 2 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 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 "apps/native_app_window.h" 5 #include "apps/native_app_window.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/apps/app_browsertest_util.h" 8 #include "chrome/browser/apps/app_browsertest_util.h"
9 #include "chrome/browser/automation/automation_util.h" 9 #include "chrome/browser/automation/automation_util.h"
10 #include "chrome/browser/extensions/extension_test_message_listener.h" 10 #include "chrome/browser/extensions/extension_test_message_listener.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 474
475 return scoped_ptr<net::test_server::HttpResponse>(); 475 return scoped_ptr<net::test_server::HttpResponse>();
476 } 476 }
477 477
478 void TestHelper(const std::string& test_name, 478 void TestHelper(const std::string& test_name,
479 const std::string& test_passed_msg, 479 const std::string& test_passed_msg,
480 const std::string& test_failed_msg, 480 const std::string& test_failed_msg,
481 const std::string& app_location) { 481 const std::string& app_location) {
482 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. 482 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
483 ExtensionTestMessageListener launched_listener("Launched", false); 483 ExtensionTestMessageListener launched_listener("Launched", false);
484 LoadAndLaunchPlatformApp(app_location.c_str()); 484 const extensions::Extension* extension =
485 InstallAndLaunchPlatformApp(app_location.c_str());
485 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); 486 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
486 487
487 embedded_test_server()->RegisterRequestHandler( 488 embedded_test_server()->RegisterRequestHandler(
488 base::Bind(&WebViewTest::RedirectResponseHandler, 489 base::Bind(&WebViewTest::RedirectResponseHandler,
489 kRedirectResponsePath, 490 kRedirectResponsePath,
490 embedded_test_server()->GetURL(kRedirectResponseFullPath))); 491 embedded_test_server()->GetURL(kRedirectResponseFullPath)));
491 492
492 embedded_test_server()->RegisterRequestHandler( 493 embedded_test_server()->RegisterRequestHandler(
493 base::Bind(&WebViewTest::EmptyResponseHandler, kEmptyResponsePath)); 494 base::Bind(&WebViewTest::EmptyResponseHandler, kEmptyResponsePath));
494 495
495 content::WebContents* embedder_web_contents = 496 content::WebContents* embedder_web_contents =
496 GetFirstShellWindowWebContents(); 497 GetFirstShellWindowWebContents();
497 ASSERT_TRUE(embedder_web_contents); 498 ASSERT_TRUE(embedder_web_contents);
498 499
499 ExtensionTestMessageListener done_listener(test_passed_msg, false); 500 ExtensionTestMessageListener done_listener(test_passed_msg, false);
500 done_listener.AlsoListenForFailureMessage(test_failed_msg); 501 done_listener.AlsoListenForFailureMessage(test_failed_msg);
501 EXPECT_TRUE(content::ExecuteScript( 502 EXPECT_TRUE(content::ExecuteScript(
502 embedder_web_contents, 503 embedder_web_contents,
503 base::StringPrintf("runTest('%s')", test_name.c_str()))); 504 base::StringPrintf("runTest('%s', '%s')",
505 test_name.c_str(),
506 extension->id().c_str())));
504 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); 507 ASSERT_TRUE(done_listener.WaitUntilSatisfied());
505 } 508 }
506 509
507 content::WebContents* LoadGuest(const std::string& guest_path, 510 content::WebContents* LoadGuest(const std::string& guest_path,
508 const std::string& app_path) { 511 const std::string& app_path) {
509 GURL::Replacements replace_host; 512 GURL::Replacements replace_host;
510 std::string host_str("localhost"); // Must stay in scope with replace_host. 513 std::string host_str("localhost"); // Must stay in scope with replace_host.
511 replace_host.SetHostStr(host_str); 514 replace_host.SetHostStr(host_str);
512 515
513 GURL guest_url = embedded_test_server()->GetURL(guest_path); 516 GURL guest_url = embedded_test_server()->GetURL(guest_path);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 666
664 // Tests the existence of WebRequest API event objects on the request 667 // Tests the existence of WebRequest API event objects on the request
665 // object, on the webview element, and hanging directly off webview. 668 // object, on the webview element, and hanging directly off webview.
666 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIExistence) { 669 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIExistence) {
667 TestHelper("testWebRequestAPIExistence", 670 TestHelper("testWebRequestAPIExistence",
668 "DoneShimTest.PASSED", 671 "DoneShimTest.PASSED",
669 "DoneShimTest.FAILED", 672 "DoneShimTest.FAILED",
670 "web_view/shim"); 673 "web_view/shim");
671 } 674 }
672 675
676 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestChromeExtensionURL) {
677 TestHelper("testChromeExtensionURL",
678 "DoneShimTest.PASSED",
679 "DoneShimTest.FAILED",
680 "web_view/shim");
681 }
682
673 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestEventName) { 683 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestEventName) {
674 TestHelper("testEventName", 684 TestHelper("testEventName",
675 "DoneShimTest.PASSED", 685 "DoneShimTest.PASSED",
676 "DoneShimTest.FAILED", 686 "DoneShimTest.FAILED",
677 "web_view/shim"); 687 "web_view/shim");
678 } 688 }
679 689
680 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestOnEventProperty) { 690 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestOnEventProperty) {
681 TestHelper("testOnEventProperties", 691 TestHelper("testOnEventProperties",
682 "DoneShimTest.PASSED", 692 "DoneShimTest.PASSED",
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 "web_view/shim"); 863 "web_view/shim");
854 } 864 }
855 865
856 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadStartLoadRedirect) { 866 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadStartLoadRedirect) {
857 TestHelper("testLoadStartLoadRedirect", 867 TestHelper("testLoadStartLoadRedirect",
858 "DoneShimTest.PASSED", 868 "DoneShimTest.PASSED",
859 "DoneShimTest.FAILED", 869 "DoneShimTest.FAILED",
860 "web_view/shim"); 870 "web_view/shim");
861 } 871 }
862 872
873 IN_PROC_BROWSER_TEST_F(WebViewTest,
874 Shim_TestLoadAbortChromeExtensionURLWrongPartition) {
875 TestHelper("testLoadAbortChromeExtensionURLWrongPartition",
876 "DoneShimTest.PASSED",
877 "DoneShimTest.FAILED",
878 "web_view/shim");
879 }
880
863 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortEmptyResponse) { 881 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortEmptyResponse) {
864 TestHelper("testLoadAbortEmptyResponse", 882 TestHelper("testLoadAbortEmptyResponse",
865 "DoneShimTest.PASSED", 883 "DoneShimTest.PASSED",
866 "DoneShimTest.FAILED", 884 "DoneShimTest.FAILED",
867 "web_view/shim"); 885 "web_view/shim");
868 } 886 }
869 887
870 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortIllegalChromeURL) { 888 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortIllegalChromeURL) {
871 TestHelper("testLoadAbortIllegalChromeURL", 889 TestHelper("testLoadAbortIllegalChromeURL",
872 "DoneShimTest.PASSED", 890 "DoneShimTest.PASSED",
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1776 "DoneDialogTest.FAILED", 1794 "DoneDialogTest.FAILED",
1777 "web_view/dialog"); 1795 "web_view/dialog");
1778 } 1796 }
1779 1797
1780 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) { 1798 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) {
1781 TestHelper("testPromptDialog", 1799 TestHelper("testPromptDialog",
1782 "DoneDialogTest.PASSED", 1800 "DoneDialogTest.PASSED",
1783 "DoneDialogTest.FAILED", 1801 "DoneDialogTest.FAILED",
1784 "web_view/dialog"); 1802 "web_view/dialog");
1785 } 1803 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_protocols.cc » ('j') | chrome/browser/extensions/extension_protocols.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698