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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 base::Closure()); | 560 base::Closure()); |
549 if (!content::InterstitialPage::GetInterstitialPage(web_contents)) | 561 if (!content::InterstitialPage::GetInterstitialPage(web_contents)) |
550 loop_runner->Run(); | 562 loop_runner->Run(); |
551 } | 563 } |
552 | 564 |
553 private: | 565 private: |
554 scoped_ptr<content::FakeSpeechRecognitionManager> | 566 scoped_ptr<content::FakeSpeechRecognitionManager> |
555 fake_speech_recognition_manager_; | 567 fake_speech_recognition_manager_; |
556 }; | 568 }; |
557 | 569 |
| 570 IN_PROC_BROWSER_TEST_F(WebViewTest, AutoSize) { |
| 571 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/autosize")) |
| 572 << message_; |
| 573 } |
| 574 |
| 575 #if !defined(OS_CHROMEOS) |
| 576 // This test ensures <webview> doesn't crash in SW rendering when autosize is |
| 577 // turned on. |
| 578 IN_PROC_BROWSER_TEST_F(WebViewTest, AutoSizeSW) { |
| 579 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/autosize")) |
| 580 << message_; |
| 581 } |
| 582 #endif |
| 583 |
| 584 |
558 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeAfterNavigation) { | 585 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeAfterNavigation) { |
559 TestHelper("testAutosizeAfterNavigation", | 586 TestHelper("testAutosizeAfterNavigation", |
560 "DoneShimTest.PASSED", | 587 "DoneShimTest.PASSED", |
561 "DoneShimTest.FAILED", | 588 "DoneShimTest.FAILED", |
562 "web_view/shim"); | 589 "web_view/shim"); |
563 } | 590 } |
564 | 591 |
565 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) { | 592 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) { |
566 TestHelper("testAutosizeBeforeNavigation", | 593 TestHelper("testAutosizeBeforeNavigation", |
567 "DoneShimTest.PASSED", | 594 "DoneShimTest.PASSED", |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 "DoneDialogTest.FAILED", | 1639 "DoneDialogTest.FAILED", |
1613 "web_view/dialog"); | 1640 "web_view/dialog"); |
1614 } | 1641 } |
1615 | 1642 |
1616 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) { | 1643 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) { |
1617 TestHelper("testPromptDialog", | 1644 TestHelper("testPromptDialog", |
1618 "DoneDialogTest.PASSED", | 1645 "DoneDialogTest.PASSED", |
1619 "DoneDialogTest.FAILED", | 1646 "DoneDialogTest.FAILED", |
1620 "web_view/dialog"); | 1647 "web_view/dialog"); |
1621 } | 1648 } |
OLD | NEW |