| OLD | NEW |
| 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/string16.h" |
| 6 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 7 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/tabs/tab_strip_model.h" | 10 #include "chrome/browser/tabs/tab_strip_model.h" |
| 10 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_navigator.h" | 12 #include "chrome/browser/ui/browser_navigator.h" |
| 12 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 13 #include "chrome/browser/ui/find_bar/find_bar.h" | 14 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 14 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 15 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 15 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 16 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper(); | 951 TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper(); |
| 951 EXPECT_NE(tab1, tab2); | 952 EXPECT_NE(tab1, tab2); |
| 952 | 953 |
| 953 // Open the Find box. | 954 // Open the Find box. |
| 954 EnsureFindBoxOpen(); | 955 EnsureFindBoxOpen(); |
| 955 | 956 |
| 956 // The new tab should have "page" prepopulated, since that was the last search | 957 // The new tab should have "page" prepopulated, since that was the last search |
| 957 // in the first tab. | 958 // in the first tab. |
| 958 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText()); | 959 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText()); |
| 959 // But it should not seem like a search has been issued. | 960 // But it should not seem like a search has been issued. |
| 960 EXPECT_EQ(ASCIIToUTF16(""), GetMatchCountText()); | 961 EXPECT_EQ(string16(), GetMatchCountText()); |
| 961 } | 962 } |
| 962 | 963 |
| 963 // This makes sure that we can search for A in tabA, then for B in tabB and | 964 // This makes sure that we can search for A in tabA, then for B in tabB and |
| 964 // when we come back to tabA we should still see A (because that was the last | 965 // when we come back to tabA we should still see A (because that was the last |
| 965 // search in that tab). | 966 // search in that tab). |
| 966 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) { | 967 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) { |
| 967 #if defined(OS_MACOSX) | 968 #if defined(OS_MACOSX) |
| 968 // FindInPage on Mac doesn't use prepopulated values. Search there is global. | 969 // FindInPage on Mac doesn't use prepopulated values. Search there is global. |
| 969 return; | 970 return; |
| 970 #endif | 971 #endif |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 MessageLoop::current()->RunAllPending(); | 1136 MessageLoop::current()->RunAllPending(); |
| 1136 | 1137 |
| 1137 EnsureFindBoxOpenForBrowser(popup); | 1138 EnsureFindBoxOpenForBrowser(popup); |
| 1138 | 1139 |
| 1139 // GTK adjusts FindBar size asynchronously. | 1140 // GTK adjusts FindBar size asynchronously. |
| 1140 MessageLoop::current()->RunAllPending(); | 1141 MessageLoop::current()->RunAllPending(); |
| 1141 | 1142 |
| 1142 ASSERT_LE(GetFindBarWidthForBrowser(popup), | 1143 ASSERT_LE(GetFindBarWidthForBrowser(popup), |
| 1143 popup->window()->GetBounds().width()); | 1144 popup->window()->GetBounds().width()); |
| 1144 } | 1145 } |
| OLD | NEW |