| 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 "base/path_service.h" | 5 #include "base/path_service.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/chrome_content_browser_client.h" | 9 #include "chrome/browser/chrome_content_browser_client.h" |
| 10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "content/public/test/test_renderer_host.h" | 30 #include "content/public/test/test_renderer_host.h" |
| 31 #include "extensions/browser/app_window/native_app_window.h" | 31 #include "extensions/browser/app_window/native_app_window.h" |
| 32 #include "extensions/browser/guest_view/guest_view_manager.h" | 32 #include "extensions/browser/guest_view/guest_view_manager.h" |
| 33 #include "extensions/browser/guest_view/guest_view_manager_factory.h" | 33 #include "extensions/browser/guest_view/guest_view_manager_factory.h" |
| 34 #include "extensions/common/extension.h" | 34 #include "extensions/common/extension.h" |
| 35 #include "extensions/common/extensions_client.h" | 35 #include "extensions/common/extensions_client.h" |
| 36 #include "media/base/media_switches.h" | 36 #include "media/base/media_switches.h" |
| 37 #include "net/test/embedded_test_server/embedded_test_server.h" | 37 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 38 #include "net/test/embedded_test_server/http_request.h" | 38 #include "net/test/embedded_test_server/http_request.h" |
| 39 #include "net/test/embedded_test_server/http_response.h" | 39 #include "net/test/embedded_test_server/http_response.h" |
| 40 #include "ui/gfx/switches.h" |
| 40 #include "ui/gl/gl_switches.h" | 41 #include "ui/gl/gl_switches.h" |
| 41 | 42 |
| 42 #if defined(OS_CHROMEOS) | 43 #if defined(OS_CHROMEOS) |
| 43 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 44 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 44 #include "chrome/browser/chromeos/accessibility/speech_monitor.h" | 45 #include "chrome/browser/chromeos/accessibility/speech_monitor.h" |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 47 // For fine-grained suppression on flaky tests. | 48 // For fine-grained suppression on flaky tests. |
| 48 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
| 49 #include "base/win/windows_version.h" | 50 #include "base/win/windows_version.h" |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 | 765 |
| 765 scoped_ptr<content::FakeSpeechRecognitionManager> | 766 scoped_ptr<content::FakeSpeechRecognitionManager> |
| 766 fake_speech_recognition_manager_; | 767 fake_speech_recognition_manager_; |
| 767 | 768 |
| 768 TestGuestViewManagerFactory factory_; | 769 TestGuestViewManagerFactory factory_; |
| 769 // Note that these are only set if you launch app using LoadAppWithGuest(). | 770 // Note that these are only set if you launch app using LoadAppWithGuest(). |
| 770 content::WebContents* guest_web_contents_; | 771 content::WebContents* guest_web_contents_; |
| 771 content::WebContents* embedder_web_contents_; | 772 content::WebContents* embedder_web_contents_; |
| 772 }; | 773 }; |
| 773 | 774 |
| 775 class WebViewDPITest : public WebViewTest { |
| 776 protected: |
| 777 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 778 WebViewTest::SetUpCommandLine(command_line); |
| 779 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, |
| 780 base::StringPrintf("%f", scale())); |
| 781 } |
| 782 |
| 783 static float scale() { return 2.0f; } |
| 784 }; |
| 785 |
| 774 // This test verifies that hiding the guest triggers WebContents::WasHidden(). | 786 // This test verifies that hiding the guest triggers WebContents::WasHidden(). |
| 775 IN_PROC_BROWSER_TEST_F(WebViewTest, GuestVisibilityChanged) { | 787 IN_PROC_BROWSER_TEST_F(WebViewTest, GuestVisibilityChanged) { |
| 776 LoadAppWithGuest("web_view/visibility_changed"); | 788 LoadAppWithGuest("web_view/visibility_changed"); |
| 777 | 789 |
| 778 scoped_refptr<content::MessageLoopRunner> loop_runner( | 790 scoped_refptr<content::MessageLoopRunner> loop_runner( |
| 779 new content::MessageLoopRunner); | 791 new content::MessageLoopRunner); |
| 780 WebContentsHiddenObserver observer(GetGuestWebContents(), | 792 WebContentsHiddenObserver observer(GetGuestWebContents(), |
| 781 loop_runner->QuitClosure()); | 793 loop_runner->QuitClosure()); |
| 782 | 794 |
| 783 // Handled in platform_apps/web_view/visibility_changed/main.js | 795 // Handled in platform_apps/web_view/visibility_changed/main.js |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 SendMessageToEmbedder("show-guest"); | 899 SendMessageToEmbedder("show-guest"); |
| 888 GetGuestViewManager()->WaitForGuestCreated(); | 900 GetGuestViewManager()->WaitForGuestCreated(); |
| 889 EXPECT_TRUE(test_passed_listener.WaitUntilSatisfied()); | 901 EXPECT_TRUE(test_passed_listener.WaitUntilSatisfied()); |
| 890 } | 902 } |
| 891 | 903 |
| 892 // http://crbug.com/326332 | 904 // http://crbug.com/326332 |
| 893 IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_Shim_TestAutosizeAfterNavigation) { | 905 IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_Shim_TestAutosizeAfterNavigation) { |
| 894 TestHelper("testAutosizeAfterNavigation", "web_view/shim", NO_TEST_SERVER); | 906 TestHelper("testAutosizeAfterNavigation", "web_view/shim", NO_TEST_SERVER); |
| 895 } | 907 } |
| 896 | 908 |
| 909 IN_PROC_BROWSER_TEST_F(WebViewDPITest, Shim_TestAutosizeHeight) { |
| 910 TestHelper("testAutosizeHeight", "web_view/shim", NO_TEST_SERVER); |
| 911 } |
| 912 |
| 897 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeHeight) { | 913 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeHeight) { |
| 898 TestHelper("testAutosizeHeight", "web_view/shim", NO_TEST_SERVER); | 914 TestHelper("testAutosizeHeight", "web_view/shim", NO_TEST_SERVER); |
| 899 } | 915 } |
| 900 | 916 |
| 917 IN_PROC_BROWSER_TEST_F(WebViewDPITest, Shim_TestAutosizeBeforeNavigation) { |
| 918 TestHelper("testAutosizeBeforeNavigation", "web_view/shim", NO_TEST_SERVER); |
| 919 } |
| 920 |
| 901 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) { | 921 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) { |
| 902 TestHelper("testAutosizeBeforeNavigation", "web_view/shim", NO_TEST_SERVER); | 922 TestHelper("testAutosizeBeforeNavigation", "web_view/shim", NO_TEST_SERVER); |
| 903 } | 923 } |
| 924 |
| 925 IN_PROC_BROWSER_TEST_F(WebViewDPITest, Shim_TestAutosizeRemoveAttributes) { |
| 926 TestHelper("testAutosizeRemoveAttributes", "web_view/shim", NO_TEST_SERVER); |
| 927 } |
| 928 |
| 904 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeRemoveAttributes) { | 929 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeRemoveAttributes) { |
| 905 TestHelper("testAutosizeRemoveAttributes", "web_view/shim", NO_TEST_SERVER); | 930 TestHelper("testAutosizeRemoveAttributes", "web_view/shim", NO_TEST_SERVER); |
| 906 } | 931 } |
| 907 | 932 |
| 908 // This test is disabled due to being flaky. http://crbug.com/282116 | 933 // This test is disabled due to being flaky. http://crbug.com/282116 |
| 909 #if defined(OS_WIN) || defined(OS_MACOSX) | 934 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 910 #define MAYBE_Shim_TestAutosizeWithPartialAttributes \ | 935 #define MAYBE_Shim_TestAutosizeWithPartialAttributes \ |
| 911 DISABLED_Shim_TestAutosizeWithPartialAttributes | 936 DISABLED_Shim_TestAutosizeWithPartialAttributes |
| 912 #else | 937 #else |
| 913 #define MAYBE_Shim_TestAutosizeWithPartialAttributes \ | 938 #define MAYBE_Shim_TestAutosizeWithPartialAttributes \ |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2309 // http://crbug.com/403325 | 2334 // http://crbug.com/403325 |
| 2310 #define MAYBE_WebViewInBackgroundPage \ | 2335 #define MAYBE_WebViewInBackgroundPage \ |
| 2311 DISABLED_WebViewInBackgroundPage | 2336 DISABLED_WebViewInBackgroundPage |
| 2312 #else | 2337 #else |
| 2313 #define MAYBE_WebViewInBackgroundPage WebViewInBackgroundPage | 2338 #define MAYBE_WebViewInBackgroundPage WebViewInBackgroundPage |
| 2314 #endif | 2339 #endif |
| 2315 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_WebViewInBackgroundPage) { | 2340 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_WebViewInBackgroundPage) { |
| 2316 ASSERT_TRUE(RunExtensionTest("platform_apps/web_view/background")) | 2341 ASSERT_TRUE(RunExtensionTest("platform_apps/web_view/background")) |
| 2317 << message_; | 2342 << message_; |
| 2318 } | 2343 } |
| OLD | NEW |