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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 virtual void SetUpOnMainThread() OVERRIDE { | 251 virtual void SetUpOnMainThread() OVERRIDE { |
253 const testing::TestInfo* const test_info = | 252 const testing::TestInfo* const test_info = |
254 testing::UnitTest::GetInstance()->current_test_info(); | 253 testing::UnitTest::GetInstance()->current_test_info(); |
255 // Mock out geolocation for geolocation specific tests. | 254 // Mock out geolocation for geolocation specific tests. |
256 if (!strncmp(test_info->name(), "GeolocationAPI", | 255 if (!strncmp(test_info->name(), "GeolocationAPI", |
257 strlen("GeolocationAPI"))) { | 256 strlen("GeolocationAPI"))) { |
258 ui_test_utils::OverrideGeolocation(10, 20); | 257 ui_test_utils::OverrideGeolocation(10, 20); |
259 } | 258 } |
260 } | 259 } |
261 | 260 |
262 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
263 const testing::TestInfo* const test_info = | |
264 testing::UnitTest::GetInstance()->current_test_info(); | |
265 | |
266 // Force SW rendering to check autosize bug. | |
267 if (!strncmp(test_info->name(), "AutoSizeSW", strlen("AutosizeSW"))) | |
268 command_line->AppendSwitch(switches::kDisableForceCompositingMode); | |
269 | |
270 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); | |
271 } | |
272 | |
273 // This method is responsible for initializing a packaged app, which contains | 261 // This method is responsible for initializing a packaged app, which contains |
274 // multiple webview tags. The tags have different partition identifiers and | 262 // multiple webview tags. The tags have different partition identifiers and |
275 // their WebContent objects are returned as output. The method also verifies | 263 // their WebContent objects are returned as output. The method also verifies |
276 // the expected process allocation and storage partition assignment. | 264 // the expected process allocation and storage partition assignment. |
277 // The |navigate_to_url| parameter is used to navigate the main browser | 265 // The |navigate_to_url| parameter is used to navigate the main browser |
278 // window. | 266 // window. |
279 // | 267 // |
280 // TODO(ajwong): This function is getting to be too large. Either refactor it | 268 // TODO(ajwong): This function is getting to be too large. Either refactor it |
281 // so the test can specify a configuration of WebView tags that we will | 269 // so the test can specify a configuration of WebView tags that we will |
282 // dynamically inject JS to generate, or move this test wholesale into | 270 // dynamically inject JS to generate, or move this test wholesale into |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 560 |
573 // This test ensures JavaScript errors ("Cannot redefine property") do not | 561 // This test ensures JavaScript errors ("Cannot redefine property") do not |
574 // happen when a <webview> is removed from DOM and added back. | 562 // happen when a <webview> is removed from DOM and added back. |
575 IN_PROC_BROWSER_TEST_F(WebViewTest, | 563 IN_PROC_BROWSER_TEST_F(WebViewTest, |
576 AddRemoveWebView_AddRemoveWebView) { | 564 AddRemoveWebView_AddRemoveWebView) { |
577 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | 565 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. |
578 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/addremove")) | 566 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/addremove")) |
579 << message_; | 567 << message_; |
580 } | 568 } |
581 | 569 |
582 IN_PROC_BROWSER_TEST_F(WebViewTest, AutoSize) { | |
583 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/autosize")) | |
584 << message_; | |
585 } | |
586 | |
587 #if !defined(OS_CHROMEOS) | |
588 // This test ensures <webview> doesn't crash in SW rendering when autosize is | |
589 // turned on. | |
590 IN_PROC_BROWSER_TEST_F(WebViewTest, AutoSizeSW) { | |
591 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/autosize")) | |
592 << message_; | |
593 } | |
594 #endif | |
595 | |
596 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeAfterNavigation) { | 570 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeAfterNavigation) { |
597 TestHelper("testAutosizeAfterNavigation", | 571 TestHelper("testAutosizeAfterNavigation", |
598 "DoneShimTest.PASSED", | 572 "DoneShimTest.PASSED", |
599 "DoneShimTest.FAILED", | 573 "DoneShimTest.FAILED", |
600 "web_view/shim"); | 574 "web_view/shim"); |
601 } | 575 } |
602 | 576 |
603 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) { | 577 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) { |
604 TestHelper("testAutosizeBeforeNavigation", | 578 TestHelper("testAutosizeBeforeNavigation", |
605 "DoneShimTest.PASSED", | 579 "DoneShimTest.PASSED", |
606 "DoneShimTest.FAILED", | 580 "DoneShimTest.FAILED", |
607 "web_view/shim"); | 581 "web_view/shim"); |
608 } | 582 } |
609 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeRemoveAttributes) { | 583 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeRemoveAttributes) { |
610 TestHelper("testAutosizeRemoveAttributes", | 584 TestHelper("testAutosizeRemoveAttributes", |
611 "DoneShimTest.PASSED", | 585 "DoneShimTest.PASSED", |
612 "DoneShimTest.FAILED", | 586 "DoneShimTest.FAILED", |
613 "web_view/shim"); | 587 "web_view/shim"); |
614 } | 588 } |
615 | 589 |
| 590 // This test is flaky. crbug.com/282116 |
616 IN_PROC_BROWSER_TEST_F(WebViewTest, | 591 IN_PROC_BROWSER_TEST_F(WebViewTest, |
617 Shim_TestAutosizeWithPartialAttributes) { | 592 DISABLED_Shim_TestAutosizeWithPartialAttributes) { |
618 TestHelper("testAutosizeWithPartialAttributes", | 593 TestHelper("testAutosizeWithPartialAttributes", |
619 "DoneShimTest.PASSED", | 594 "DoneShimTest.PASSED", |
620 "DoneShimTest.FAILED", | 595 "DoneShimTest.FAILED", |
621 "web_view/shim"); | 596 "web_view/shim"); |
622 } | 597 } |
623 | 598 |
624 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAPIMethodExistence) { | 599 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAPIMethodExistence) { |
625 TestHelper("testAPIMethodExistence", | 600 TestHelper("testAPIMethodExistence", |
626 "DoneShimTest.PASSED", | 601 "DoneShimTest.PASSED", |
627 "DoneShimTest.FAILED", | 602 "DoneShimTest.FAILED", |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 "DoneDialogTest.FAILED", | 1668 "DoneDialogTest.FAILED", |
1694 "web_view/dialog"); | 1669 "web_view/dialog"); |
1695 } | 1670 } |
1696 | 1671 |
1697 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) { | 1672 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) { |
1698 TestHelper("testPromptDialog", | 1673 TestHelper("testPromptDialog", |
1699 "DoneDialogTest.PASSED", | 1674 "DoneDialogTest.PASSED", |
1700 "DoneDialogTest.FAILED", | 1675 "DoneDialogTest.FAILED", |
1701 "web_view/dialog"); | 1676 "web_view/dialog"); |
1702 } | 1677 } |
OLD | NEW |