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 "apps/ui/native_app_window.h" | 5 #include "apps/ui/native_app_window.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/apps/app_browsertest_util.h" | 10 #include "chrome/browser/apps/app_browsertest_util.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 LoadAndLaunchPlatformApp("web_view/isolation"); | 402 LoadAndLaunchPlatformApp("web_view/isolation"); |
403 observer1.Wait(); | 403 observer1.Wait(); |
404 observer2.Wait(); | 404 observer2.Wait(); |
405 observer3.Wait(); | 405 observer3.Wait(); |
406 observer4.Wait(); | 406 observer4.Wait(); |
407 observer5.Wait(); | 407 observer5.Wait(); |
408 observer6.Wait(); | 408 observer6.Wait(); |
409 observer7.Wait(); | 409 observer7.Wait(); |
410 | 410 |
411 content::Source<content::NavigationController> source1 = observer1.source(); | 411 content::Source<content::NavigationController> source1 = observer1.source(); |
412 EXPECT_TRUE(source1->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 412 EXPECT_TRUE(source1->GetWebContents()->GetRenderProcessHost()-> |
| 413 IsIsolatedGuest()); |
413 content::Source<content::NavigationController> source2 = observer2.source(); | 414 content::Source<content::NavigationController> source2 = observer2.source(); |
414 EXPECT_TRUE(source2->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 415 EXPECT_TRUE(source2->GetWebContents()->GetRenderProcessHost()-> |
| 416 IsIsolatedGuest()); |
415 content::Source<content::NavigationController> source3 = observer3.source(); | 417 content::Source<content::NavigationController> source3 = observer3.source(); |
416 EXPECT_TRUE(source3->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 418 EXPECT_TRUE(source3->GetWebContents()->GetRenderProcessHost()-> |
| 419 IsIsolatedGuest()); |
417 content::Source<content::NavigationController> source4 = observer4.source(); | 420 content::Source<content::NavigationController> source4 = observer4.source(); |
418 EXPECT_TRUE(source4->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 421 EXPECT_TRUE(source4->GetWebContents()->GetRenderProcessHost()-> |
| 422 IsIsolatedGuest()); |
419 content::Source<content::NavigationController> source5 = observer5.source(); | 423 content::Source<content::NavigationController> source5 = observer5.source(); |
420 EXPECT_TRUE(source5->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 424 EXPECT_TRUE(source5->GetWebContents()->GetRenderProcessHost()-> |
| 425 IsIsolatedGuest()); |
421 content::Source<content::NavigationController> source6 = observer6.source(); | 426 content::Source<content::NavigationController> source6 = observer6.source(); |
422 EXPECT_TRUE(source6->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 427 EXPECT_TRUE(source6->GetWebContents()->GetRenderProcessHost()-> |
| 428 IsIsolatedGuest()); |
423 content::Source<content::NavigationController> source7 = observer7.source(); | 429 content::Source<content::NavigationController> source7 = observer7.source(); |
424 EXPECT_TRUE(source7->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 430 EXPECT_TRUE(source7->GetWebContents()->GetRenderProcessHost()-> |
| 431 IsIsolatedGuest()); |
425 | 432 |
426 // Check that the first two tags use the same process and it is different | 433 // Check that the first two tags use the same process and it is different |
427 // than the process used by the other two. | 434 // than the process used by the other two. |
428 EXPECT_EQ(source1->GetWebContents()->GetRenderProcessHost()->GetID(), | 435 EXPECT_EQ(source1->GetWebContents()->GetRenderProcessHost()->GetID(), |
429 source2->GetWebContents()->GetRenderProcessHost()->GetID()); | 436 source2->GetWebContents()->GetRenderProcessHost()->GetID()); |
430 EXPECT_EQ(source3->GetWebContents()->GetRenderProcessHost()->GetID(), | 437 EXPECT_EQ(source3->GetWebContents()->GetRenderProcessHost()->GetID(), |
431 source4->GetWebContents()->GetRenderProcessHost()->GetID()); | 438 source4->GetWebContents()->GetRenderProcessHost()->GetID()); |
432 EXPECT_NE(source1->GetWebContents()->GetRenderProcessHost()->GetID(), | 439 EXPECT_NE(source1->GetWebContents()->GetRenderProcessHost()->GetID(), |
433 source3->GetWebContents()->GetRenderProcessHost()->GetID()); | 440 source3->GetWebContents()->GetRenderProcessHost()->GetID()); |
434 | 441 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 | 610 |
604 ui_test_utils::UrlLoadObserver guest_observer( | 611 ui_test_utils::UrlLoadObserver guest_observer( |
605 guest_url, content::NotificationService::AllSources()); | 612 guest_url, content::NotificationService::AllSources()); |
606 | 613 |
607 ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false); | 614 ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false); |
608 LoadAndLaunchPlatformApp(app_path.c_str()); | 615 LoadAndLaunchPlatformApp(app_path.c_str()); |
609 guest_observer.Wait(); | 616 guest_observer.Wait(); |
610 | 617 |
611 content::Source<content::NavigationController> source = | 618 content::Source<content::NavigationController> source = |
612 guest_observer.source(); | 619 guest_observer.source(); |
613 EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 620 EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()-> |
| 621 IsIsolatedGuest()); |
614 | 622 |
615 bool satisfied = guest_loaded_listener.WaitUntilSatisfied(); | 623 bool satisfied = guest_loaded_listener.WaitUntilSatisfied(); |
616 if (!satisfied) | 624 if (!satisfied) |
617 return NULL; | 625 return NULL; |
618 | 626 |
619 content::WebContents* guest_web_contents = source->GetWebContents(); | 627 content::WebContents* guest_web_contents = source->GetWebContents(); |
620 return guest_web_contents; | 628 return guest_web_contents; |
621 } | 629 } |
622 | 630 |
623 // Runs media_access/allow tests. | 631 // Runs media_access/allow tests. |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 // Run the test and wait until the guest WebContents is available and has | 1120 // Run the test and wait until the guest WebContents is available and has |
1113 // finished loading. | 1121 // finished loading. |
1114 ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false); | 1122 ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false); |
1115 EXPECT_TRUE(content::ExecuteScript( | 1123 EXPECT_TRUE(content::ExecuteScript( |
1116 embedder_web_contents, | 1124 embedder_web_contents, |
1117 "runTest('testRemoveWebviewOnExit')")); | 1125 "runTest('testRemoveWebviewOnExit')")); |
1118 guest_observer.Wait(); | 1126 guest_observer.Wait(); |
1119 | 1127 |
1120 content::Source<content::NavigationController> source = | 1128 content::Source<content::NavigationController> source = |
1121 guest_observer.source(); | 1129 guest_observer.source(); |
1122 EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 1130 EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()-> |
| 1131 IsIsolatedGuest()); |
1123 | 1132 |
1124 ASSERT_TRUE(guest_loaded_listener.WaitUntilSatisfied()); | 1133 ASSERT_TRUE(guest_loaded_listener.WaitUntilSatisfied()); |
1125 | 1134 |
1126 content::WebContentsDestroyedWatcher destroyed_watcher( | 1135 content::WebContentsDestroyedWatcher destroyed_watcher( |
1127 source->GetWebContents()); | 1136 source->GetWebContents()); |
1128 | 1137 |
1129 // Tell the embedder to kill the guest. | 1138 // Tell the embedder to kill the guest. |
1130 EXPECT_TRUE(content::ExecuteScript( | 1139 EXPECT_TRUE(content::ExecuteScript( |
1131 embedder_web_contents, | 1140 embedder_web_contents, |
1132 "removeWebviewOnExitDoCrash();")); | 1141 "removeWebviewOnExitDoCrash();")); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents(); | 1203 content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents(); |
1195 ExtensionTestMessageListener second("GuestAddedToDom", false); | 1204 ExtensionTestMessageListener second("GuestAddedToDom", false); |
1196 EXPECT_TRUE(content::ExecuteScript( | 1205 EXPECT_TRUE(content::ExecuteScript( |
1197 embedder_web_contents, | 1206 embedder_web_contents, |
1198 base::StringPrintf("loadGuest(%d);\n", host_and_port.port()))); | 1207 base::StringPrintf("loadGuest(%d);\n", host_and_port.port()))); |
1199 ASSERT_TRUE(second.WaitUntilSatisfied()); | 1208 ASSERT_TRUE(second.WaitUntilSatisfied()); |
1200 | 1209 |
1201 // Wait for interstitial page to be shown in guest. | 1210 // Wait for interstitial page to be shown in guest. |
1202 content::WebContents* guest_web_contents = new_client.WaitForGuestCreated(); | 1211 content::WebContents* guest_web_contents = new_client.WaitForGuestCreated(); |
1203 SetBrowserClientForTesting(old_client); | 1212 SetBrowserClientForTesting(old_client); |
1204 ASSERT_TRUE(guest_web_contents->GetRenderProcessHost()->IsGuest()); | 1213 ASSERT_TRUE(guest_web_contents->GetRenderProcessHost()->IsIsolatedGuest()); |
1205 WaitForInterstitial(guest_web_contents); | 1214 WaitForInterstitial(guest_web_contents); |
1206 | 1215 |
1207 // Now close the app while interstitial page being shown in guest. | 1216 // Now close the app while interstitial page being shown in guest. |
1208 apps::AppWindow* window = GetFirstAppWindow(); | 1217 apps::AppWindow* window = GetFirstAppWindow(); |
1209 window->GetBaseWindow()->Close(); | 1218 window->GetBaseWindow()->Close(); |
1210 } | 1219 } |
1211 | 1220 |
1212 IN_PROC_BROWSER_TEST_F(WebViewTest, ShimSrcAttribute) { | 1221 IN_PROC_BROWSER_TEST_F(WebViewTest, ShimSrcAttribute) { |
1213 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/src_attribute")) | 1222 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/src_attribute")) |
1214 << message_; | 1223 << message_; |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2141 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestFindAPI_findupdate) { | 2150 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestFindAPI_findupdate) { |
2142 TestHelper("testFindAPI_findupdate", "web_view/shim", NO_TEST_SERVER); | 2151 TestHelper("testFindAPI_findupdate", "web_view/shim", NO_TEST_SERVER); |
2143 } | 2152 } |
2144 | 2153 |
2145 // <webview> screenshot capture fails with ubercomp. | 2154 // <webview> screenshot capture fails with ubercomp. |
2146 // See http://crbug.com/327035. | 2155 // See http://crbug.com/327035. |
2147 IN_PROC_BROWSER_TEST_F(WebViewCaptureTest, | 2156 IN_PROC_BROWSER_TEST_F(WebViewCaptureTest, |
2148 DISABLED_Shim_ScreenshotCapture) { | 2157 DISABLED_Shim_ScreenshotCapture) { |
2149 TestHelper("testScreenshotCapture", "web_view/shim", NO_TEST_SERVER); | 2158 TestHelper("testScreenshotCapture", "web_view/shim", NO_TEST_SERVER); |
2150 } | 2159 } |
OLD | NEW |