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