OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 | 826 |
827 // Reload the page, and check that we get a "before reload" dialog. | 827 // Reload the page, and check that we get a "before reload" dialog. |
828 chrome::Reload(browser(), CURRENT_TAB); | 828 chrome::Reload(browser(), CURRENT_TAB); |
829 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 829 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
830 EXPECT_TRUE(static_cast<JavaScriptAppModalDialog*>(alert)->is_reload()); | 830 EXPECT_TRUE(static_cast<JavaScriptAppModalDialog*>(alert)->is_reload()); |
831 | 831 |
832 // Cancel the reload. | 832 // Cancel the reload. |
833 alert->native_dialog()->CancelAppModalDialog(); | 833 alert->native_dialog()->CancelAppModalDialog(); |
834 | 834 |
835 // Navigate to another url, and check that we get a "before unload" dialog. | 835 // Navigate to another url, and check that we get a "before unload" dialog. |
836 GURL url2(std::string("about:blank")); | 836 GURL url2(url::kAboutBlankURL); |
837 browser()->OpenURL(OpenURLParams( | 837 browser()->OpenURL(OpenURLParams( |
838 url2, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); | 838 url2, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); |
839 | 839 |
840 alert = ui_test_utils::WaitForAppModalDialog(); | 840 alert = ui_test_utils::WaitForAppModalDialog(); |
841 EXPECT_FALSE(static_cast<JavaScriptAppModalDialog*>(alert)->is_reload()); | 841 EXPECT_FALSE(static_cast<JavaScriptAppModalDialog*>(alert)->is_reload()); |
842 | 842 |
843 // Accept the navigation so we end up on a page without a beforeunload hook. | 843 // Accept the navigation so we end up on a page without a beforeunload hook. |
844 alert->native_dialog()->AcceptAppModalDialog(); | 844 alert->native_dialog()->AcceptAppModalDialog(); |
845 } | 845 } |
846 | 846 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 IN_PROC_BROWSER_TEST_F(BeforeUnloadAtQuitWithTwoWindows, | 887 IN_PROC_BROWSER_TEST_F(BeforeUnloadAtQuitWithTwoWindows, |
888 DISABLED_IfThisTestTimesOutItIndicatesFAILURE) { | 888 DISABLED_IfThisTestTimesOutItIndicatesFAILURE) { |
889 // In the first browser, set up a page that has a beforeunload handler. | 889 // In the first browser, set up a page that has a beforeunload handler. |
890 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); | 890 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); |
891 ui_test_utils::NavigateToURL(browser(), url); | 891 ui_test_utils::NavigateToURL(browser(), url); |
892 | 892 |
893 // Open a second browser window at about:blank. | 893 // Open a second browser window at about:blank. |
894 ui_test_utils::BrowserAddedObserver browser_added_observer; | 894 ui_test_utils::BrowserAddedObserver browser_added_observer; |
895 chrome::NewEmptyWindow(browser()->profile(), chrome::GetActiveDesktop()); | 895 chrome::NewEmptyWindow(browser()->profile(), chrome::GetActiveDesktop()); |
896 Browser* second_window = browser_added_observer.WaitForSingleNewBrowser(); | 896 Browser* second_window = browser_added_observer.WaitForSingleNewBrowser(); |
897 ui_test_utils::NavigateToURL(second_window, GURL("about:blank")); | 897 ui_test_utils::NavigateToURL(second_window, GURL(url::kAboutBlankURL)); |
898 | 898 |
899 // Tell the application to quit. IDC_EXIT calls AttemptUserExit, which on | 899 // Tell the application to quit. IDC_EXIT calls AttemptUserExit, which on |
900 // everything but ChromeOS allows unload handlers to block exit. On that | 900 // everything but ChromeOS allows unload handlers to block exit. On that |
901 // platform, though, it exits unconditionally. See the comment and bug ID | 901 // platform, though, it exits unconditionally. See the comment and bug ID |
902 // in AttemptUserExit() in application_lifetime.cc. | 902 // in AttemptUserExit() in application_lifetime.cc. |
903 #if defined(OS_CHROMEOS) | 903 #if defined(OS_CHROMEOS) |
904 chrome::AttemptExit(); | 904 chrome::AttemptExit(); |
905 #else | 905 #else |
906 chrome::ExecuteCommand(second_window, IDC_EXIT); | 906 chrome::ExecuteCommand(second_window, IDC_EXIT); |
907 #endif | 907 #endif |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 app_browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)); | 1402 app_browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)); |
1403 } | 1403 } |
1404 #endif | 1404 #endif |
1405 | 1405 |
1406 // Tests that the CLD (Compact Language Detection) works properly. | 1406 // Tests that the CLD (Compact Language Detection) works properly. |
1407 IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) { | 1407 IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) { |
1408 test::ScopedCLDDynamicDataHarness dynamic_data_scope; | 1408 test::ScopedCLDDynamicDataHarness dynamic_data_scope; |
1409 ASSERT_NO_FATAL_FAILURE(dynamic_data_scope.Init()); | 1409 ASSERT_NO_FATAL_FAILURE(dynamic_data_scope.Init()); |
1410 ASSERT_TRUE(test_server()->Start()); | 1410 ASSERT_TRUE(test_server()->Start()); |
1411 | 1411 |
1412 //std::string lang; | |
1413 LanguageDetectionDetails details; | 1412 LanguageDetectionDetails details; |
1414 | 1413 |
1415 // Open a new tab with a page in English. | 1414 // Open a new tab with a page in English. |
1416 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")), | 1415 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")), |
1417 content::PAGE_TRANSITION_TYPED); | 1416 content::PAGE_TRANSITION_TYPED); |
1418 | 1417 |
1419 WebContents* current_web_contents = | 1418 WebContents* current_web_contents = |
1420 browser()->tab_strip_model()->GetActiveWebContents(); | 1419 browser()->tab_strip_model()->GetActiveWebContents(); |
1421 ChromeTranslateClient* chrome_translate_client = | 1420 ChromeTranslateClient* chrome_translate_client = |
1422 ChromeTranslateClient::FromWebContents(current_web_contents); | 1421 ChromeTranslateClient::FromWebContents(current_web_contents); |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2127 GURL url = ui_test_utils::GetTestUrl( | 2126 GURL url = ui_test_utils::GetTestUrl( |
2128 base::FilePath(), base::FilePath().AppendASCII("window.close.html")); | 2127 base::FilePath(), base::FilePath().AppendASCII("window.close.html")); |
2129 | 2128 |
2130 base::string16 title = ASCIIToUTF16("Title Of Awesomeness"); | 2129 base::string16 title = ASCIIToUTF16("Title Of Awesomeness"); |
2131 content::TitleWatcher title_watcher( | 2130 content::TitleWatcher title_watcher( |
2132 browser()->tab_strip_model()->GetActiveWebContents(), title); | 2131 browser()->tab_strip_model()->GetActiveWebContents(), title); |
2133 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2); | 2132 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2); |
2134 EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); | 2133 EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); |
2135 } | 2134 } |
2136 | 2135 |
2137 // GTK doesn't use the Browser's fullscreen state. | |
2138 // TODO(linux_aura) http://crbug.com/163931 | 2136 // TODO(linux_aura) http://crbug.com/163931 |
2139 // Mac disabled: http://crbug.com/169820 | 2137 // Mac disabled: http://crbug.com/169820 |
2140 #if !defined(TOOLKIT_GTK) && !defined(OS_MACOSX) && \ | 2138 #if !defined(OS_MACOSX) && \ |
2141 !(defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)) | 2139 !(defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)) |
2142 IN_PROC_BROWSER_TEST_F(BrowserTest, FullscreenBookmarkBar) { | 2140 IN_PROC_BROWSER_TEST_F(BrowserTest, FullscreenBookmarkBar) { |
2143 #if defined(OS_WIN) && defined(USE_ASH) | 2141 #if defined(OS_WIN) && defined(USE_ASH) |
2144 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 2142 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
2145 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 2143 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
2146 return; | 2144 return; |
2147 #endif | 2145 #endif |
2148 | 2146 |
2149 chrome::ToggleBookmarkBar(browser()); | 2147 chrome::ToggleBookmarkBar(browser()); |
2150 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); | 2148 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); |
(...skipping 26 matching lines...) Expand all Loading... |
2177 | 2175 |
2178 class KioskModeTest : public BrowserTest { | 2176 class KioskModeTest : public BrowserTest { |
2179 public: | 2177 public: |
2180 KioskModeTest() {} | 2178 KioskModeTest() {} |
2181 | 2179 |
2182 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 2180 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
2183 command_line->AppendSwitch(switches::kKioskMode); | 2181 command_line->AppendSwitch(switches::kKioskMode); |
2184 } | 2182 } |
2185 }; | 2183 }; |
2186 | 2184 |
2187 #if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined
(USE_AURA)) | 2185 #if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
2188 // http://crbug.com/103912 | 2186 // Mac: http://crbug.com/103912 |
2189 // TODO(linux_aura) http://crbug.com/163931 | 2187 // Linux: http://crbug.com/163931 |
2190 #define MAYBE_EnableKioskModeTest DISABLED_EnableKioskModeTest | 2188 #define MAYBE_EnableKioskModeTest DISABLED_EnableKioskModeTest |
2191 #else | 2189 #else |
2192 #define MAYBE_EnableKioskModeTest EnableKioskModeTest | 2190 #define MAYBE_EnableKioskModeTest EnableKioskModeTest |
2193 #endif | 2191 #endif |
2194 IN_PROC_BROWSER_TEST_F(KioskModeTest, MAYBE_EnableKioskModeTest) { | 2192 IN_PROC_BROWSER_TEST_F(KioskModeTest, MAYBE_EnableKioskModeTest) { |
2195 // Check if browser is in fullscreen mode. | 2193 // Check if browser is in fullscreen mode. |
2196 ASSERT_TRUE(browser()->window()->IsFullscreen()); | 2194 ASSERT_TRUE(browser()->window()->IsFullscreen()); |
2197 ASSERT_FALSE(browser()->window()->IsFullscreenBubbleVisible()); | 2195 ASSERT_FALSE(browser()->window()->IsFullscreenBubbleVisible()); |
2198 } | 2196 } |
2199 | 2197 |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2690 #endif | 2688 #endif |
2691 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2689 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
2692 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2690 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
2693 gfx::Size exp_final_size(initial_wcv_size); | 2691 gfx::Size exp_final_size(initial_wcv_size); |
2694 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2692 exp_final_size.Enlarge(wcv_resize_insets.width(), |
2695 wcv_resize_insets.height() + height_inset); | 2693 wcv_resize_insets.height() + height_inset); |
2696 EXPECT_EQ(exp_final_size, | 2694 EXPECT_EQ(exp_final_size, |
2697 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2695 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
2698 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); | 2696 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); |
2699 } | 2697 } |
OLD | NEW |