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