| 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/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/automation/automation_util.h" | 7 #include "chrome/browser/automation/automation_util.h" |
| 8 #include "chrome/browser/extensions/extension_test_message_listener.h" | 8 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 9 #include "chrome/browser/extensions/platform_app_browsertest_util.h" | 9 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
| 10 #include "chrome/browser/prerender/prerender_link_manager.h" | 10 #include "chrome/browser/prerender/prerender_link_manager.h" |
| 11 #include "chrome/browser/prerender/prerender_link_manager_factory.h" | 11 #include "chrome/browser/prerender/prerender_link_manager_factory.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 16 #include "chrome/test/base/test_launcher_utils.h" | 16 #include "chrome/test/base/test_launcher_utils.h" |
| 17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
| 18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 19 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
| 20 #include "content/public/browser/web_contents_delegate.h" | 20 #include "content/public/browser/web_contents_delegate.h" |
| 21 #include "content/public/test/browser_test_utils.h" | 21 #include "content/public/test/browser_test_utils.h" |
| 22 #include "content/public/test/fake_speech_recognition_manager.h" | 22 #include "content/public/test/fake_speech_recognition_manager.h" |
| 23 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 23 #include "ui/compositor/compositor_setup.h" | 24 #include "ui/compositor/compositor_setup.h" |
| 24 #include "ui/gl/gl_switches.h" | 25 #include "ui/gl/gl_switches.h" |
| 25 | 26 |
| 26 using prerender::PrerenderLinkManager; | 27 using prerender::PrerenderLinkManager; |
| 27 using prerender::PrerenderLinkManagerFactory; | 28 using prerender::PrerenderLinkManagerFactory; |
| 28 | 29 |
| 29 // This class intercepts media access request from the embedder. The request | 30 // This class intercepts media access request from the embedder. The request |
| 30 // should be triggered only if the embedder API (from tests) allows the request | 31 // should be triggered only if the embedder API (from tests) allows the request |
| 31 // in Javascript. | 32 // in Javascript. |
| 32 // We do not issue the actual media request; the fact that the request reached | 33 // We do not issue the actual media request; the fact that the request reached |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 content::WebContents** named_partition_contents2, | 198 content::WebContents** named_partition_contents2, |
| 198 content::WebContents** persistent_partition_contents1, | 199 content::WebContents** persistent_partition_contents1, |
| 199 content::WebContents** persistent_partition_contents2, | 200 content::WebContents** persistent_partition_contents2, |
| 200 content::WebContents** persistent_partition_contents3) { | 201 content::WebContents** persistent_partition_contents3) { |
| 201 GURL::Replacements replace_host; | 202 GURL::Replacements replace_host; |
| 202 std::string host_str("localhost"); // Must stay in scope with replace_host. | 203 std::string host_str("localhost"); // Must stay in scope with replace_host. |
| 203 replace_host.SetHostStr(host_str); | 204 replace_host.SetHostStr(host_str); |
| 204 | 205 |
| 205 navigate_to_url = navigate_to_url.ReplaceComponents(replace_host); | 206 navigate_to_url = navigate_to_url.ReplaceComponents(replace_host); |
| 206 | 207 |
| 207 GURL tag_url1 = test_server()->GetURL( | 208 GURL tag_url1 = embedded_test_server()->GetURL( |
| 208 "files/extensions/platform_apps/web_view/isolation/cookie.html"); | 209 "/extensions/platform_apps/web_view/isolation/cookie.html"); |
| 209 tag_url1 = tag_url1.ReplaceComponents(replace_host); | 210 tag_url1 = tag_url1.ReplaceComponents(replace_host); |
| 210 GURL tag_url2 = test_server()->GetURL( | 211 GURL tag_url2 = embedded_test_server()->GetURL( |
| 211 "files/extensions/platform_apps/web_view/isolation/cookie2.html"); | 212 "/extensions/platform_apps/web_view/isolation/cookie2.html"); |
| 212 tag_url2 = tag_url2.ReplaceComponents(replace_host); | 213 tag_url2 = tag_url2.ReplaceComponents(replace_host); |
| 213 GURL tag_url3 = test_server()->GetURL( | 214 GURL tag_url3 = embedded_test_server()->GetURL( |
| 214 "files/extensions/platform_apps/web_view/isolation/storage1.html"); | 215 "/extensions/platform_apps/web_view/isolation/storage1.html"); |
| 215 tag_url3 = tag_url3.ReplaceComponents(replace_host); | 216 tag_url3 = tag_url3.ReplaceComponents(replace_host); |
| 216 GURL tag_url4 = test_server()->GetURL( | 217 GURL tag_url4 = embedded_test_server()->GetURL( |
| 217 "files/extensions/platform_apps/web_view/isolation/storage2.html"); | 218 "/extensions/platform_apps/web_view/isolation/storage2.html"); |
| 218 tag_url4 = tag_url4.ReplaceComponents(replace_host); | 219 tag_url4 = tag_url4.ReplaceComponents(replace_host); |
| 219 GURL tag_url5 = test_server()->GetURL( | 220 GURL tag_url5 = embedded_test_server()->GetURL( |
| 220 "files/extensions/platform_apps/web_view/isolation/storage1.html#p1"); | 221 "/extensions/platform_apps/web_view/isolation/storage1.html#p1"); |
| 221 tag_url5 = tag_url5.ReplaceComponents(replace_host); | 222 tag_url5 = tag_url5.ReplaceComponents(replace_host); |
| 222 GURL tag_url6 = test_server()->GetURL( | 223 GURL tag_url6 = embedded_test_server()->GetURL( |
| 223 "files/extensions/platform_apps/web_view/isolation/storage1.html#p2"); | 224 "/extensions/platform_apps/web_view/isolation/storage1.html#p2"); |
| 224 tag_url6 = tag_url6.ReplaceComponents(replace_host); | 225 tag_url6 = tag_url6.ReplaceComponents(replace_host); |
| 225 GURL tag_url7 = test_server()->GetURL( | 226 GURL tag_url7 = embedded_test_server()->GetURL( |
| 226 "files/extensions/platform_apps/web_view/isolation/storage1.html#p3"); | 227 "/extensions/platform_apps/web_view/isolation/storage1.html#p3"); |
| 227 tag_url7 = tag_url7.ReplaceComponents(replace_host); | 228 tag_url7 = tag_url7.ReplaceComponents(replace_host); |
| 228 | 229 |
| 229 ui_test_utils::NavigateToURLWithDisposition( | 230 ui_test_utils::NavigateToURLWithDisposition( |
| 230 browser(), navigate_to_url, CURRENT_TAB, | 231 browser(), navigate_to_url, CURRENT_TAB, |
| 231 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 232 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 232 | 233 |
| 233 ui_test_utils::UrlLoadObserver observer1( | 234 ui_test_utils::UrlLoadObserver observer1( |
| 234 tag_url1, content::NotificationService::AllSources()); | 235 tag_url1, content::NotificationService::AllSources()); |
| 235 ui_test_utils::UrlLoadObserver observer2( | 236 ui_test_utils::UrlLoadObserver observer2( |
| 236 tag_url2, content::NotificationService::AllSources()); | 237 tag_url2, content::NotificationService::AllSources()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 test_name.c_str()))); | 373 test_name.c_str()))); |
| 373 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | 374 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); |
| 374 } | 375 } |
| 375 | 376 |
| 376 content::WebContents* LoadGuest(const std::string& guest_path, | 377 content::WebContents* LoadGuest(const std::string& guest_path, |
| 377 const std::string& app_path) { | 378 const std::string& app_path) { |
| 378 GURL::Replacements replace_host; | 379 GURL::Replacements replace_host; |
| 379 std::string host_str("localhost"); // Must stay in scope with replace_host. | 380 std::string host_str("localhost"); // Must stay in scope with replace_host. |
| 380 replace_host.SetHostStr(host_str); | 381 replace_host.SetHostStr(host_str); |
| 381 | 382 |
| 382 GURL guest_url = test_server()->GetURL(guest_path); | 383 GURL guest_url = embedded_test_server()->GetURL(guest_path); |
| 383 guest_url = guest_url.ReplaceComponents(replace_host); | 384 guest_url = guest_url.ReplaceComponents(replace_host); |
| 384 | 385 |
| 385 ui_test_utils::UrlLoadObserver guest_observer( | 386 ui_test_utils::UrlLoadObserver guest_observer( |
| 386 guest_url, content::NotificationService::AllSources()); | 387 guest_url, content::NotificationService::AllSources()); |
| 387 | 388 |
| 388 ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false); | 389 ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false); |
| 389 LoadAndLaunchPlatformApp(app_path.c_str()); | 390 LoadAndLaunchPlatformApp(app_path.c_str()); |
| 390 guest_observer.Wait(); | 391 guest_observer.Wait(); |
| 391 | 392 |
| 392 content::Source<content::NavigationController> source = | 393 content::Source<content::NavigationController> source = |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 << message_; | 449 << message_; |
| 449 } | 450 } |
| 450 | 451 |
| 451 // This test verifies that prerendering has been disabled inside <webview>. | 452 // This test verifies that prerendering has been disabled inside <webview>. |
| 452 // This test is here rather than in PrerenderBrowserTest for testing convenience | 453 // This test is here rather than in PrerenderBrowserTest for testing convenience |
| 453 // only. If it breaks then this is a bug in the prerenderer. | 454 // only. If it breaks then this is a bug in the prerenderer. |
| 454 IN_PROC_BROWSER_TEST_F(WebViewTest, NoPrerenderer) { | 455 IN_PROC_BROWSER_TEST_F(WebViewTest, NoPrerenderer) { |
| 455 ASSERT_TRUE(StartTestServer()); | 456 ASSERT_TRUE(StartTestServer()); |
| 456 content::WebContents* guest_web_contents = | 457 content::WebContents* guest_web_contents = |
| 457 LoadGuest( | 458 LoadGuest( |
| 458 "files/extensions/platform_apps/web_view/noprerenderer/guest.html", | 459 "/extensions/platform_apps/web_view/noprerenderer/guest.html", |
| 459 "web_view/noprerenderer"); | 460 "web_view/noprerenderer"); |
| 460 ASSERT_TRUE(guest_web_contents != NULL); | 461 ASSERT_TRUE(guest_web_contents != NULL); |
| 461 | 462 |
| 462 PrerenderLinkManager* prerender_link_manager = | 463 PrerenderLinkManager* prerender_link_manager = |
| 463 PrerenderLinkManagerFactory::GetForProfile( | 464 PrerenderLinkManagerFactory::GetForProfile( |
| 464 Profile::FromBrowserContext(guest_web_contents->GetBrowserContext())); | 465 Profile::FromBrowserContext(guest_web_contents->GetBrowserContext())); |
| 465 ASSERT_TRUE(prerender_link_manager != NULL); | 466 ASSERT_TRUE(prerender_link_manager != NULL); |
| 466 EXPECT_TRUE(prerender_link_manager->IsEmpty()); | 467 EXPECT_TRUE(prerender_link_manager->IsEmpty()); |
| 467 } | 468 } |
| 468 | 469 |
| 469 // This tests cookie isolation for packaged apps with webview tags. It navigates | 470 // This tests cookie isolation for packaged apps with webview tags. It navigates |
| 470 // the main browser window to a page that sets a cookie and loads an app with | 471 // the main browser window to a page that sets a cookie and loads an app with |
| 471 // multiple webview tags. Each tag sets a cookie and the test checks the proper | 472 // multiple webview tags. Each tag sets a cookie and the test checks the proper |
| 472 // storage isolation is enforced. | 473 // storage isolation is enforced. |
| 473 IN_PROC_BROWSER_TEST_F(WebViewTest, CookieIsolation) { | 474 IN_PROC_BROWSER_TEST_F(WebViewTest, CookieIsolation) { |
| 474 ASSERT_TRUE(StartTestServer()); | 475 ASSERT_TRUE(StartTestServer()); |
| 475 const std::string kExpire = | 476 const std::string kExpire = |
| 476 "var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);"; | 477 "var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);"; |
| 477 std::string cookie_script1(kExpire); | 478 std::string cookie_script1(kExpire); |
| 478 cookie_script1.append( | 479 cookie_script1.append( |
| 479 "document.cookie = 'guest1=true; path=/; expires=' + expire + ';';"); | 480 "document.cookie = 'guest1=true; path=/; expires=' + expire + ';';"); |
| 480 std::string cookie_script2(kExpire); | 481 std::string cookie_script2(kExpire); |
| 481 cookie_script2.append( | 482 cookie_script2.append( |
| 482 "document.cookie = 'guest2=true; path=/; expires=' + expire + ';';"); | 483 "document.cookie = 'guest2=true; path=/; expires=' + expire + ';';"); |
| 483 | 484 |
| 484 GURL::Replacements replace_host; | 485 GURL::Replacements replace_host; |
| 485 std::string host_str("localhost"); // Must stay in scope with replace_host. | 486 std::string host_str("localhost"); // Must stay in scope with replace_host. |
| 486 replace_host.SetHostStr(host_str); | 487 replace_host.SetHostStr(host_str); |
| 487 | 488 |
| 488 GURL set_cookie_url = test_server()->GetURL( | 489 GURL set_cookie_url = embedded_test_server()->GetURL( |
| 489 "files/extensions/platform_apps/isolation/set_cookie.html"); | 490 "/extensions/platform_apps/isolation/set_cookie.html"); |
| 490 set_cookie_url = set_cookie_url.ReplaceComponents(replace_host); | 491 set_cookie_url = set_cookie_url.ReplaceComponents(replace_host); |
| 491 | 492 |
| 492 // The first two partitions will be used to set cookies and ensure they are | 493 // The first two partitions will be used to set cookies and ensure they are |
| 493 // shared. The named partition is used to ensure that cookies are isolated | 494 // shared. The named partition is used to ensure that cookies are isolated |
| 494 // between partitions within the same app. | 495 // between partitions within the same app. |
| 495 content::WebContents* cookie_contents1; | 496 content::WebContents* cookie_contents1; |
| 496 content::WebContents* cookie_contents2; | 497 content::WebContents* cookie_contents2; |
| 497 content::WebContents* named_partition_contents1; | 498 content::WebContents* named_partition_contents1; |
| 498 content::WebContents* named_partition_contents2; | 499 content::WebContents* named_partition_contents2; |
| 499 | 500 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 #else | 687 #else |
| 687 #define MAYBE_DOMStorageIsolation DOMStorageIsolation | 688 #define MAYBE_DOMStorageIsolation DOMStorageIsolation |
| 688 #endif | 689 #endif |
| 689 | 690 |
| 690 // This tests DOM storage isolation for packaged apps with webview tags. It | 691 // This tests DOM storage isolation for packaged apps with webview tags. It |
| 691 // loads an app with multiple webview tags and each tag sets DOM storage | 692 // loads an app with multiple webview tags and each tag sets DOM storage |
| 692 // entries, which the test checks to ensure proper storage isolation is | 693 // entries, which the test checks to ensure proper storage isolation is |
| 693 // enforced. | 694 // enforced. |
| 694 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_DOMStorageIsolation) { | 695 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_DOMStorageIsolation) { |
| 695 ASSERT_TRUE(StartTestServer()); | 696 ASSERT_TRUE(StartTestServer()); |
| 696 GURL regular_url = test_server()->GetURL("files/title1.html"); | 697 GURL regular_url = embedded_test_server()->GetURL("/title1.html"); |
| 697 | 698 |
| 698 std::string output; | 699 std::string output; |
| 699 std::string get_local_storage("window.domAutomationController.send(" | 700 std::string get_local_storage("window.domAutomationController.send(" |
| 700 "window.localStorage.getItem('foo') || 'badval')"); | 701 "window.localStorage.getItem('foo') || 'badval')"); |
| 701 std::string get_session_storage("window.domAutomationController.send(" | 702 std::string get_session_storage("window.domAutomationController.send(" |
| 702 "window.sessionStorage.getItem('bar') || 'badval')"); | 703 "window.sessionStorage.getItem('bar') || 'badval')"); |
| 703 | 704 |
| 704 content::WebContents* default_tag_contents1; | 705 content::WebContents* default_tag_contents1; |
| 705 content::WebContents* default_tag_contents2; | 706 content::WebContents* default_tag_contents2; |
| 706 content::WebContents* storage_contents1; | 707 content::WebContents* storage_contents1; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 #define MAYBE_IndexedDBIsolation DISABLED_IndexedDBIsolation | 781 #define MAYBE_IndexedDBIsolation DISABLED_IndexedDBIsolation |
| 781 #else | 782 #else |
| 782 #define MAYBE_IndexedDBIsolation IndexedDBIsolation | 783 #define MAYBE_IndexedDBIsolation IndexedDBIsolation |
| 783 #endif | 784 #endif |
| 784 | 785 |
| 785 // This tests IndexedDB isolation for packaged apps with webview tags. It loads | 786 // This tests IndexedDB isolation for packaged apps with webview tags. It loads |
| 786 // an app with multiple webview tags and each tag creates an IndexedDB record, | 787 // an app with multiple webview tags and each tag creates an IndexedDB record, |
| 787 // which the test checks to ensure proper storage isolation is enforced. | 788 // which the test checks to ensure proper storage isolation is enforced. |
| 788 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_IndexedDBIsolation) { | 789 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_IndexedDBIsolation) { |
| 789 ASSERT_TRUE(StartTestServer()); | 790 ASSERT_TRUE(StartTestServer()); |
| 790 GURL regular_url = test_server()->GetURL("files/title1.html"); | 791 GURL regular_url = embedded_test_server()->GetURL("/title1.html"); |
| 791 | 792 |
| 792 content::WebContents* default_tag_contents1; | 793 content::WebContents* default_tag_contents1; |
| 793 content::WebContents* default_tag_contents2; | 794 content::WebContents* default_tag_contents2; |
| 794 content::WebContents* storage_contents1; | 795 content::WebContents* storage_contents1; |
| 795 content::WebContents* storage_contents2; | 796 content::WebContents* storage_contents2; |
| 796 | 797 |
| 797 NavigateAndOpenAppForIsolation(regular_url, &default_tag_contents1, | 798 NavigateAndOpenAppForIsolation(regular_url, &default_tag_contents1, |
| 798 &default_tag_contents2, &storage_contents1, | 799 &default_tag_contents2, &storage_contents1, |
| 799 &storage_contents2, NULL, NULL, NULL); | 800 &storage_contents2, NULL, NULL, NULL); |
| 800 | 801 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 IN_PROC_BROWSER_TEST_F(WebViewTest, ScreenCoordinates) { | 944 IN_PROC_BROWSER_TEST_F(WebViewTest, ScreenCoordinates) { |
| 944 ASSERT_TRUE(StartTestServer()); // For serving guest pages. | 945 ASSERT_TRUE(StartTestServer()); // For serving guest pages. |
| 945 ASSERT_TRUE(RunPlatformAppTestWithArg( | 946 ASSERT_TRUE(RunPlatformAppTestWithArg( |
| 946 "platform_apps/web_view/common", "screen_coordinates")) | 947 "platform_apps/web_view/common", "screen_coordinates")) |
| 947 << message_; | 948 << message_; |
| 948 } | 949 } |
| 949 | 950 |
| 950 IN_PROC_BROWSER_TEST_F(WebViewTest, SpeechRecognition) { | 951 IN_PROC_BROWSER_TEST_F(WebViewTest, SpeechRecognition) { |
| 951 ASSERT_TRUE(StartTestServer()); | 952 ASSERT_TRUE(StartTestServer()); |
| 952 content::WebContents* guest_web_contents = LoadGuest( | 953 content::WebContents* guest_web_contents = LoadGuest( |
| 953 "files/extensions/platform_apps/web_view/speech/guest.html", | 954 "/extensions/platform_apps/web_view/speech/guest.html", |
| 954 "web_view/speech"); | 955 "web_view/speech"); |
| 955 ASSERT_TRUE(guest_web_contents); | 956 ASSERT_TRUE(guest_web_contents); |
| 956 | 957 |
| 957 // Click on the guest (center of the WebContents), the guest is rendered in a | 958 // Click on the guest (center of the WebContents), the guest is rendered in a |
| 958 // way that this will trigger clicking on speech recognition input mic. | 959 // way that this will trigger clicking on speech recognition input mic. |
| 959 SimulateMouseClick(guest_web_contents, 0, WebKit::WebMouseEvent::ButtonLeft); | 960 SimulateMouseClick(guest_web_contents, 0, WebKit::WebMouseEvent::ButtonLeft); |
| 960 | 961 |
| 961 string16 expected_title(ASCIIToUTF16("PASSED")); | 962 string16 expected_title(ASCIIToUTF16("PASSED")); |
| 962 string16 error_title(ASCIIToUTF16("FAILED")); | 963 string16 error_title(ASCIIToUTF16("FAILED")); |
| 963 content::TitleWatcher title_watcher(guest_web_contents, expected_title); | 964 content::TitleWatcher title_watcher(guest_web_contents, expected_title); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 IN_PROC_BROWSER_TEST_F(WebViewTest, ConsoleMessage) { | 1038 IN_PROC_BROWSER_TEST_F(WebViewTest, ConsoleMessage) { |
| 1038 ASSERT_TRUE(StartTestServer()); // For serving guest pages. | 1039 ASSERT_TRUE(StartTestServer()); // For serving guest pages. |
| 1039 ASSERT_TRUE(RunPlatformAppTestWithArg( | 1040 ASSERT_TRUE(RunPlatformAppTestWithArg( |
| 1040 "platform_apps/web_view/common", "console_messages")) | 1041 "platform_apps/web_view/common", "console_messages")) |
| 1041 << message_; | 1042 << message_; |
| 1042 } | 1043 } |
| 1043 | 1044 |
| 1044 IN_PROC_BROWSER_TEST_F(WebViewTest, DownloadPermission) { | 1045 IN_PROC_BROWSER_TEST_F(WebViewTest, DownloadPermission) { |
| 1045 ASSERT_TRUE(StartTestServer()); // For serving guest pages. | 1046 ASSERT_TRUE(StartTestServer()); // For serving guest pages. |
| 1046 content::WebContents* guest_web_contents = | 1047 content::WebContents* guest_web_contents = |
| 1047 LoadGuest("files/extensions/platform_apps/web_view/download/guest.html", | 1048 LoadGuest("/extensions/platform_apps/web_view/download/guest.html", |
| 1048 "web_view/download"); | 1049 "web_view/download"); |
| 1049 ASSERT_TRUE(guest_web_contents); | 1050 ASSERT_TRUE(guest_web_contents); |
| 1050 | 1051 |
| 1051 // Replace WebContentsDelegate with mock version so we can intercept download | 1052 // Replace WebContentsDelegate with mock version so we can intercept download |
| 1052 // requests. | 1053 // requests. |
| 1053 content::WebContentsDelegate* delegate = guest_web_contents->GetDelegate(); | 1054 content::WebContentsDelegate* delegate = guest_web_contents->GetDelegate(); |
| 1054 MockDownloadWebContentsDelegate* mock_delegate = | 1055 MockDownloadWebContentsDelegate* mock_delegate = |
| 1055 new MockDownloadWebContentsDelegate(delegate); | 1056 new MockDownloadWebContentsDelegate(delegate); |
| 1056 guest_web_contents->SetDelegate(mock_delegate); | 1057 guest_web_contents->SetDelegate(mock_delegate); |
| 1057 | 1058 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 // Now load an app with <webview>. | 1094 // Now load an app with <webview>. |
| 1094 ExtensionTestMessageListener done_listener("DoneTest", false); | 1095 ExtensionTestMessageListener done_listener("DoneTest", false); |
| 1095 LoadAndLaunchPlatformApp("web_view/content_script_whitelisted"); | 1096 LoadAndLaunchPlatformApp("web_view/content_script_whitelisted"); |
| 1096 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | 1097 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); |
| 1097 } | 1098 } |
| 1098 | 1099 |
| 1099 IN_PROC_BROWSER_TEST_F(WebViewTest, SetPropertyOnDocumentReady) { | 1100 IN_PROC_BROWSER_TEST_F(WebViewTest, SetPropertyOnDocumentReady) { |
| 1100 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/document_ready")) | 1101 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/document_ready")) |
| 1101 << message_; | 1102 << message_; |
| 1102 } | 1103 } |
| OLD | NEW |