| 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 <queue> | 5 #include <queue> |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2391 #define MAYBE_WebViewInBackgroundPage \ | 2391 #define MAYBE_WebViewInBackgroundPage \ |
| 2392 DISABLED_WebViewInBackgroundPage | 2392 DISABLED_WebViewInBackgroundPage |
| 2393 #else | 2393 #else |
| 2394 #define MAYBE_WebViewInBackgroundPage WebViewInBackgroundPage | 2394 #define MAYBE_WebViewInBackgroundPage WebViewInBackgroundPage |
| 2395 #endif | 2395 #endif |
| 2396 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_WebViewInBackgroundPage) { | 2396 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_WebViewInBackgroundPage) { |
| 2397 ASSERT_TRUE(RunExtensionTest("platform_apps/web_view/background")) | 2397 ASSERT_TRUE(RunExtensionTest("platform_apps/web_view/background")) |
| 2398 << message_; | 2398 << message_; |
| 2399 } | 2399 } |
| 2400 | 2400 |
| 2401 // This test verifies that the allowtransparency attribute properly propagates | 2401 // This test verifies that the allowtransparency attribute properly propagates. |
| 2402 IN_PROC_BROWSER_TEST_F(WebViewTest, AllowTransparencyAndAllowScalingPropagate) { | 2402 IN_PROC_BROWSER_TEST_F(WebViewTest, AllowTransparencyAndAllowScalingPropagate) { |
| 2403 LoadAppWithGuest("web_view/simple"); | 2403 LoadAppWithGuest("web_view/simple"); |
| 2404 | 2404 |
| 2405 ASSERT_TRUE(GetGuestWebContents()); | 2405 ASSERT_TRUE(GetGuestWebContents()); |
| 2406 extensions::WebViewGuest* guest = | 2406 extensions::WebViewGuest* guest = |
| 2407 extensions::WebViewGuest::FromWebContents(GetGuestWebContents()); | 2407 extensions::WebViewGuest::FromWebContents(GetGuestWebContents()); |
| 2408 ASSERT_TRUE(guest->allow_transparency()); | 2408 ASSERT_TRUE(guest->allow_transparency()); |
| 2409 ASSERT_TRUE(guest->allow_scaling()); | 2409 ASSERT_TRUE(guest->allow_scaling()); |
| 2410 } | 2410 } |
| 2411 | 2411 |
| 2412 IN_PROC_BROWSER_TEST_F(WebViewCommonTest, BasicPostMessage) { | 2412 IN_PROC_BROWSER_TEST_F(WebViewCommonTest, BasicPostMessage) { |
| 2413 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | 2413 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. |
| 2414 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/post_message/basic")) | 2414 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/post_message/basic")) |
| 2415 << message_; | 2415 << message_; |
| 2416 } | 2416 } |
| 2417 | 2417 |
| 2418 // Tests that webviews do get garbage collected. | 2418 // Tests that webviews do get garbage collected. |
| 2419 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestGarbageCollect) { | 2419 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestGarbageCollect) { |
| 2420 TestHelper("testGarbageCollect", "web_view/shim", NO_TEST_SERVER); | 2420 TestHelper("testGarbageCollect", "web_view/shim", NO_TEST_SERVER); |
| 2421 GetGuestViewManager()->WaitForSingleViewGarbageCollected(); | 2421 GetGuestViewManager()->WaitForSingleViewGarbageCollected(); |
| 2422 } | 2422 } |
| 2423 | 2423 |
| 2424 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestCloseNewWindowCleanup) { | 2424 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestCloseNewWindowCleanup) { |
| 2425 TestHelper("testCloseNewWindowCleanup", "web_view/shim", NEEDS_TEST_SERVER); | 2425 TestHelper("testCloseNewWindowCleanup", "web_view/shim", NEEDS_TEST_SERVER); |
| 2426 auto gvm = GetGuestViewManager(); | 2426 auto gvm = GetGuestViewManager(); |
| 2427 gvm->WaitForLastGuestDeleted(); | 2427 gvm->WaitForLastGuestDeleted(); |
| 2428 ASSERT_EQ(gvm->num_embedder_processes_destroyed(), 0); | 2428 ASSERT_EQ(gvm->num_embedder_processes_destroyed(), 0); |
| 2429 } | 2429 } |
| 2430 | 2430 |
| 2431 // Ensure that focusing a WebView while it is already focused does not blur the |
| 2432 // guest content. |
| 2433 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestFocusWhileFocused) { |
| 2434 TestHelper("testFocusWhileFocused", "web_view/shim", NO_TEST_SERVER); |
| 2435 } |
| 2436 |
| 2431 #if defined(USE_AURA) | 2437 #if defined(USE_AURA) |
| 2432 // TODO(wjmaclean): when WebViewTest is re-enabled on the site-isolation | 2438 // TODO(wjmaclean): when WebViewTest is re-enabled on the site-isolation |
| 2433 // bots, then re-enable this test class as well. | 2439 // bots, then re-enable this test class as well. |
| 2434 // https://crbug.com/503751 | 2440 // https://crbug.com/503751 |
| 2435 class WebViewFocusTest : public WebViewTest { | 2441 class WebViewFocusTest : public WebViewTest { |
| 2436 public: | 2442 public: |
| 2437 ~WebViewFocusTest() override {} | 2443 ~WebViewFocusTest() override {} |
| 2438 | 2444 |
| 2439 void SetUpCommandLine(base::CommandLine* command_line) override { | 2445 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 2440 WebViewTest::SetUpCommandLine(command_line); | 2446 WebViewTest::SetUpCommandLine(command_line); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 // Generate and send synthetic touch event. | 2564 // Generate and send synthetic touch event. |
| 2559 FocusWaiter waiter(aura_webview); | 2565 FocusWaiter waiter(aura_webview); |
| 2560 content::SimulateTouchPressAt(GetEmbedderWebContents(), | 2566 content::SimulateTouchPressAt(GetEmbedderWebContents(), |
| 2561 guest_rect.CenterPoint()); | 2567 guest_rect.CenterPoint()); |
| 2562 | 2568 |
| 2563 // Wait for the TouchStart to propagate and restore focus. Test times out | 2569 // Wait for the TouchStart to propagate and restore focus. Test times out |
| 2564 // on failure. | 2570 // on failure. |
| 2565 waiter.Wait(); | 2571 waiter.Wait(); |
| 2566 } | 2572 } |
| 2567 #endif | 2573 #endif |
| OLD | NEW |