OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/app/chrome_dll_resource.h" | 5 #include "chrome/app/chrome_dll_resource.h" |
6 #include "chrome/browser/views/find_bar_win.h" | 6 #include "chrome/browser/views/find_bar_win.h" |
7 #include "chrome/test/automation/browser_proxy.h" | 7 #include "chrome/test/automation/browser_proxy.h" |
8 #include "chrome/test/automation/tab_proxy.h" | 8 #include "chrome/test/automation/tab_proxy.h" |
9 #include "chrome/test/automation/window_proxy.h" | 9 #include "chrome/test/automation/window_proxy.h" |
10 #include "chrome/test/ui/ui_test.h" | 10 #include "chrome/test/ui/ui_test.h" |
11 #include "net/url_request/url_request_unittest.h" | 11 #include "net/url_request/url_request_unittest.h" |
12 | 12 |
13 class FindInPageControllerTest : public UITest { | 13 class FindInPageControllerTest : public UITest { |
14 public: | 14 public: |
15 FindInPageControllerTest() { | 15 FindInPageControllerTest() { |
16 show_window_ = true; | 16 show_window_ = true; |
17 } | 17 } |
18 }; | 18 }; |
19 | 19 |
20 const std::wstring kFramePage = L"files/find_in_page/frames.html"; | 20 const std::wstring kFramePage = L"files/find_in_page/frames.html"; |
21 const std::wstring kFrameData = L"files/find_in_page/framedata_general.html"; | 21 const std::wstring kFrameData = L"files/find_in_page/framedata_general.html"; |
22 const std::wstring kUserSelectPage = L"files/find_in_page/user-select.html"; | 22 const std::wstring kUserSelectPage = L"files/find_in_page/user-select.html"; |
23 const std::wstring kCrashPage = L"files/find_in_page/crash_1341577.html"; | 23 const std::wstring kCrashPage = L"files/find_in_page/crash_1341577.html"; |
24 const std::wstring kTooFewMatchesPage = L"files/find_in_page/bug_1155639.html"; | 24 const std::wstring kTooFewMatchesPage = L"files/find_in_page/bug_1155639.html"; |
25 | 25 |
26 // This test loads a page with frames and starts FindInPage requests | 26 // This test loads a page with frames and starts FindInPage requests |
27 TEST_F(FindInPageControllerTest, FindInPageFrames) { | 27 TEST_F(FindInPageControllerTest, FindInPageFrames) { |
28 scoped_refptr<HTTPTestServer> server = | 28 TestServer server(L"chrome/test/data"); |
29 HTTPTestServer::CreateServer(L"chrome/test/data"); | |
30 ASSERT_TRUE(NULL != server.get()); | |
31 | 29 |
32 // First we navigate to our frames page. | 30 // First we navigate to our frames page. |
33 GURL url = server->TestServerPageW(kFramePage); | 31 GURL url = server.TestServerPageW(kFramePage); |
34 scoped_ptr<TabProxy> tab(GetActiveTab()); | 32 scoped_ptr<TabProxy> tab(GetActiveTab()); |
35 ASSERT_TRUE(tab->NavigateToURL(url)); | 33 ASSERT_TRUE(tab->NavigateToURL(url)); |
36 WaitUntilTabCount(1); | 34 WaitUntilTabCount(1); |
37 | 35 |
38 // Try incremental search (mimicking user typing in). | 36 // Try incremental search (mimicking user typing in). |
39 EXPECT_EQ(18, tab->FindInPage(L"g", FWD, IGNORE_CASE, false, NULL)); | 37 EXPECT_EQ(18, tab->FindInPage(L"g", FWD, IGNORE_CASE, false, NULL)); |
40 EXPECT_EQ(11, tab->FindInPage(L"go", FWD, IGNORE_CASE, false, NULL)); | 38 EXPECT_EQ(11, tab->FindInPage(L"go", FWD, IGNORE_CASE, false, NULL)); |
41 EXPECT_EQ(04, tab->FindInPage(L"goo", FWD, IGNORE_CASE, false, NULL)); | 39 EXPECT_EQ(04, tab->FindInPage(L"goo", FWD, IGNORE_CASE, false, NULL)); |
42 EXPECT_EQ(03, tab->FindInPage(L"goog", FWD, IGNORE_CASE, false, NULL)); | 40 EXPECT_EQ(03, tab->FindInPage(L"goog", FWD, IGNORE_CASE, false, NULL)); |
43 EXPECT_EQ(02, tab->FindInPage(L"googl", FWD, IGNORE_CASE, false, NULL)); | 41 EXPECT_EQ(02, tab->FindInPage(L"googl", FWD, IGNORE_CASE, false, NULL)); |
(...skipping 27 matching lines...) Expand all Loading... |
71 false, NULL)); | 69 false, NULL)); |
72 EXPECT_EQ(1, tab->FindInPage(L"Hreggvi\u00F0ur", FWD, CASE_SENSITIVE, | 70 EXPECT_EQ(1, tab->FindInPage(L"Hreggvi\u00F0ur", FWD, CASE_SENSITIVE, |
73 false, NULL)); | 71 false, NULL)); |
74 EXPECT_EQ(0, tab->FindInPage(L"hreggvi\u00F0ur", FWD, CASE_SENSITIVE, | 72 EXPECT_EQ(0, tab->FindInPage(L"hreggvi\u00F0ur", FWD, CASE_SENSITIVE, |
75 false, NULL)); | 73 false, NULL)); |
76 } | 74 } |
77 | 75 |
78 // This test loads a single-frame page and makes sure the ordinal returned makes | 76 // This test loads a single-frame page and makes sure the ordinal returned makes |
79 // sense as we FindNext over all the items. | 77 // sense as we FindNext over all the items. |
80 TEST_F(FindInPageControllerTest, FindInPageOrdinal) { | 78 TEST_F(FindInPageControllerTest, FindInPageOrdinal) { |
81 scoped_refptr<HTTPTestServer> server = | 79 TestServer server(L"chrome/test/data"); |
82 HTTPTestServer::CreateServer(L"chrome/test/data"); | |
83 ASSERT_TRUE(NULL != server.get()); | |
84 | 80 |
85 // First we navigate to our frames page. | 81 // First we navigate to our frames page. |
86 GURL url = server->TestServerPageW(kFrameData); | 82 GURL url = server.TestServerPageW(kFrameData); |
87 scoped_ptr<TabProxy> tab(GetActiveTab()); | 83 scoped_ptr<TabProxy> tab(GetActiveTab()); |
88 ASSERT_TRUE(tab->NavigateToURL(url)); | 84 ASSERT_TRUE(tab->NavigateToURL(url)); |
89 WaitUntilTabCount(1); | 85 WaitUntilTabCount(1); |
90 | 86 |
91 // Search for 'o', which should make the first item active and return | 87 // Search for 'o', which should make the first item active and return |
92 // '1 in 3' (1st ordinal of a total of 3 matches). | 88 // '1 in 3' (1st ordinal of a total of 3 matches). |
93 int ordinal = 0; | 89 int ordinal = 0; |
94 EXPECT_EQ(3, tab->FindInPage(L"o", FWD, IGNORE_CASE, false, &ordinal)); | 90 EXPECT_EQ(3, tab->FindInPage(L"o", FWD, IGNORE_CASE, false, &ordinal)); |
95 EXPECT_EQ(1, ordinal); | 91 EXPECT_EQ(1, ordinal); |
96 // FindNext returns -1 for match count because it doesn't bother with | 92 // FindNext returns -1 for match count because it doesn't bother with |
(...skipping 12 matching lines...) Expand all Loading... |
109 EXPECT_EQ(-1, tab->FindInPage(L"o", FWD, IGNORE_CASE, true, &ordinal)); | 105 EXPECT_EQ(-1, tab->FindInPage(L"o", FWD, IGNORE_CASE, true, &ordinal)); |
110 EXPECT_EQ(1, ordinal); | 106 EXPECT_EQ(1, ordinal); |
111 // This should go back to the end. | 107 // This should go back to the end. |
112 EXPECT_EQ(-1, tab->FindInPage(L"o", BACK, IGNORE_CASE, true, &ordinal)); | 108 EXPECT_EQ(-1, tab->FindInPage(L"o", BACK, IGNORE_CASE, true, &ordinal)); |
113 EXPECT_EQ(3, ordinal); | 109 EXPECT_EQ(3, ordinal); |
114 } | 110 } |
115 | 111 |
116 // This test loads a page with frames and makes sure the ordinal returned makes | 112 // This test loads a page with frames and makes sure the ordinal returned makes |
117 // sense. | 113 // sense. |
118 TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) { | 114 TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) { |
119 scoped_refptr<HTTPTestServer> server = | 115 TestServer server(L"chrome/test/data"); |
120 HTTPTestServer::CreateServer(L"chrome/test/data"); | |
121 ASSERT_TRUE(NULL != server.get()); | |
122 | 116 |
123 // First we navigate to our frames page. | 117 // First we navigate to our frames page. |
124 GURL url = server->TestServerPageW(kFramePage); | 118 GURL url = server.TestServerPageW(kFramePage); |
125 scoped_ptr<TabProxy> tab(GetActiveTab()); | 119 scoped_ptr<TabProxy> tab(GetActiveTab()); |
126 ASSERT_TRUE(tab->NavigateToURL(url)); | 120 ASSERT_TRUE(tab->NavigateToURL(url)); |
127 WaitUntilTabCount(1); | 121 WaitUntilTabCount(1); |
128 | 122 |
129 // Search for 'a', which should make the first item active and return | 123 // Search for 'a', which should make the first item active and return |
130 // '1 in 7' (1st ordinal of a total of 7 matches). | 124 // '1 in 7' (1st ordinal of a total of 7 matches). |
131 int ordinal = 0; | 125 int ordinal = 0; |
132 EXPECT_EQ(7, tab->FindInPage(L"a", FWD, IGNORE_CASE, false, &ordinal)); | 126 EXPECT_EQ(7, tab->FindInPage(L"a", FWD, IGNORE_CASE, false, &ordinal)); |
133 EXPECT_EQ(1, ordinal); | 127 EXPECT_EQ(1, ordinal); |
134 // FindNext returns -1 for match count because it doesn't bother with | 128 // FindNext returns -1 for match count because it doesn't bother with |
(...skipping 20 matching lines...) Expand all Loading... |
155 EXPECT_EQ(-1, tab->FindInPage(L"a", FWD, IGNORE_CASE, true, &ordinal)); | 149 EXPECT_EQ(-1, tab->FindInPage(L"a", FWD, IGNORE_CASE, true, &ordinal)); |
156 EXPECT_EQ(1, ordinal); | 150 EXPECT_EQ(1, ordinal); |
157 // Now we should wrap back to frame last frame. | 151 // Now we should wrap back to frame last frame. |
158 EXPECT_EQ(-1, tab->FindInPage(L"a", BACK, IGNORE_CASE, true, &ordinal)); | 152 EXPECT_EQ(-1, tab->FindInPage(L"a", BACK, IGNORE_CASE, true, &ordinal)); |
159 EXPECT_EQ(7, ordinal); | 153 EXPECT_EQ(7, ordinal); |
160 } | 154 } |
161 | 155 |
162 // We could get ordinals out of whack when restarting search in subframes. | 156 // We could get ordinals out of whack when restarting search in subframes. |
163 // See http://crbug.com/5132 | 157 // See http://crbug.com/5132 |
164 TEST_F(FindInPageControllerTest, FindInPage_Issue5132) { | 158 TEST_F(FindInPageControllerTest, FindInPage_Issue5132) { |
165 scoped_refptr<HTTPTestServer> server = | 159 TestServer server(L"chrome/test/data"); |
166 HTTPTestServer::CreateServer(L"chrome/test/data"); | |
167 ASSERT_TRUE(NULL != server.get()); | |
168 | 160 |
169 // First we navigate to our frames page. | 161 // First we navigate to our frames page. |
170 GURL url = server->TestServerPageW(kFramePage); | 162 GURL url = server.TestServerPageW(kFramePage); |
171 scoped_ptr<TabProxy> tab(GetActiveTab()); | 163 scoped_ptr<TabProxy> tab(GetActiveTab()); |
172 ASSERT_TRUE(tab->NavigateToURL(url)); | 164 ASSERT_TRUE(tab->NavigateToURL(url)); |
173 WaitUntilTabCount(1); | 165 WaitUntilTabCount(1); |
174 | 166 |
175 // Search for 'goa' three times (6 matches on page). | 167 // Search for 'goa' three times (6 matches on page). |
176 int ordinal = 0; | 168 int ordinal = 0; |
177 EXPECT_EQ(6, tab->FindInPage(L"goa", FWD, IGNORE_CASE, false, &ordinal)); | 169 EXPECT_EQ(6, tab->FindInPage(L"goa", FWD, IGNORE_CASE, false, &ordinal)); |
178 EXPECT_EQ(1, ordinal); | 170 EXPECT_EQ(1, ordinal); |
179 // FindNext returns -1 for match count because it doesn't bother with | 171 // FindNext returns -1 for match count because it doesn't bother with |
180 // recounting the number of matches. We don't care about the match count | 172 // recounting the number of matches. We don't care about the match count |
181 // anyway in this case, we just want to check the ordinal. | 173 // anyway in this case, we just want to check the ordinal. |
182 EXPECT_EQ(-1, tab->FindInPage(L"goa", FWD, IGNORE_CASE, true, &ordinal)); | 174 EXPECT_EQ(-1, tab->FindInPage(L"goa", FWD, IGNORE_CASE, true, &ordinal)); |
183 EXPECT_EQ(2, ordinal); | 175 EXPECT_EQ(2, ordinal); |
184 EXPECT_EQ(-1, tab->FindInPage(L"goa", FWD, IGNORE_CASE, true, &ordinal)); | 176 EXPECT_EQ(-1, tab->FindInPage(L"goa", FWD, IGNORE_CASE, true, &ordinal)); |
185 EXPECT_EQ(3, ordinal); | 177 EXPECT_EQ(3, ordinal); |
186 // Add space to search (should result in no matches). | 178 // Add space to search (should result in no matches). |
187 EXPECT_EQ(0, tab->FindInPage(L"goa ", FWD, IGNORE_CASE, false, &ordinal)); | 179 EXPECT_EQ(0, tab->FindInPage(L"goa ", FWD, IGNORE_CASE, false, &ordinal)); |
188 EXPECT_EQ(-1, ordinal); | 180 EXPECT_EQ(-1, ordinal); |
189 // Remove the space, should be back to '3 out of 6') | 181 // Remove the space, should be back to '3 out of 6') |
190 EXPECT_EQ(6, tab->FindInPage(L"goa", FWD, IGNORE_CASE, false, &ordinal)); | 182 EXPECT_EQ(6, tab->FindInPage(L"goa", FWD, IGNORE_CASE, false, &ordinal)); |
191 EXPECT_EQ(3, ordinal); | 183 EXPECT_EQ(3, ordinal); |
192 } | 184 } |
193 | 185 |
194 // Load a page with no selectable text and make sure we don't crash. | 186 // Load a page with no selectable text and make sure we don't crash. |
195 TEST_F(FindInPageControllerTest, FindUnSelectableText) { | 187 TEST_F(FindInPageControllerTest, FindUnSelectableText) { |
196 scoped_refptr<HTTPTestServer> server = | 188 TestServer server(L"chrome/test/data"); |
197 HTTPTestServer::CreateServer(L"chrome/test/data"); | |
198 ASSERT_TRUE(NULL != server.get()); | |
199 | 189 |
200 GURL url = server->TestServerPageW(kUserSelectPage); | 190 GURL url = server.TestServerPageW(kUserSelectPage); |
201 scoped_ptr<TabProxy> tab(GetActiveTab()); | 191 scoped_ptr<TabProxy> tab(GetActiveTab()); |
202 ASSERT_TRUE(tab->NavigateToURL(url)); | 192 ASSERT_TRUE(tab->NavigateToURL(url)); |
203 WaitUntilTabCount(1); | 193 WaitUntilTabCount(1); |
204 | 194 |
205 EXPECT_EQ(0, tab->FindInPage(L"text", FWD, IGNORE_CASE, false, NULL)); | 195 EXPECT_EQ(0, tab->FindInPage(L"text", FWD, IGNORE_CASE, false, NULL)); |
206 EXPECT_EQ(0, tab->FindInPage(L"Non-existing string", FWD, IGNORE_CASE, | 196 EXPECT_EQ(0, tab->FindInPage(L"Non-existing string", FWD, IGNORE_CASE, |
207 false, NULL)); | 197 false, NULL)); |
208 } | 198 } |
209 | 199 |
210 // Try to reproduce the crash seen in issue 1341577. | 200 // Try to reproduce the crash seen in issue 1341577. |
211 TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) { | 201 TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) { |
212 scoped_refptr<HTTPTestServer> server = | 202 TestServer server(L"chrome/test/data"); |
213 HTTPTestServer::CreateServer(L"chrome/test/data"); | |
214 ASSERT_TRUE(NULL != server.get()); | |
215 | 203 |
216 GURL url = server->TestServerPageW(kCrashPage); | 204 GURL url = server.TestServerPageW(kCrashPage); |
217 scoped_ptr<TabProxy> tab(GetActiveTab()); | 205 scoped_ptr<TabProxy> tab(GetActiveTab()); |
218 ASSERT_TRUE(tab->NavigateToURL(url)); | 206 ASSERT_TRUE(tab->NavigateToURL(url)); |
219 WaitUntilTabCount(1); | 207 WaitUntilTabCount(1); |
220 | 208 |
221 // This would crash the tab. These must be the first two find requests issued | 209 // This would crash the tab. These must be the first two find requests issued |
222 // against the frame, otherwise an active frame pointer is set and it wont | 210 // against the frame, otherwise an active frame pointer is set and it wont |
223 // produce the crash. | 211 // produce the crash. |
224 EXPECT_EQ(1, tab->FindInPage(L"\u0D4C", FWD, IGNORE_CASE, false, NULL)); | 212 EXPECT_EQ(1, tab->FindInPage(L"\u0D4C", FWD, IGNORE_CASE, false, NULL)); |
225 // FindNext returns -1 for match count because it doesn't bother with | 213 // FindNext returns -1 for match count because it doesn't bother with |
226 // recounting the number of matches. We don't care about the match count | 214 // recounting the number of matches. We don't care about the match count |
227 // anyway in this case, we just want to make sure it doesn't crash. | 215 // anyway in this case, we just want to make sure it doesn't crash. |
228 EXPECT_EQ(-1, tab->FindInPage(L"\u0D4C", FWD, IGNORE_CASE, true, NULL)); | 216 EXPECT_EQ(-1, tab->FindInPage(L"\u0D4C", FWD, IGNORE_CASE, true, NULL)); |
229 | 217 |
230 // This should work fine. | 218 // This should work fine. |
231 EXPECT_EQ(1, tab->FindInPage(L"\u0D24\u0D46", FWD, IGNORE_CASE, false, NULL)); | 219 EXPECT_EQ(1, tab->FindInPage(L"\u0D24\u0D46", FWD, IGNORE_CASE, false, NULL)); |
232 EXPECT_EQ(0, tab->FindInPage(L"nostring", FWD, IGNORE_CASE, false, NULL)); | 220 EXPECT_EQ(0, tab->FindInPage(L"nostring", FWD, IGNORE_CASE, false, NULL)); |
233 } | 221 } |
234 | 222 |
235 // Test to make sure Find does the right thing when restarting from a timeout. | 223 // Test to make sure Find does the right thing when restarting from a timeout. |
236 // We used to have a problem where we'd stop finding matches when all of the | 224 // We used to have a problem where we'd stop finding matches when all of the |
237 // following conditions were true: | 225 // following conditions were true: |
238 // 1) The page has a lot of text to search. | 226 // 1) The page has a lot of text to search. |
239 // 2) The page contains more than one match. | 227 // 2) The page contains more than one match. |
240 // 3) It takes longer than the time-slice given to each Find operation (100 | 228 // 3) It takes longer than the time-slice given to each Find operation (100 |
241 // ms) to find one or more of those matches (so Find times out and has to try | 229 // ms) to find one or more of those matches (so Find times out and has to try |
242 // again from where it left off). | 230 // again from where it left off). |
243 TEST_F(FindInPageControllerTest, FindEnoughMatches_Issue1155639) { | 231 TEST_F(FindInPageControllerTest, FindEnoughMatches_Issue1155639) { |
244 scoped_refptr<HTTPTestServer> server = | 232 TestServer server(L"chrome/test/data"); |
245 HTTPTestServer::CreateServer(L"chrome/test/data"); | |
246 ASSERT_TRUE(NULL != server.get()); | |
247 | 233 |
248 GURL url = server->TestServerPageW(kTooFewMatchesPage); | 234 GURL url = server.TestServerPageW(kTooFewMatchesPage); |
249 scoped_ptr<TabProxy> tab(GetActiveTab()); | 235 scoped_ptr<TabProxy> tab(GetActiveTab()); |
250 ASSERT_TRUE(tab->NavigateToURL(url)); | 236 ASSERT_TRUE(tab->NavigateToURL(url)); |
251 WaitUntilTabCount(1); | 237 WaitUntilTabCount(1); |
252 | 238 |
253 // This string appears 5 times at the bottom of a long page. If Find restarts | 239 // This string appears 5 times at the bottom of a long page. If Find restarts |
254 // properly after a timeout, it will find 5 matches, not just 1. | 240 // properly after a timeout, it will find 5 matches, not just 1. |
255 EXPECT_EQ(5, tab->FindInPage(L"008.xml", FWD, IGNORE_CASE, false, NULL)); | 241 EXPECT_EQ(5, tab->FindInPage(L"008.xml", FWD, IGNORE_CASE, false, NULL)); |
256 } | 242 } |
257 | 243 |
258 // The find window should not change its location just because we open and close | 244 // The find window should not change its location just because we open and close |
259 // a new tab. | 245 // a new tab. |
260 TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { | 246 TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { |
261 scoped_refptr<HTTPTestServer> server = | 247 TestServer server(L"chrome/test/data"); |
262 HTTPTestServer::CreateServer(L"chrome/test/data"); | |
263 ASSERT_TRUE(NULL != server.get()); | |
264 | 248 |
265 GURL url = server->TestServerPageW(kFramePage); | 249 GURL url = server.TestServerPageW(kFramePage); |
266 scoped_ptr<TabProxy> tabA(GetActiveTab()); | 250 scoped_ptr<TabProxy> tabA(GetActiveTab()); |
267 ASSERT_TRUE(tabA->NavigateToURL(url)); | 251 ASSERT_TRUE(tabA->NavigateToURL(url)); |
268 WaitUntilTabCount(1); | 252 WaitUntilTabCount(1); |
269 | 253 |
270 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 254 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
271 ASSERT_TRUE(browser.get() != NULL); | 255 ASSERT_TRUE(browser.get() != NULL); |
272 | 256 |
273 // Toggle the bookmark bar state. | 257 // Toggle the bookmark bar state. |
274 browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR); | 258 browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR); |
275 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true)); | 259 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 296 |
313 // See if the Find window has moved. | 297 // See if the Find window has moved. |
314 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); | 298 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); |
315 | 299 |
316 EXPECT_EQ(x, new_x); | 300 EXPECT_EQ(x, new_x); |
317 EXPECT_EQ(y, new_y); | 301 EXPECT_EQ(y, new_y); |
318 } | 302 } |
319 | 303 |
320 // Make sure Find box disappears on Navigate but not on Refresh. | 304 // Make sure Find box disappears on Navigate but not on Refresh. |
321 TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) { | 305 TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) { |
322 scoped_refptr<HTTPTestServer> server = | 306 TestServer server(L"chrome/test/data"); |
323 HTTPTestServer::CreateServer(L"chrome/test/data"); | |
324 ASSERT_TRUE(NULL != server.get()); | |
325 | 307 |
326 GURL url = server->TestServerPageW(kUserSelectPage); | 308 GURL url = server.TestServerPageW(kUserSelectPage); |
327 scoped_ptr<TabProxy> tab(GetActiveTab()); | 309 scoped_ptr<TabProxy> tab(GetActiveTab()); |
328 ASSERT_TRUE(tab->NavigateToURL(url)); | 310 ASSERT_TRUE(tab->NavigateToURL(url)); |
329 WaitUntilTabCount(1); | 311 WaitUntilTabCount(1); |
330 | 312 |
331 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 313 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
332 ASSERT_TRUE(browser.get() != NULL); | 314 ASSERT_TRUE(browser.get() != NULL); |
333 | 315 |
334 // Open the Find window and wait for it to animate. | 316 // Open the Find window and wait for it to animate. |
335 EXPECT_TRUE(tab->OpenFindInPage()); | 317 EXPECT_TRUE(tab->OpenFindInPage()); |
336 EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), true)); | 318 EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), true)); |
337 | 319 |
338 // Reload the tab and make sure Find box doesn't go away. | 320 // Reload the tab and make sure Find box doesn't go away. |
339 EXPECT_TRUE(tab->Reload()); | 321 EXPECT_TRUE(tab->Reload()); |
340 EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), true)); | 322 EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), true)); |
341 | 323 |
342 // Navigate and make sure the Find box goes away. | 324 // Navigate and make sure the Find box goes away. |
343 EXPECT_TRUE(tab->NavigateToURL(url)); | 325 EXPECT_TRUE(tab->NavigateToURL(url)); |
344 EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), false)); | 326 EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), false)); |
345 } | 327 } |
OLD | NEW |