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

Side by Side Diff: chrome/browser/ui/find_bar/find_bar_host_browsertest.cc

Issue 8253002: Move PageTransition into content namespace. While I'm touching all these files, I've also updated... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/tabs/tab_strip_model.h" 9 #include "chrome/browser/tabs/tab_strip_model.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 GURL url = test_server()->GetURL(kSimple); 936 GURL url = test_server()->GetURL(kSimple);
937 ui_test_utils::NavigateToURL(browser(), url); 937 ui_test_utils::NavigateToURL(browser(), url);
938 938
939 // Search for the word "page". 939 // Search for the word "page".
940 int ordinal = 0; 940 int ordinal = 0;
941 TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper(); 941 TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper();
942 EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal)); 942 EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal));
943 EXPECT_EQ(ASCIIToUTF16("1 of 1"), GetMatchCountText()); 943 EXPECT_EQ(ASCIIToUTF16("1 of 1"), GetMatchCountText());
944 944
945 // Now create a second tab and load the same page. 945 // Now create a second tab and load the same page.
946 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED); 946 browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED);
947 TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper(); 947 TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper();
948 EXPECT_NE(tab1, tab2); 948 EXPECT_NE(tab1, tab2);
949 949
950 // Open the Find box. 950 // Open the Find box.
951 EnsureFindBoxOpen(); 951 EnsureFindBoxOpen();
952 952
953 // The new tab should have "page" prepopulated, since that was the last search 953 // The new tab should have "page" prepopulated, since that was the last search
954 // in the first tab. 954 // in the first tab.
955 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText()); 955 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText());
956 // But it should not seem like a search has been issued. 956 // But it should not seem like a search has been issued.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 1054
1055 // Close the Find box. 1055 // Close the Find box.
1056 browser()->GetFindBarController()->EndFindSession( 1056 browser()->GetFindBarController()->EndFindSession(
1057 FindBarController::kKeepSelection); 1057 FindBarController::kKeepSelection);
1058 1058
1059 // Open a new incognito window and navigate to the same page. 1059 // Open a new incognito window and navigate to the same page.
1060 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); 1060 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
1061 Browser* incognito_browser = Browser::Create(incognito_profile); 1061 Browser* incognito_browser = Browser::Create(incognito_profile);
1062 ui_test_utils::WindowedNotificationObserver observer( 1062 ui_test_utils::WindowedNotificationObserver observer(
1063 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); 1063 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1064 incognito_browser->AddSelectedTabWithURL(url, PageTransition::START_PAGE); 1064 incognito_browser->AddSelectedTabWithURL(
1065 url, content::PAGE_TRANSITION_START_PAGE);
1065 observer.Wait(); 1066 observer.Wait();
1066 incognito_browser->window()->Show(); 1067 incognito_browser->window()->Show();
1067 1068
1068 // Open the find box and make sure that it is prepopulated with "page". 1069 // Open the find box and make sure that it is prepopulated with "page".
1069 EnsureFindBoxOpenForBrowser(incognito_browser); 1070 EnsureFindBoxOpenForBrowser(incognito_browser);
1070 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(incognito_browser)); 1071 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(incognito_browser));
1071 1072
1072 // Search for the word "text" in the incognito tab. 1073 // Search for the word "text" in the incognito tab.
1073 TabContentsWrapper* incognito_tab = 1074 TabContentsWrapper* incognito_tab =
1074 incognito_browser->GetSelectedTabContentsWrapper(); 1075 incognito_browser->GetSelectedTabContentsWrapper();
1075 EXPECT_EQ(1, FindInPageWchar(incognito_tab, L"text", 1076 EXPECT_EQ(1, FindInPageWchar(incognito_tab, L"text",
1076 kFwd, kIgnoreCase, &ordinal)); 1077 kFwd, kIgnoreCase, &ordinal));
1077 EXPECT_EQ(ASCIIToUTF16("text"), GetFindBarTextForBrowser(incognito_browser)); 1078 EXPECT_EQ(ASCIIToUTF16("text"), GetFindBarTextForBrowser(incognito_browser));
1078 1079
1079 // Close the Find box. 1080 // Close the Find box.
1080 incognito_browser->GetFindBarController()->EndFindSession( 1081 incognito_browser->GetFindBarController()->EndFindSession(
1081 FindBarController::kKeepSelection); 1082 FindBarController::kKeepSelection);
1082 1083
1083 // Now open a new tab in the original (non-incognito) browser. 1084 // Now open a new tab in the original (non-incognito) browser.
1084 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED); 1085 browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED);
1085 TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper(); 1086 TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper();
1086 EXPECT_NE(tab1, tab2); 1087 EXPECT_NE(tab1, tab2);
1087 1088
1088 // Open the Find box and make sure it is prepopulated with the search term 1089 // Open the Find box and make sure it is prepopulated with the search term
1089 // from the original browser, not the search term from the incognito window. 1090 // from the original browser, not the search term from the incognito window.
1090 EnsureFindBoxOpenForBrowser(browser()); 1091 EnsureFindBoxOpenForBrowser(browser());
1091 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser())); 1092 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser()));
1092 } 1093 }
1093 1094
1094 // This makes sure that dismissing the find bar with kActivateSelection works. 1095 // This makes sure that dismissing the find bar with kActivateSelection works.
(...skipping 18 matching lines...) Expand all
1113 } 1114 }
1114 1115
1115 // Tests that FindBar fits within a narrow browser window. 1116 // Tests that FindBar fits within a narrow browser window.
1116 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FitWindow) { 1117 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FitWindow) {
1117 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile()); 1118 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile());
1118 params.initial_bounds = gfx::Rect(0, 0, 250, 500); 1119 params.initial_bounds = gfx::Rect(0, 0, 250, 500);
1119 Browser* popup = Browser::CreateWithParams(params); 1120 Browser* popup = Browser::CreateWithParams(params);
1120 ui_test_utils::WindowedNotificationObserver observer( 1121 ui_test_utils::WindowedNotificationObserver observer(
1121 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); 1122 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1122 popup->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), 1123 popup->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL),
1123 PageTransition::LINK); 1124 content::PAGE_TRANSITION_LINK);
1124 // Wait for the page to finish loading. 1125 // Wait for the page to finish loading.
1125 observer.Wait(); 1126 observer.Wait();
1126 popup->window()->Show(); 1127 popup->window()->Show();
1127 1128
1128 // On GTK, bounds change is asynchronous. 1129 // On GTK, bounds change is asynchronous.
1129 MessageLoop::current()->RunAllPending(); 1130 MessageLoop::current()->RunAllPending();
1130 1131
1131 EnsureFindBoxOpenForBrowser(popup); 1132 EnsureFindBoxOpenForBrowser(popup);
1132 1133
1133 // GTK adjusts FindBar size asynchronously. 1134 // GTK adjusts FindBar size asynchronously.
1134 MessageLoop::current()->RunAllPending(); 1135 MessageLoop::current()->RunAllPending();
1135 1136
1136 ASSERT_LE(GetFindBarWidthForBrowser(popup), 1137 ASSERT_LE(GetFindBarWidthForBrowser(popup),
1137 popup->window()->GetBounds().width()); 1138 popup->window()->GetBounds().width());
1138 } 1139 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_controller.cc ('k') | chrome/browser/ui/gtk/about_chrome_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698