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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/string16.h" | 6 #include "base/string16.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 | 932 |
933 // Find "Default". | 933 // Find "Default". |
934 int ordinal = 0; | 934 int ordinal = 0; |
935 TabContents* tab1 = chrome::GetActiveTabContents(browser()); | 935 TabContents* tab1 = chrome::GetActiveTabContents(browser()); |
936 EXPECT_EQ(1, FindInPageWchar(tab1, L"text", kFwd, kIgnoreCase, &ordinal)); | 936 EXPECT_EQ(1, FindInPageWchar(tab1, L"text", kFwd, kIgnoreCase, &ordinal)); |
937 | 937 |
938 // Create a second tab. | 938 // Create a second tab. |
939 // For some reason we can't use AddSelectedTabWithURL here on ChromeOS. It | 939 // For some reason we can't use AddSelectedTabWithURL here on ChromeOS. It |
940 // could be some delicate assumption about the tab starting off unselected or | 940 // could be some delicate assumption about the tab starting off unselected or |
941 // something relating to user gesture. | 941 // something relating to user gesture. |
942 browser()->AddBlankTab(true); | 942 chrome::AddBlankTab(browser(), true); |
943 ui_test_utils::NavigateToURL(browser(), url); | 943 ui_test_utils::NavigateToURL(browser(), url); |
944 TabContents* tab2 = chrome::GetActiveTabContents(browser()); | 944 TabContents* tab2 = chrome::GetActiveTabContents(browser()); |
945 EXPECT_NE(tab1, tab2); | 945 EXPECT_NE(tab1, tab2); |
946 | 946 |
947 // Find "given". | 947 // Find "given". |
948 FindInPageWchar(tab2, L"given", kFwd, kIgnoreCase, &ordinal); | 948 FindInPageWchar(tab2, L"given", kFwd, kIgnoreCase, &ordinal); |
949 | 949 |
950 // Switch back to first tab. | 950 // Switch back to first tab. |
951 chrome::ActivateTabAt(browser(), 0, false); | 951 chrome::ActivateTabAt(browser(), 0, false); |
952 browser()->GetFindBarController()->EndFindSession( | 952 browser()->GetFindBarController()->EndFindSession( |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 EnsureFindBoxOpen(); | 1050 EnsureFindBoxOpen(); |
1051 | 1051 |
1052 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText()); | 1052 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText()); |
1053 | 1053 |
1054 // Close the Find box. | 1054 // Close the Find box. |
1055 browser()->GetFindBarController()->EndFindSession( | 1055 browser()->GetFindBarController()->EndFindSession( |
1056 FindBarController::kKeepSelectionOnPage, | 1056 FindBarController::kKeepSelectionOnPage, |
1057 FindBarController::kKeepResultsInFindBox); | 1057 FindBarController::kKeepResultsInFindBox); |
1058 | 1058 |
1059 // Now create a second tab and load the same page. | 1059 // Now create a second tab and load the same page. |
1060 browser()->AddBlankTab(true); | 1060 chrome::AddBlankTab(browser(), true); |
1061 ui_test_utils::NavigateToURL(browser(), url); | 1061 ui_test_utils::NavigateToURL(browser(), url); |
1062 TabContents* tab2 = chrome::GetActiveTabContents(browser()); | 1062 TabContents* tab2 = chrome::GetActiveTabContents(browser()); |
1063 EXPECT_NE(tab1, tab2); | 1063 EXPECT_NE(tab1, tab2); |
1064 | 1064 |
1065 // Search for the word "text". | 1065 // Search for the word "text". |
1066 FindInPageWchar(tab2, L"text", kFwd, kIgnoreCase, &ordinal); | 1066 FindInPageWchar(tab2, L"text", kFwd, kIgnoreCase, &ordinal); |
1067 | 1067 |
1068 // Go back to the first tab and make sure we have NOT switched the prepopulate | 1068 // Go back to the first tab and make sure we have NOT switched the prepopulate |
1069 // text to "text". | 1069 // text to "text". |
1070 chrome::ActivateTabAt(browser(), 0, false); | 1070 chrome::ActivateTabAt(browser(), 0, false); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 ui_test_utils::RunAllPendingInMessageLoop(); // Needed on Linux. | 1246 ui_test_utils::RunAllPendingInMessageLoop(); // Needed on Linux. |
1247 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); | 1247 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); |
1248 | 1248 |
1249 ui_test_utils::NavigateToURLWithDisposition( | 1249 ui_test_utils::NavigateToURLWithDisposition( |
1250 browser(), url, NEW_FOREGROUND_TAB, | 1250 browser(), url, NEW_FOREGROUND_TAB, |
1251 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1251 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
1252 chrome::CloseTab(browser()); | 1252 chrome::CloseTab(browser()); |
1253 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); | 1253 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); |
1254 EXPECT_EQ(position, position2); | 1254 EXPECT_EQ(position, position2); |
1255 } | 1255 } |
OLD | NEW |