Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Side by Side Diff: chrome/browser/ui/browser_browsertest.cc

Issue 326043002: Cleanup: Remove more dead GTK code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 825
826 // Reload the page, and check that we get a "before reload" dialog. 826 // Reload the page, and check that we get a "before reload" dialog.
827 chrome::Reload(browser(), CURRENT_TAB); 827 chrome::Reload(browser(), CURRENT_TAB);
828 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 828 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
829 EXPECT_TRUE(static_cast<JavaScriptAppModalDialog*>(alert)->is_reload()); 829 EXPECT_TRUE(static_cast<JavaScriptAppModalDialog*>(alert)->is_reload());
830 830
831 // Cancel the reload. 831 // Cancel the reload.
832 alert->native_dialog()->CancelAppModalDialog(); 832 alert->native_dialog()->CancelAppModalDialog();
833 833
834 // Navigate to another url, and check that we get a "before unload" dialog. 834 // Navigate to another url, and check that we get a "before unload" dialog.
835 GURL url2(std::string("about:blank")); 835 GURL url2(content::kAboutBlankURL);
836 browser()->OpenURL(OpenURLParams( 836 browser()->OpenURL(OpenURLParams(
837 url2, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); 837 url2, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
838 838
839 alert = ui_test_utils::WaitForAppModalDialog(); 839 alert = ui_test_utils::WaitForAppModalDialog();
840 EXPECT_FALSE(static_cast<JavaScriptAppModalDialog*>(alert)->is_reload()); 840 EXPECT_FALSE(static_cast<JavaScriptAppModalDialog*>(alert)->is_reload());
841 841
842 // Accept the navigation so we end up on a page without a beforeunload hook. 842 // Accept the navigation so we end up on a page without a beforeunload hook.
843 alert->native_dialog()->AcceptAppModalDialog(); 843 alert->native_dialog()->AcceptAppModalDialog();
844 } 844 }
845 845
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 IN_PROC_BROWSER_TEST_F(BeforeUnloadAtQuitWithTwoWindows, 886 IN_PROC_BROWSER_TEST_F(BeforeUnloadAtQuitWithTwoWindows,
887 DISABLED_IfThisTestTimesOutItIndicatesFAILURE) { 887 DISABLED_IfThisTestTimesOutItIndicatesFAILURE) {
888 // In the first browser, set up a page that has a beforeunload handler. 888 // In the first browser, set up a page that has a beforeunload handler.
889 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); 889 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML);
890 ui_test_utils::NavigateToURL(browser(), url); 890 ui_test_utils::NavigateToURL(browser(), url);
891 891
892 // Open a second browser window at about:blank. 892 // Open a second browser window at about:blank.
893 ui_test_utils::BrowserAddedObserver browser_added_observer; 893 ui_test_utils::BrowserAddedObserver browser_added_observer;
894 chrome::NewEmptyWindow(browser()->profile(), chrome::GetActiveDesktop()); 894 chrome::NewEmptyWindow(browser()->profile(), chrome::GetActiveDesktop());
895 Browser* second_window = browser_added_observer.WaitForSingleNewBrowser(); 895 Browser* second_window = browser_added_observer.WaitForSingleNewBrowser();
896 ui_test_utils::NavigateToURL(second_window, GURL("about:blank")); 896 ui_test_utils::NavigateToURL(second_window, GURL(content::kAboutBlankURL));
897 897
898 // Tell the application to quit. IDC_EXIT calls AttemptUserExit, which on 898 // Tell the application to quit. IDC_EXIT calls AttemptUserExit, which on
899 // everything but ChromeOS allows unload handlers to block exit. On that 899 // everything but ChromeOS allows unload handlers to block exit. On that
900 // platform, though, it exits unconditionally. See the comment and bug ID 900 // platform, though, it exits unconditionally. See the comment and bug ID
901 // in AttemptUserExit() in application_lifetime.cc. 901 // in AttemptUserExit() in application_lifetime.cc.
902 #if defined(OS_CHROMEOS) 902 #if defined(OS_CHROMEOS)
903 chrome::AttemptExit(); 903 chrome::AttemptExit();
904 #else 904 #else
905 chrome::ExecuteCommand(second_window, IDC_EXIT); 905 chrome::ExecuteCommand(second_window, IDC_EXIT);
906 #endif 906 #endif
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 1163 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
1164 1164
1165 GURL history_url(chrome::kChromeUIHistoryURL); 1165 GURL history_url(chrome::kChromeUIHistoryURL);
1166 ui_test_utils::NavigateToURL(browser(), history_url); 1166 ui_test_utils::NavigateToURL(browser(), history_url);
1167 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 1167 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
1168 1168
1169 GURL downloads_url(chrome::kChromeUIDownloadsURL); 1169 GURL downloads_url(chrome::kChromeUIDownloadsURL);
1170 ui_test_utils::NavigateToURL(browser(), downloads_url); 1170 ui_test_utils::NavigateToURL(browser(), downloads_url);
1171 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 1171 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
1172 1172
1173 GURL blank_url(content::kAboutBlankURL); 1173 GURL blank_url(std::string("about:blank"));
1174 ui_test_utils::NavigateToURL(browser(), blank_url); 1174 ui_test_utils::NavigateToURL(browser(), blank_url);
1175 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 1175 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
1176 } 1176 }
1177 1177
1178 // Change a tab into an application window. 1178 // Change a tab into an application window.
1179 // DISABLED: http://crbug.com/72310 1179 // DISABLED: http://crbug.com/72310
1180 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { 1180 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) {
1181 ASSERT_TRUE(test_server()->Start()); 1181 ASSERT_TRUE(test_server()->Start());
1182 GURL http_url(test_server()->GetURL(std::string())); 1182 GURL http_url(test_server()->GetURL(std::string()));
1183 ASSERT_TRUE(http_url.SchemeIs(url::kHttpScheme)); 1183 ASSERT_TRUE(http_url.SchemeIs(url::kHttpScheme));
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 app_browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)); 1401 app_browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR));
1402 } 1402 }
1403 #endif 1403 #endif
1404 1404
1405 // Tests that the CLD (Compact Language Detection) works properly. 1405 // Tests that the CLD (Compact Language Detection) works properly.
1406 IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) { 1406 IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) {
1407 test::ScopedCLDDynamicDataHarness dynamic_data_scope; 1407 test::ScopedCLDDynamicDataHarness dynamic_data_scope;
1408 ASSERT_NO_FATAL_FAILURE(dynamic_data_scope.Init()); 1408 ASSERT_NO_FATAL_FAILURE(dynamic_data_scope.Init());
1409 ASSERT_TRUE(test_server()->Start()); 1409 ASSERT_TRUE(test_server()->Start());
1410 1410
1411 //std::string lang;
1412 LanguageDetectionDetails details; 1411 LanguageDetectionDetails details;
1413 1412
1414 // Open a new tab with a page in English. 1413 // Open a new tab with a page in English.
1415 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")), 1414 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")),
1416 content::PAGE_TRANSITION_TYPED); 1415 content::PAGE_TRANSITION_TYPED);
1417 1416
1418 WebContents* current_web_contents = 1417 WebContents* current_web_contents =
1419 browser()->tab_strip_model()->GetActiveWebContents(); 1418 browser()->tab_strip_model()->GetActiveWebContents();
1420 ChromeTranslateClient* chrome_translate_client = 1419 ChromeTranslateClient* chrome_translate_client =
1421 ChromeTranslateClient::FromWebContents(current_web_contents); 1420 ChromeTranslateClient::FromWebContents(current_web_contents);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 model->AddWebContents(app_contents, 0, content::PageTransitionFromInt(0), 1476 model->AddWebContents(app_contents, 0, content::PageTransitionFromInt(0),
1478 TabStripModel::ADD_NONE); 1477 TabStripModel::ADD_NONE);
1479 model->SetTabPinned(0, true); 1478 model->SetTabPinned(0, true);
1480 ui_test_utils::NavigateToURL(browser(), url); 1479 ui_test_utils::NavigateToURL(browser(), url);
1481 1480
1482 // Add a non pinned tab. 1481 // Add a non pinned tab.
1483 chrome::NewTab(browser()); 1482 chrome::NewTab(browser());
1484 1483
1485 // Add a pinned non-app tab. 1484 // Add a pinned non-app tab.
1486 chrome::NewTab(browser()); 1485 chrome::NewTab(browser());
1487 ui_test_utils::NavigateToURL(browser(), GURL(content::kAboutBlankURL)); 1486 ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
1488 model->SetTabPinned(2, true); 1487 model->SetTabPinned(2, true);
1489 1488
1490 // Write out the pinned tabs. 1489 // Write out the pinned tabs.
1491 PinnedTabCodec::WritePinnedTabs(browser()->profile()); 1490 PinnedTabCodec::WritePinnedTabs(browser()->profile());
1492 1491
1493 // Simulate launching again. 1492 // Simulate launching again.
1494 CommandLine dummy(CommandLine::NO_PROGRAM); 1493 CommandLine dummy(CommandLine::NO_PROGRAM);
1495 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 1494 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
1496 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 1495 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
1497 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); 1496 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 GURL url = ui_test_utils::GetTestUrl( 2125 GURL url = ui_test_utils::GetTestUrl(
2127 base::FilePath(), base::FilePath().AppendASCII("window.close.html")); 2126 base::FilePath(), base::FilePath().AppendASCII("window.close.html"));
2128 2127
2129 base::string16 title = ASCIIToUTF16("Title Of Awesomeness"); 2128 base::string16 title = ASCIIToUTF16("Title Of Awesomeness");
2130 content::TitleWatcher title_watcher( 2129 content::TitleWatcher title_watcher(
2131 browser()->tab_strip_model()->GetActiveWebContents(), title); 2130 browser()->tab_strip_model()->GetActiveWebContents(), title);
2132 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2); 2131 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2);
2133 EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); 2132 EXPECT_EQ(title, title_watcher.WaitAndGetTitle());
2134 } 2133 }
2135 2134
2136 // GTK doesn't use the Browser's fullscreen state.
2137 // TODO(linux_aura) http://crbug.com/163931 2135 // TODO(linux_aura) http://crbug.com/163931
2138 // Mac disabled: http://crbug.com/169820 2136 // Mac disabled: http://crbug.com/169820
2139 #if !defined(TOOLKIT_GTK) && !defined(OS_MACOSX) && \ 2137 #if !defined(OS_MACOSX) && \
2140 !(defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)) 2138 !(defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA))
2141 IN_PROC_BROWSER_TEST_F(BrowserTest, FullscreenBookmarkBar) { 2139 IN_PROC_BROWSER_TEST_F(BrowserTest, FullscreenBookmarkBar) {
2142 #if defined(OS_WIN) && defined(USE_ASH) 2140 #if defined(OS_WIN) && defined(USE_ASH)
2143 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 2141 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
2144 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 2142 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
2145 return; 2143 return;
2146 #endif 2144 #endif
2147 2145
2148 chrome::ToggleBookmarkBar(browser()); 2146 chrome::ToggleBookmarkBar(browser());
2149 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); 2147 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state());
(...skipping 26 matching lines...) Expand all
2176 2174
2177 class KioskModeTest : public BrowserTest { 2175 class KioskModeTest : public BrowserTest {
2178 public: 2176 public:
2179 KioskModeTest() {} 2177 KioskModeTest() {}
2180 2178
2181 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 2179 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
2182 command_line->AppendSwitch(switches::kKioskMode); 2180 command_line->AppendSwitch(switches::kKioskMode);
2183 } 2181 }
2184 }; 2182 };
2185 2183
2186 #if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined (USE_AURA)) 2184 #if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
2187 // http://crbug.com/103912 2185 // Mac: http://crbug.com/103912
2188 // TODO(linux_aura) http://crbug.com/163931 2186 // Linux: http://crbug.com/163931
2189 #define MAYBE_EnableKioskModeTest DISABLED_EnableKioskModeTest 2187 #define MAYBE_EnableKioskModeTest DISABLED_EnableKioskModeTest
2190 #else 2188 #else
2191 #define MAYBE_EnableKioskModeTest EnableKioskModeTest 2189 #define MAYBE_EnableKioskModeTest EnableKioskModeTest
2192 #endif 2190 #endif
2193 IN_PROC_BROWSER_TEST_F(KioskModeTest, MAYBE_EnableKioskModeTest) { 2191 IN_PROC_BROWSER_TEST_F(KioskModeTest, MAYBE_EnableKioskModeTest) {
2194 // Check if browser is in fullscreen mode. 2192 // Check if browser is in fullscreen mode.
2195 ASSERT_TRUE(browser()->window()->IsFullscreen()); 2193 ASSERT_TRUE(browser()->window()->IsFullscreen());
2196 ASSERT_FALSE(browser()->window()->IsFullscreenBubbleVisible()); 2194 ASSERT_FALSE(browser()->window()->IsFullscreenBubbleVisible());
2197 } 2195 }
2198 2196
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
2689 #endif 2687 #endif
2690 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2688 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2691 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2689 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2692 gfx::Size exp_final_size(initial_wcv_size); 2690 gfx::Size exp_final_size(initial_wcv_size);
2693 exp_final_size.Enlarge(wcv_resize_insets.width(), 2691 exp_final_size.Enlarge(wcv_resize_insets.width(),
2694 wcv_resize_insets.height() + height_inset); 2692 wcv_resize_insets.height() + height_inset);
2695 EXPECT_EQ(exp_final_size, 2693 EXPECT_EQ(exp_final_size,
2696 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2694 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2697 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); 2695 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size());
2698 } 2696 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698