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/native_app_window.h" | 5 #include "apps/native_app_window.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/automation/automation_util.h" | 9 #include "chrome/browser/automation/automation_util.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
11 #include "chrome/browser/prerender/prerender_link_manager.h" | 11 #include "chrome/browser/prerender/prerender_link_manager.h" |
12 #include "chrome/browser/prerender/prerender_link_manager_factory.h" | 12 #include "chrome/browser/prerender/prerender_link_manager_factory.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
18 #include "content/public/browser/interstitial_page.h" | 18 #include "content/public/browser/interstitial_page.h" |
19 #include "content/public/browser/interstitial_page_delegate.h" | 19 #include "content/public/browser/interstitial_page_delegate.h" |
20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
21 #include "content/public/browser/render_process_host.h" | 21 #include "content/public/browser/render_process_host.h" |
22 #include "content/public/browser/web_contents_delegate.h" | 22 #include "content/public/browser/web_contents_delegate.h" |
23 #include "content/public/common/content_switches.h" | |
24 #include "content/public/test/browser_test_utils.h" | 23 #include "content/public/test/browser_test_utils.h" |
25 #include "content/public/test/fake_speech_recognition_manager.h" | 24 #include "content/public/test/fake_speech_recognition_manager.h" |
26 #include "net/test/embedded_test_server/embedded_test_server.h" | 25 #include "net/test/embedded_test_server/embedded_test_server.h" |
27 #include "net/test/embedded_test_server/http_request.h" | 26 #include "net/test/embedded_test_server/http_request.h" |
28 #include "net/test/embedded_test_server/http_response.h" | 27 #include "net/test/embedded_test_server/http_response.h" |
29 #include "ui/gl/gl_switches.h" | 28 #include "ui/gl/gl_switches.h" |
30 | 29 |
31 // For fine-grained suppression on flaky tests. | 30 // For fine-grained suppression on flaky tests. |
32 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
33 #include "base/win/windows_version.h" | 32 #include "base/win/windows_version.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 virtual void SetUpOnMainThread() OVERRIDE { | 248 virtual void SetUpOnMainThread() OVERRIDE { |
250 const testing::TestInfo* const test_info = | 249 const testing::TestInfo* const test_info = |
251 testing::UnitTest::GetInstance()->current_test_info(); | 250 testing::UnitTest::GetInstance()->current_test_info(); |
252 // Mock out geolocation for geolocation specific tests. | 251 // Mock out geolocation for geolocation specific tests. |
253 if (!strncmp(test_info->name(), "GeolocationAPI", | 252 if (!strncmp(test_info->name(), "GeolocationAPI", |
254 strlen("GeolocationAPI"))) { | 253 strlen("GeolocationAPI"))) { |
255 ui_test_utils::OverrideGeolocation(10, 20); | 254 ui_test_utils::OverrideGeolocation(10, 20); |
256 } | 255 } |
257 } | 256 } |
258 | 257 |
259 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
260 const testing::TestInfo* const test_info = | |
261 testing::UnitTest::GetInstance()->current_test_info(); | |
262 | |
263 // Force SW rendering to check autosize bug. | |
264 if (!strncmp(test_info->name(), "AutoSizeSW", strlen("AutosizeSW"))) | |
265 command_line->AppendSwitch(switches::kDisableForceCompositingMode); | |
266 | |
267 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); | |
268 } | |
269 | |
270 // This method is responsible for initializing a packaged app, which contains | 258 // This method is responsible for initializing a packaged app, which contains |
271 // multiple webview tags. The tags have different partition identifiers and | 259 // multiple webview tags. The tags have different partition identifiers and |
272 // their WebContent objects are returned as output. The method also verifies | 260 // their WebContent objects are returned as output. The method also verifies |
273 // the expected process allocation and storage partition assignment. | 261 // the expected process allocation and storage partition assignment. |
274 // The |navigate_to_url| parameter is used to navigate the main browser | 262 // The |navigate_to_url| parameter is used to navigate the main browser |
275 // window. | 263 // window. |
276 // | 264 // |
277 // TODO(ajwong): This function is getting to be too large. Either refactor it | 265 // TODO(ajwong): This function is getting to be too large. Either refactor it |
278 // so the test can specify a configuration of WebView tags that we will | 266 // so the test can specify a configuration of WebView tags that we will |
279 // dynamically inject JS to generate, or move this test wholesale into | 267 // dynamically inject JS to generate, or move this test wholesale into |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 | 557 |
570 // This test ensures JavaScript errors ("Cannot redefine property") do not | 558 // This test ensures JavaScript errors ("Cannot redefine property") do not |
571 // happen when a <webview> is removed from DOM and added back. | 559 // happen when a <webview> is removed from DOM and added back. |
572 IN_PROC_BROWSER_TEST_F(WebViewTest, | 560 IN_PROC_BROWSER_TEST_F(WebViewTest, |
573 AddRemoveWebView_AddRemoveWebView) { | 561 AddRemoveWebView_AddRemoveWebView) { |
574 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | 562 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. |
575 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/addremove")) | 563 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/addremove")) |
576 << message_; | 564 << message_; |
577 } | 565 } |
578 | 566 |
579 IN_PROC_BROWSER_TEST_F(WebViewTest, AutoSize) { | |
580 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/autosize")) | |
581 << message_; | |
582 } | |
583 | |
584 #if !defined(OS_CHROMEOS) | |
585 // This test ensures <webview> doesn't crash in SW rendering when autosize is | |
586 // turned on. | |
587 IN_PROC_BROWSER_TEST_F(WebViewTest, AutoSizeSW) { | |
588 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/autosize")) | |
589 << message_; | |
590 } | |
591 #endif | |
592 | |
593 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeAfterNavigation) { | 567 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeAfterNavigation) { |
594 TestHelper("testAutosizeAfterNavigation", | 568 TestHelper("testAutosizeAfterNavigation", |
595 "DoneShimTest.PASSED", | 569 "DoneShimTest.PASSED", |
596 "DoneShimTest.FAILED", | 570 "DoneShimTest.FAILED", |
597 "web_view/shim"); | 571 "web_view/shim"); |
598 } | 572 } |
599 | 573 |
600 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) { | 574 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) { |
601 TestHelper("testAutosizeBeforeNavigation", | 575 TestHelper("testAutosizeBeforeNavigation", |
602 "DoneShimTest.PASSED", | 576 "DoneShimTest.PASSED", |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 "DoneDialogTest.FAILED", | 1652 "DoneDialogTest.FAILED", |
1679 "web_view/dialog"); | 1653 "web_view/dialog"); |
1680 } | 1654 } |
1681 | 1655 |
1682 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) { | 1656 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) { |
1683 TestHelper("testPromptDialog", | 1657 TestHelper("testPromptDialog", |
1684 "DoneDialogTest.PASSED", | 1658 "DoneDialogTest.PASSED", |
1685 "DoneDialogTest.FAILED", | 1659 "DoneDialogTest.FAILED", |
1686 "web_view/dialog"); | 1660 "web_view/dialog"); |
1687 } | 1661 } |
OLD | NEW |