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