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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 virtual void SetUpOnMainThread() OVERRIDE { | 249 virtual void SetUpOnMainThread() OVERRIDE { |
249 const testing::TestInfo* const test_info = | 250 const testing::TestInfo* const test_info = |
250 testing::UnitTest::GetInstance()->current_test_info(); | 251 testing::UnitTest::GetInstance()->current_test_info(); |
251 // Mock out geolocation for geolocation specific tests. | 252 // Mock out geolocation for geolocation specific tests. |
252 if (!strncmp(test_info->name(), "GeolocationAPI", | 253 if (!strncmp(test_info->name(), "GeolocationAPI", |
253 strlen("GeolocationAPI"))) { | 254 strlen("GeolocationAPI"))) { |
254 ui_test_utils::OverrideGeolocation(10, 20); | 255 ui_test_utils::OverrideGeolocation(10, 20); |
255 } | 256 } |
256 } | 257 } |
257 | 258 |
| 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 |
258 // This method is responsible for initializing a packaged app, which contains | 270 // This method is responsible for initializing a packaged app, which contains |
259 // multiple webview tags. The tags have different partition identifiers and | 271 // multiple webview tags. The tags have different partition identifiers and |
260 // their WebContent objects are returned as output. The method also verifies | 272 // their WebContent objects are returned as output. The method also verifies |
261 // the expected process allocation and storage partition assignment. | 273 // the expected process allocation and storage partition assignment. |
262 // The |navigate_to_url| parameter is used to navigate the main browser | 274 // The |navigate_to_url| parameter is used to navigate the main browser |
263 // window. | 275 // window. |
264 // | 276 // |
265 // TODO(ajwong): This function is getting to be too large. Either refactor it | 277 // TODO(ajwong): This function is getting to be too large. Either refactor it |
266 // so the test can specify a configuration of WebView tags that we will | 278 // so the test can specify a configuration of WebView tags that we will |
267 // dynamically inject JS to generate, or move this test wholesale into | 279 // dynamically inject JS to generate, or move this test wholesale into |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 569 |
558 // This test ensures JavaScript errors ("Cannot redefine property") do not | 570 // This test ensures JavaScript errors ("Cannot redefine property") do not |
559 // happen when a <webview> is removed from DOM and added back. | 571 // happen when a <webview> is removed from DOM and added back. |
560 IN_PROC_BROWSER_TEST_F(WebViewTest, | 572 IN_PROC_BROWSER_TEST_F(WebViewTest, |
561 AddRemoveWebView_AddRemoveWebView) { | 573 AddRemoveWebView_AddRemoveWebView) { |
562 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | 574 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. |
563 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/addremove")) | 575 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/addremove")) |
564 << message_; | 576 << message_; |
565 } | 577 } |
566 | 578 |
| 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 |
567 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeAfterNavigation) { | 593 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeAfterNavigation) { |
568 TestHelper("testAutosizeAfterNavigation", | 594 TestHelper("testAutosizeAfterNavigation", |
569 "DoneShimTest.PASSED", | 595 "DoneShimTest.PASSED", |
570 "DoneShimTest.FAILED", | 596 "DoneShimTest.FAILED", |
571 "web_view/shim"); | 597 "web_view/shim"); |
572 } | 598 } |
573 | 599 |
574 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) { | 600 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) { |
575 TestHelper("testAutosizeBeforeNavigation", | 601 TestHelper("testAutosizeBeforeNavigation", |
576 "DoneShimTest.PASSED", | 602 "DoneShimTest.PASSED", |
577 "DoneShimTest.FAILED", | 603 "DoneShimTest.FAILED", |
578 "web_view/shim"); | 604 "web_view/shim"); |
579 } | 605 } |
580 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeRemoveAttributes) { | 606 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeRemoveAttributes) { |
581 TestHelper("testAutosizeRemoveAttributes", | 607 TestHelper("testAutosizeRemoveAttributes", |
582 "DoneShimTest.PASSED", | 608 "DoneShimTest.PASSED", |
583 "DoneShimTest.FAILED", | 609 "DoneShimTest.FAILED", |
584 "web_view/shim"); | 610 "web_view/shim"); |
585 } | 611 } |
586 | 612 |
587 // This test is flaky. crbug.com/282116 | |
588 IN_PROC_BROWSER_TEST_F(WebViewTest, | 613 IN_PROC_BROWSER_TEST_F(WebViewTest, |
589 DISABLED_Shim_TestAutosizeWithPartialAttributes) { | 614 Shim_TestAutosizeWithPartialAttributes) { |
590 TestHelper("testAutosizeWithPartialAttributes", | 615 TestHelper("testAutosizeWithPartialAttributes", |
591 "DoneShimTest.PASSED", | 616 "DoneShimTest.PASSED", |
592 "DoneShimTest.FAILED", | 617 "DoneShimTest.FAILED", |
593 "web_view/shim"); | 618 "web_view/shim"); |
594 } | 619 } |
595 | 620 |
596 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAPIMethodExistence) { | 621 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAPIMethodExistence) { |
597 TestHelper("testAPIMethodExistence", | 622 TestHelper("testAPIMethodExistence", |
598 "DoneShimTest.PASSED", | 623 "DoneShimTest.PASSED", |
599 "DoneShimTest.FAILED", | 624 "DoneShimTest.FAILED", |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 "DoneDialogTest.FAILED", | 1677 "DoneDialogTest.FAILED", |
1653 "web_view/dialog"); | 1678 "web_view/dialog"); |
1654 } | 1679 } |
1655 | 1680 |
1656 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) { | 1681 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) { |
1657 TestHelper("testPromptDialog", | 1682 TestHelper("testPromptDialog", |
1658 "DoneDialogTest.PASSED", | 1683 "DoneDialogTest.PASSED", |
1659 "DoneDialogTest.FAILED", | 1684 "DoneDialogTest.FAILED", |
1660 "web_view/dialog"); | 1685 "web_view/dialog"); |
1661 } | 1686 } |
OLD | NEW |