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 "chrome/browser/ui/browser_navigator_browsertest.h" | 5 #include "chrome/browser/ui/browser_navigator_browsertest.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 browser()->tab_strip_model()->GetActiveWebContents(); | 130 browser()->tab_strip_model()->GetActiveWebContents(); |
131 if (base_web_contents) { | 131 if (base_web_contents) { |
132 create_params.initial_size = | 132 create_params.initial_size = |
133 base_web_contents->GetContainerBounds().size(); | 133 base_web_contents->GetContainerBounds().size(); |
134 } | 134 } |
135 return WebContents::Create(create_params); | 135 return WebContents::Create(create_params); |
136 } | 136 } |
137 | 137 |
138 void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) { | 138 void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) { |
139 GURL old_url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); | 139 GURL old_url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); |
140 chrome::NavigateParams p(MakeNavigateParams()); | 140 chrome::NavigateParams params(MakeNavigateParams()); |
141 p.disposition = disposition; | 141 params.disposition = disposition; |
142 chrome::Navigate(&p); | 142 chrome::Navigate(¶ms); |
143 | 143 |
144 // Nothing should have happened as a result of Navigate(); | 144 // Nothing should have happened as a result of Navigate(); |
145 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 145 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
146 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 146 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
147 EXPECT_EQ(old_url, | 147 EXPECT_EQ(old_url, |
148 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 148 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
149 } | 149 } |
150 | 150 |
151 void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) { | 151 void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) { |
152 Browser* incognito_browser = CreateIncognitoBrowser(); | 152 Browser* incognito_browser = CreateIncognitoBrowser(); |
153 | 153 |
154 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 154 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
155 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 155 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
156 EXPECT_EQ(1, incognito_browser->tab_strip_model()->count()); | 156 EXPECT_EQ(1, incognito_browser->tab_strip_model()->count()); |
157 | 157 |
158 // Navigate to the page. | 158 // Navigate to the page. |
159 chrome::NavigateParams p(MakeNavigateParams(incognito_browser)); | 159 chrome::NavigateParams params(MakeNavigateParams(incognito_browser)); |
160 p.disposition = SINGLETON_TAB; | 160 params.disposition = SINGLETON_TAB; |
161 p.url = url; | 161 params.url = url; |
162 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 162 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
163 chrome::Navigate(&p); | 163 chrome::Navigate(¶ms); |
164 | 164 |
165 // This page should be opened in browser() window. | 165 // This page should be opened in browser() window. |
166 EXPECT_NE(incognito_browser, p.browser); | 166 EXPECT_NE(incognito_browser, params.browser); |
167 EXPECT_EQ(browser(), p.browser); | 167 EXPECT_EQ(browser(), params.browser); |
168 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 168 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
169 EXPECT_EQ(url, | 169 EXPECT_EQ(url, |
170 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 170 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
171 } | 171 } |
172 | 172 |
173 void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest( | 173 void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest( |
174 const GURL& url) { | 174 const GURL& url) { |
175 Browser* browser = CreateIncognitoBrowser(); | 175 Browser* browser = CreateIncognitoBrowser(); |
176 | 176 |
177 // Set kIncognitoModeAvailability to FORCED. | 177 // Set kIncognitoModeAvailability to FORCED. |
178 PrefService* prefs1 = browser->profile()->GetPrefs(); | 178 PrefService* prefs1 = browser->profile()->GetPrefs(); |
179 prefs1->SetInteger(prefs::kIncognitoModeAvailability, | 179 prefs1->SetInteger(prefs::kIncognitoModeAvailability, |
180 IncognitoModePrefs::FORCED); | 180 IncognitoModePrefs::FORCED); |
181 PrefService* prefs2 = browser->profile()->GetOriginalProfile()->GetPrefs(); | 181 PrefService* prefs2 = browser->profile()->GetOriginalProfile()->GetPrefs(); |
182 prefs2->SetInteger(prefs::kIncognitoModeAvailability, | 182 prefs2->SetInteger(prefs::kIncognitoModeAvailability, |
183 IncognitoModePrefs::FORCED); | 183 IncognitoModePrefs::FORCED); |
184 | 184 |
185 // Navigate to the page. | 185 // Navigate to the page. |
186 chrome::NavigateParams p(MakeNavigateParams(browser)); | 186 chrome::NavigateParams params(MakeNavigateParams(browser)); |
187 p.disposition = OFF_THE_RECORD; | 187 params.disposition = OFF_THE_RECORD; |
188 p.url = url; | 188 params.url = url; |
189 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 189 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
190 chrome::Navigate(&p); | 190 chrome::Navigate(¶ms); |
191 | 191 |
192 // The page should not be opened. | 192 // The page should not be opened. |
193 EXPECT_EQ(browser, p.browser); | 193 EXPECT_EQ(browser, params.browser); |
194 EXPECT_EQ(1, browser->tab_strip_model()->count()); | 194 EXPECT_EQ(1, browser->tab_strip_model()->count()); |
195 EXPECT_EQ(GURL(url::kAboutBlankURL), | 195 EXPECT_EQ(GURL(url::kAboutBlankURL), |
196 browser->tab_strip_model()->GetActiveWebContents()->GetURL()); | 196 browser->tab_strip_model()->GetActiveWebContents()->GetURL()); |
197 } | 197 } |
198 | 198 |
199 void BrowserNavigatorTest::SetUpCommandLine(base::CommandLine* command_line) { | 199 void BrowserNavigatorTest::SetUpCommandLine(base::CommandLine* command_line) { |
200 // Disable settings-in-a-window so that we can use the settings page and | 200 // Disable settings-in-a-window so that we can use the settings page and |
201 // sub-pages to test browser navigation. | 201 // sub-pages to test browser navigation. |
202 command_line->AppendSwitch(::switches::kDisableSettingsWindow); | 202 command_line->AppendSwitch(::switches::kDisableSettingsWindow); |
203 } | 203 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 ui::PAGE_TRANSITION_LINK); | 253 ui::PAGE_TRANSITION_LINK); |
254 | 254 |
255 // We should have one browser with 3 tabs, the 3rd selected. | 255 // We should have one browser with 3 tabs, the 3rd selected. |
256 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 256 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
257 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); | 257 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); |
258 | 258 |
259 unsigned int previous_tab_contents_count = | 259 unsigned int previous_tab_contents_count = |
260 created_tab_contents_count_ = 0; | 260 created_tab_contents_count_ = 0; |
261 | 261 |
262 // Navigate to singleton_url1. | 262 // Navigate to singleton_url1. |
263 chrome::NavigateParams p(MakeNavigateParams()); | 263 chrome::NavigateParams params(MakeNavigateParams()); |
264 p.disposition = SINGLETON_TAB; | 264 params.disposition = SINGLETON_TAB; |
265 p.url = singleton_url1; | 265 params.url = singleton_url1; |
266 chrome::Navigate(&p); | 266 chrome::Navigate(¶ms); |
267 | 267 |
268 // The middle tab should now be selected. | 268 // The middle tab should now be selected. |
269 EXPECT_EQ(browser(), p.browser); | 269 EXPECT_EQ(browser(), params.browser); |
270 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 270 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
271 | 271 |
272 // No tab contents should have been created | 272 // No tab contents should have been created |
273 EXPECT_EQ(previous_tab_contents_count, | 273 EXPECT_EQ(previous_tab_contents_count, |
274 created_tab_contents_count_); | 274 created_tab_contents_count_); |
275 } | 275 } |
276 | 276 |
277 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 277 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
278 Disposition_SingletonTabRespectingRef) { | 278 Disposition_SingletonTabRespectingRef) { |
279 GURL singleton_ref_url1("http://maps.google.com/#a"); | 279 GURL singleton_ref_url1("http://maps.google.com/#a"); |
280 GURL singleton_ref_url2("http://maps.google.com/#b"); | 280 GURL singleton_ref_url2("http://maps.google.com/#b"); |
281 GURL singleton_ref_url3("http://maps.google.com/"); | 281 GURL singleton_ref_url3("http://maps.google.com/"); |
282 | 282 |
283 chrome::AddSelectedTabWithURL(browser(), singleton_ref_url1, | 283 chrome::AddSelectedTabWithURL(browser(), singleton_ref_url1, |
284 ui::PAGE_TRANSITION_LINK); | 284 ui::PAGE_TRANSITION_LINK); |
285 | 285 |
286 // We should have one browser with 2 tabs, 2nd selected. | 286 // We should have one browser with 2 tabs, 2nd selected. |
287 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 287 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
288 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 288 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
289 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 289 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
290 | 290 |
291 // Navigate to singleton_url2. | 291 // Navigate to singleton_url2. |
292 chrome::NavigateParams p(MakeNavigateParams()); | 292 chrome::NavigateParams params(MakeNavigateParams()); |
293 p.disposition = SINGLETON_TAB; | 293 params.disposition = SINGLETON_TAB; |
294 p.url = singleton_ref_url2; | 294 params.url = singleton_ref_url2; |
295 chrome::Navigate(&p); | 295 chrome::Navigate(¶ms); |
296 | 296 |
297 // We should now have 2 tabs, the 2nd one selected. | 297 // We should now have 2 tabs, the 2nd one selected. |
298 EXPECT_EQ(browser(), p.browser); | 298 EXPECT_EQ(browser(), params.browser); |
299 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 299 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
300 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 300 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
301 | 301 |
302 // Navigate to singleton_url2, but with respect ref set. | 302 // Navigate to singleton_url2, but with respect ref set. |
303 p = MakeNavigateParams(); | 303 params = MakeNavigateParams(); |
304 p.disposition = SINGLETON_TAB; | 304 params.disposition = SINGLETON_TAB; |
305 p.url = singleton_ref_url2; | 305 params.url = singleton_ref_url2; |
306 p.ref_behavior = chrome::NavigateParams::RESPECT_REF; | 306 params.ref_behavior = chrome::NavigateParams::RESPECT_REF; |
307 chrome::Navigate(&p); | 307 chrome::Navigate(¶ms); |
308 | 308 |
309 // We should now have 3 tabs, the 3th one selected. | 309 // We should now have 3 tabs, the 3th one selected. |
310 EXPECT_EQ(browser(), p.browser); | 310 EXPECT_EQ(browser(), params.browser); |
311 EXPECT_EQ(3, browser()->tab_strip_model()->count()); | 311 EXPECT_EQ(3, browser()->tab_strip_model()->count()); |
312 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); | 312 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); |
313 | 313 |
314 // Navigate to singleton_url3. | 314 // Navigate to singleton_url3. |
315 p = MakeNavigateParams(); | 315 params = MakeNavigateParams(); |
316 p.disposition = SINGLETON_TAB; | 316 params.disposition = SINGLETON_TAB; |
317 p.url = singleton_ref_url3; | 317 params.url = singleton_ref_url3; |
318 p.ref_behavior = chrome::NavigateParams::RESPECT_REF; | 318 params.ref_behavior = chrome::NavigateParams::RESPECT_REF; |
319 chrome::Navigate(&p); | 319 chrome::Navigate(¶ms); |
320 | 320 |
321 // We should now have 4 tabs, the 4th one selected. | 321 // We should now have 4 tabs, the 4th one selected. |
322 EXPECT_EQ(browser(), p.browser); | 322 EXPECT_EQ(browser(), params.browser); |
323 EXPECT_EQ(4, browser()->tab_strip_model()->count()); | 323 EXPECT_EQ(4, browser()->tab_strip_model()->count()); |
324 EXPECT_EQ(3, browser()->tab_strip_model()->active_index()); | 324 EXPECT_EQ(3, browser()->tab_strip_model()->active_index()); |
325 } | 325 } |
326 | 326 |
327 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 327 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
328 Disposition_SingletonTabNoneExisting) { | 328 Disposition_SingletonTabNoneExisting) { |
329 GURL singleton_url1("http://maps.google.com/"); | 329 GURL singleton_url1("http://maps.google.com/"); |
330 | 330 |
331 // We should have one browser with 1 tab. | 331 // We should have one browser with 1 tab. |
332 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 332 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
333 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); | 333 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); |
334 | 334 |
335 // Navigate to singleton_url1. | 335 // Navigate to singleton_url1. |
336 chrome::NavigateParams p(MakeNavigateParams()); | 336 chrome::NavigateParams params(MakeNavigateParams()); |
337 p.disposition = SINGLETON_TAB; | 337 params.disposition = SINGLETON_TAB; |
338 p.url = singleton_url1; | 338 params.url = singleton_url1; |
339 chrome::Navigate(&p); | 339 chrome::Navigate(¶ms); |
340 | 340 |
341 // We should now have 2 tabs, the 2nd one selected. | 341 // We should now have 2 tabs, the 2nd one selected. |
342 EXPECT_EQ(browser(), p.browser); | 342 EXPECT_EQ(browser(), params.browser); |
343 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 343 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
344 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 344 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
345 } | 345 } |
346 | 346 |
347 // This test verifies that when a navigation results in a foreground tab, the | 347 // This test verifies that when a navigation results in a foreground tab, the |
348 // tab count of the Browser increases and the selected tab shifts to the new | 348 // tab count of the Browser increases and the selected tab shifts to the new |
349 // foreground tab. | 349 // foreground tab. |
350 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) { | 350 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) { |
351 WebContents* old_contents = | 351 WebContents* old_contents = |
352 browser()->tab_strip_model()->GetActiveWebContents(); | 352 browser()->tab_strip_model()->GetActiveWebContents(); |
353 chrome::NavigateParams p(MakeNavigateParams()); | 353 chrome::NavigateParams params(MakeNavigateParams()); |
354 p.disposition = NEW_FOREGROUND_TAB; | 354 params.disposition = NEW_FOREGROUND_TAB; |
355 chrome::Navigate(&p); | 355 chrome::Navigate(¶ms); |
356 EXPECT_NE(old_contents, | 356 EXPECT_NE(old_contents, |
357 browser()->tab_strip_model()->GetActiveWebContents()); | 357 browser()->tab_strip_model()->GetActiveWebContents()); |
358 EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(), | 358 EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(), |
359 p.target_contents); | 359 params.target_contents); |
360 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 360 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
361 } | 361 } |
362 | 362 |
363 // This test verifies that when a navigation results in a background tab, the | 363 // This test verifies that when a navigation results in a background tab, the |
364 // tab count of the Browser increases but the selected tab remains the same. | 364 // tab count of the Browser increases but the selected tab remains the same. |
365 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewBackgroundTab) { | 365 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewBackgroundTab) { |
366 WebContents* old_contents = | 366 WebContents* old_contents = |
367 browser()->tab_strip_model()->GetActiveWebContents(); | 367 browser()->tab_strip_model()->GetActiveWebContents(); |
368 chrome::NavigateParams p(MakeNavigateParams()); | 368 chrome::NavigateParams params(MakeNavigateParams()); |
369 p.disposition = NEW_BACKGROUND_TAB; | 369 params.disposition = NEW_BACKGROUND_TAB; |
370 chrome::Navigate(&p); | 370 chrome::Navigate(¶ms); |
371 WebContents* new_contents = | 371 WebContents* new_contents = |
372 browser()->tab_strip_model()->GetActiveWebContents(); | 372 browser()->tab_strip_model()->GetActiveWebContents(); |
373 // The selected tab should have remained unchanged, since the new tab was | 373 // The selected tab should have remained unchanged, since the new tab was |
374 // opened in the background. | 374 // opened in the background. |
375 EXPECT_EQ(old_contents, new_contents); | 375 EXPECT_EQ(old_contents, new_contents); |
376 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 376 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
377 } | 377 } |
378 | 378 |
379 // This test verifies that when a navigation requiring a new foreground tab | 379 // This test verifies that when a navigation requiring a new foreground tab |
380 // occurs in a Browser that cannot host multiple tabs, the new foreground tab | 380 // occurs in a Browser that cannot host multiple tabs, the new foreground tab |
381 // is created in an existing compatible Browser. | 381 // is created in an existing compatible Browser. |
382 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 382 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
383 Disposition_IncompatibleWindow_Existing) { | 383 Disposition_IncompatibleWindow_Existing) { |
384 // Open a foreground tab in a window that cannot open popups when there is an | 384 // Open a foreground tab in a window that cannot open popups when there is an |
385 // existing compatible window somewhere else that they can be opened within. | 385 // existing compatible window somewhere else that they can be opened within. |
386 Browser* popup = CreateEmptyBrowserForType(Browser::TYPE_POPUP, | 386 Browser* popup = CreateEmptyBrowserForType(Browser::TYPE_POPUP, |
387 browser()->profile()); | 387 browser()->profile()); |
388 chrome::NavigateParams p(MakeNavigateParams(popup)); | 388 chrome::NavigateParams params(MakeNavigateParams(popup)); |
389 p.disposition = NEW_FOREGROUND_TAB; | 389 params.disposition = NEW_FOREGROUND_TAB; |
390 chrome::Navigate(&p); | 390 chrome::Navigate(¶ms); |
391 | 391 |
392 // Navigate() should have opened the tab in a different browser since the | 392 // Navigate() should have opened the tab in a different browser since the |
393 // one we supplied didn't support additional tabs. | 393 // one we supplied didn't support additional tabs. |
394 EXPECT_NE(popup, p.browser); | 394 EXPECT_NE(popup, params.browser); |
395 | 395 |
396 // Since browser() is an existing compatible tabbed browser, it should have | 396 // Since browser() is an existing compatible tabbed browser, it should have |
397 // opened the tab there. | 397 // opened the tab there. |
398 EXPECT_EQ(browser(), p.browser); | 398 EXPECT_EQ(browser(), params.browser); |
399 | 399 |
400 // We should be left with 2 windows, the popup with one tab and the browser() | 400 // We should be left with 2 windows, the popup with one tab and the browser() |
401 // provided by the framework with two. | 401 // provided by the framework with two. |
402 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 402 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
403 EXPECT_EQ(1, popup->tab_strip_model()->count()); | 403 EXPECT_EQ(1, popup->tab_strip_model()->count()); |
404 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 404 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
405 } | 405 } |
406 | 406 |
407 // This test verifies that when a navigation requiring a new foreground tab | 407 // This test verifies that when a navigation requiring a new foreground tab |
408 // occurs in a Browser that cannot host multiple tabs and no compatible Browser | 408 // occurs in a Browser that cannot host multiple tabs and no compatible Browser |
409 // that can is open, a compatible Browser is created. | 409 // that can is open, a compatible Browser is created. |
410 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 410 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
411 Disposition_IncompatibleWindow_NoExisting) { | 411 Disposition_IncompatibleWindow_NoExisting) { |
412 // We want to simulate not being able to find an existing window compatible | 412 // We want to simulate not being able to find an existing window compatible |
413 // with our non-tabbed browser window so Navigate() is forced to create a | 413 // with our non-tabbed browser window so Navigate() is forced to create a |
414 // new compatible window. Because browser() supplied by the in-process | 414 // new compatible window. Because browser() supplied by the in-process |
415 // browser testing framework is compatible with browser()->profile(), we | 415 // browser testing framework is compatible with browser()->profile(), we |
416 // need a different profile, and creating a popup window with an incognito | 416 // need a different profile, and creating a popup window with an incognito |
417 // profile is a quick and dirty way of achieving this. | 417 // profile is a quick and dirty way of achieving this. |
418 Browser* popup = CreateEmptyBrowserForType( | 418 Browser* popup = CreateEmptyBrowserForType( |
419 Browser::TYPE_POPUP, | 419 Browser::TYPE_POPUP, |
420 browser()->profile()->GetOffTheRecordProfile()); | 420 browser()->profile()->GetOffTheRecordProfile()); |
421 chrome::NavigateParams p(MakeNavigateParams(popup)); | 421 chrome::NavigateParams params(MakeNavigateParams(popup)); |
422 p.disposition = NEW_FOREGROUND_TAB; | 422 params.disposition = NEW_FOREGROUND_TAB; |
423 chrome::Navigate(&p); | 423 chrome::Navigate(¶ms); |
424 | 424 |
425 // Navigate() should have opened the tab in a different browser since the | 425 // Navigate() should have opened the tab in a different browser since the |
426 // one we supplied didn't support additional tabs. | 426 // one we supplied didn't support additional tabs. |
427 EXPECT_NE(popup, p.browser); | 427 EXPECT_NE(popup, params.browser); |
428 | 428 |
429 // This time, browser() is _not_ compatible with popup since it is not an | 429 // This time, browser() is _not_ compatible with popup since it is not an |
430 // incognito window. | 430 // incognito window. |
431 EXPECT_NE(browser(), p.browser); | 431 EXPECT_NE(browser(), params.browser); |
432 | 432 |
433 // We should have three windows, each with one tab: | 433 // We should have three windows, each with one tab: |
434 // 1. the browser() provided by the framework (unchanged in this test) | 434 // 1. the browser() provided by the framework (unchanged in this test) |
435 // 2. the incognito popup we created originally | 435 // 2. the incognito popup we created originally |
436 // 3. the new incognito tabbed browser that was created by Navigate(). | 436 // 3. the new incognito tabbed browser that was created by Navigate(). |
437 EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); | 437 EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); |
438 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 438 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
439 EXPECT_EQ(1, popup->tab_strip_model()->count()); | 439 EXPECT_EQ(1, popup->tab_strip_model()->count()); |
440 EXPECT_EQ(1, p.browser->tab_strip_model()->count()); | 440 EXPECT_EQ(1, params.browser->tab_strip_model()->count()); |
441 EXPECT_TRUE(p.browser->is_type_tabbed()); | 441 EXPECT_TRUE(params.browser->is_type_tabbed()); |
442 } | 442 } |
443 | 443 |
444 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP | 444 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
445 // from a normal Browser results in a new Browser with TYPE_POPUP. | 445 // from a normal Browser results in a new Browser with TYPE_POPUP. |
446 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup) { | 446 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup) { |
447 chrome::NavigateParams p(MakeNavigateParams()); | 447 chrome::NavigateParams params(MakeNavigateParams()); |
448 p.disposition = NEW_POPUP; | 448 params.disposition = NEW_POPUP; |
449 p.window_bounds = gfx::Rect(0, 0, 200, 200); | 449 params.window_bounds = gfx::Rect(0, 0, 200, 200); |
450 // Wait for new popup to to load and gain focus. | 450 // Wait for new popup to to load and gain focus. |
451 ui_test_utils::NavigateToURL(&p); | 451 ui_test_utils::NavigateToURL(¶ms); |
452 | 452 |
453 // Navigate() should have opened a new, focused popup window. | 453 // Navigate() should have opened a new, focused popup window. |
454 EXPECT_NE(browser(), p.browser); | 454 EXPECT_NE(browser(), params.browser); |
455 #if 0 | 455 #if 0 |
456 // TODO(stevenjb): Enable this test. See: crbug.com/79493 | 456 // TODO(stevenjb): Enable this test. See: crbug.com/79493 |
457 EXPECT_TRUE(p.browser->window()->IsActive()); | 457 EXPECT_TRUE(browser->window()->IsActive()); |
458 #endif | 458 #endif |
459 EXPECT_TRUE(p.browser->is_type_popup()); | 459 EXPECT_TRUE(params.browser->is_type_popup()); |
460 EXPECT_FALSE(p.browser->is_app()); | 460 EXPECT_FALSE(params.browser->is_app()); |
461 | 461 |
462 // We should have two windows, the browser() provided by the framework and the | 462 // We should have two windows, the browser() provided by the framework and the |
463 // new popup window. | 463 // new popup window. |
464 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 464 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
465 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 465 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
466 EXPECT_EQ(1, p.browser->tab_strip_model()->count()); | 466 EXPECT_EQ(1, params.browser->tab_strip_model()->count()); |
467 } | 467 } |
468 | 468 |
469 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP | 469 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
470 // from a normal Browser results in a new Browser with is_app() true. | 470 // from a normal Browser results in a new Browser with is_app() true. |
471 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup_ExtensionId) { | 471 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup_ExtensionId) { |
472 chrome::NavigateParams p(MakeNavigateParams()); | 472 chrome::NavigateParams params(MakeNavigateParams()); |
473 p.disposition = NEW_POPUP; | 473 params.disposition = NEW_POPUP; |
474 p.extension_app_id = "extensionappid"; | 474 params.extension_app_id = "extensionappid"; |
475 p.window_bounds = gfx::Rect(0, 0, 200, 200); | 475 params.window_bounds = gfx::Rect(0, 0, 200, 200); |
476 // Wait for new popup to to load and gain focus. | 476 // Wait for new popup to to load and gain focus. |
477 ui_test_utils::NavigateToURL(&p); | 477 ui_test_utils::NavigateToURL(¶ms); |
478 | 478 |
479 // Navigate() should have opened a new, focused popup window. | 479 // Navigate() should have opened a new, focused popup window. |
480 EXPECT_NE(browser(), p.browser); | 480 EXPECT_NE(browser(), params.browser); |
481 EXPECT_TRUE(p.browser->is_type_popup()); | 481 EXPECT_TRUE(params.browser->is_type_popup()); |
482 EXPECT_TRUE(p.browser->is_app()); | 482 EXPECT_TRUE(params.browser->is_app()); |
483 | 483 |
484 // We should have two windows, the browser() provided by the framework and the | 484 // We should have two windows, the browser() provided by the framework and the |
485 // new popup window. | 485 // new popup window. |
486 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 486 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
487 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 487 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
488 EXPECT_EQ(1, p.browser->tab_strip_model()->count()); | 488 EXPECT_EQ(1, params.browser->tab_strip_model()->count()); |
489 } | 489 } |
490 | 490 |
491 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP | 491 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
492 // from a normal popup results in a new Browser with TYPE_POPUP. | 492 // from a normal popup results in a new Browser with TYPE_POPUP. |
493 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupFromPopup) { | 493 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupFromPopup) { |
494 // Open a popup. | 494 // Open a popup. |
495 chrome::NavigateParams p1(MakeNavigateParams()); | 495 chrome::NavigateParams params1(MakeNavigateParams()); |
496 p1.disposition = NEW_POPUP; | 496 params1.disposition = NEW_POPUP; |
497 p1.window_bounds = gfx::Rect(0, 0, 200, 200); | 497 params1.window_bounds = gfx::Rect(0, 0, 200, 200); |
498 chrome::Navigate(&p1); | 498 chrome::Navigate(¶ms1); |
499 // Open another popup. | 499 // Open another popup. |
500 chrome::NavigateParams p2(MakeNavigateParams(p1.browser)); | 500 chrome::NavigateParams params2(MakeNavigateParams(params1.browser)); |
501 p2.disposition = NEW_POPUP; | 501 params2.disposition = NEW_POPUP; |
502 p2.window_bounds = gfx::Rect(0, 0, 200, 200); | 502 params2.window_bounds = gfx::Rect(0, 0, 200, 200); |
503 chrome::Navigate(&p2); | 503 chrome::Navigate(¶ms2); |
504 | 504 |
505 // Navigate() should have opened a new normal popup window. | 505 // Navigate() should have opened a new normal popup window. |
506 EXPECT_NE(p1.browser, p2.browser); | 506 EXPECT_NE(params1.browser, params2.browser); |
507 EXPECT_TRUE(p2.browser->is_type_popup()); | 507 EXPECT_TRUE(params2.browser->is_type_popup()); |
508 EXPECT_FALSE(p2.browser->is_app()); | 508 EXPECT_FALSE(params2.browser->is_app()); |
509 | 509 |
510 // We should have three windows, the browser() provided by the framework, | 510 // We should have three windows, the browser() provided by the framework, |
511 // the first popup window, and the second popup window. | 511 // the first popup window, and the second popup window. |
512 EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); | 512 EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); |
513 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 513 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
514 EXPECT_EQ(1, p1.browser->tab_strip_model()->count()); | 514 EXPECT_EQ(1, params1.browser->tab_strip_model()->count()); |
515 EXPECT_EQ(1, p2.browser->tab_strip_model()->count()); | 515 EXPECT_EQ(1, params2.browser->tab_strip_model()->count()); |
516 } | 516 } |
517 | 517 |
518 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP | 518 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
519 // from an app frame results in a new Browser with TYPE_POPUP. | 519 // from an app frame results in a new Browser with TYPE_POPUP. |
520 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 520 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
521 Disposition_NewPopupFromAppWindow) { | 521 Disposition_NewPopupFromAppWindow) { |
522 Browser* app_browser = CreateEmptyBrowserForApp(browser()->profile()); | 522 Browser* app_browser = CreateEmptyBrowserForApp(browser()->profile()); |
523 chrome::NavigateParams p(MakeNavigateParams(app_browser)); | 523 chrome::NavigateParams params(MakeNavigateParams(app_browser)); |
524 p.disposition = NEW_POPUP; | 524 params.disposition = NEW_POPUP; |
525 p.window_bounds = gfx::Rect(0, 0, 200, 200); | 525 params.window_bounds = gfx::Rect(0, 0, 200, 200); |
526 chrome::Navigate(&p); | 526 chrome::Navigate(¶ms); |
527 | 527 |
528 // Navigate() should have opened a new popup app window. | 528 // Navigate() should have opened a new popup app window. |
529 EXPECT_NE(app_browser, p.browser); | 529 EXPECT_NE(app_browser, params.browser); |
530 EXPECT_NE(browser(), p.browser); | 530 EXPECT_NE(browser(), params.browser); |
531 EXPECT_TRUE(p.browser->is_type_popup()); | 531 EXPECT_TRUE(params.browser->is_type_popup()); |
532 EXPECT_TRUE(p.browser->is_app()); | 532 EXPECT_TRUE(params.browser->is_app()); |
533 | 533 |
534 // We should now have three windows, the app window, the app popup it created, | 534 // We should now have three windows, the app window, the app popup it created, |
535 // and the original browser() provided by the framework. | 535 // and the original browser() provided by the framework. |
536 EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); | 536 EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); |
537 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 537 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
538 EXPECT_EQ(1, app_browser->tab_strip_model()->count()); | 538 EXPECT_EQ(1, app_browser->tab_strip_model()->count()); |
539 EXPECT_EQ(1, p.browser->tab_strip_model()->count()); | 539 EXPECT_EQ(1, params.browser->tab_strip_model()->count()); |
540 } | 540 } |
541 | 541 |
542 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP | 542 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
543 // from an app popup results in a new Browser also of TYPE_POPUP. | 543 // from an app popup results in a new Browser also of TYPE_POPUP. |
544 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 544 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
545 Disposition_NewPopupFromAppPopup) { | 545 Disposition_NewPopupFromAppPopup) { |
546 Browser* app_browser = CreateEmptyBrowserForApp(browser()->profile()); | 546 Browser* app_browser = CreateEmptyBrowserForApp(browser()->profile()); |
547 // Open an app popup. | 547 // Open an app popup. |
548 chrome::NavigateParams p1(MakeNavigateParams(app_browser)); | 548 chrome::NavigateParams params1(MakeNavigateParams(app_browser)); |
549 p1.disposition = NEW_POPUP; | 549 params1.disposition = NEW_POPUP; |
550 p1.window_bounds = gfx::Rect(0, 0, 200, 200); | 550 params1.window_bounds = gfx::Rect(0, 0, 200, 200); |
551 chrome::Navigate(&p1); | 551 chrome::Navigate(¶ms1); |
552 // Now open another app popup. | 552 // Now open another app popup. |
553 chrome::NavigateParams p2(MakeNavigateParams(p1.browser)); | 553 chrome::NavigateParams params2(MakeNavigateParams(params1.browser)); |
554 p2.disposition = NEW_POPUP; | 554 params2.disposition = NEW_POPUP; |
555 p2.window_bounds = gfx::Rect(0, 0, 200, 200); | 555 params2.window_bounds = gfx::Rect(0, 0, 200, 200); |
556 chrome::Navigate(&p2); | 556 chrome::Navigate(¶ms2); |
557 | 557 |
558 // Navigate() should have opened a new popup app window. | 558 // Navigate() should have opened a new popup app window. |
559 EXPECT_NE(browser(), p1.browser); | 559 EXPECT_NE(browser(), params1.browser); |
560 EXPECT_NE(p1.browser, p2.browser); | 560 EXPECT_NE(params1.browser, params2.browser); |
561 EXPECT_TRUE(p2.browser->is_type_popup()); | 561 EXPECT_TRUE(params2.browser->is_type_popup()); |
562 EXPECT_TRUE(p2.browser->is_app()); | 562 EXPECT_TRUE(params2.browser->is_app()); |
563 | 563 |
564 // We should now have four windows, the app window, the first app popup, | 564 // We should now have four windows, the app window, the first app popup, |
565 // the second app popup, and the original browser() provided by the framework. | 565 // the second app popup, and the original browser() provided by the framework. |
566 EXPECT_EQ(4u, chrome::GetTotalBrowserCount()); | 566 EXPECT_EQ(4u, chrome::GetTotalBrowserCount()); |
567 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 567 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
568 EXPECT_EQ(1, app_browser->tab_strip_model()->count()); | 568 EXPECT_EQ(1, app_browser->tab_strip_model()->count()); |
569 EXPECT_EQ(1, p1.browser->tab_strip_model()->count()); | 569 EXPECT_EQ(1, params1.browser->tab_strip_model()->count()); |
570 EXPECT_EQ(1, p2.browser->tab_strip_model()->count()); | 570 EXPECT_EQ(1, params2.browser->tab_strip_model()->count()); |
571 } | 571 } |
572 | 572 |
573 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP | 573 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
574 // from an extension app tab results in a new Browser with TYPE_APP_POPUP. | 574 // from an extension app tab results in a new Browser with TYPE_APP_POPUP. |
575 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 575 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
576 Disposition_NewPopupFromExtensionApp) { | 576 Disposition_NewPopupFromExtensionApp) { |
577 // TODO(beng): TBD. | 577 // TODO(beng): TBD. |
578 } | 578 } |
579 | 579 |
580 // This test verifies that navigating with window_action = SHOW_WINDOW_INACTIVE | 580 // This test verifies that navigating with window_action = SHOW_WINDOW_INACTIVE |
581 // does not focus a new new popup window. | 581 // does not focus a new new popup window. |
582 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupUnfocused) { | 582 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupUnfocused) { |
583 chrome::NavigateParams p(MakeNavigateParams()); | 583 chrome::NavigateParams params(MakeNavigateParams()); |
584 p.disposition = NEW_POPUP; | 584 params.disposition = NEW_POPUP; |
585 p.window_bounds = gfx::Rect(0, 0, 200, 200); | 585 params.window_bounds = gfx::Rect(0, 0, 200, 200); |
586 p.window_action = chrome::NavigateParams::SHOW_WINDOW_INACTIVE; | 586 params.window_action = chrome::NavigateParams::SHOW_WINDOW_INACTIVE; |
587 // Wait for new popup to load (and gain focus if the test fails). | 587 // Wait for new popup to load (and gain focus if the test fails). |
588 ui_test_utils::NavigateToURL(&p); | 588 ui_test_utils::NavigateToURL(¶ms); |
589 | 589 |
590 // Navigate() should have opened a new, unfocused, popup window. | 590 // Navigate() should have opened a new, unfocused, popup window. |
591 EXPECT_NE(browser(), p.browser); | 591 EXPECT_NE(browser(), params.browser); |
592 EXPECT_EQ(Browser::TYPE_POPUP, p.browser->type()); | 592 EXPECT_EQ(Browser::TYPE_POPUP, params.browser->type()); |
593 #if 0 | 593 #if 0 |
594 // TODO(stevenjb): Enable this test. See: crbug.com/79493 | 594 // TODO(stevenjb): Enable this test. See: crbug.com/79493 |
595 EXPECT_FALSE(p.browser->window()->IsActive()); | 595 EXPECT_FALSE(p.browser->window()->IsActive()); |
596 #endif | 596 #endif |
597 } | 597 } |
598 | 598 |
599 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP | 599 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
600 // and trusted_source = true results in a new Browser where is_trusted_source() | 600 // and trusted_source = true results in a new Browser where is_trusted_source() |
601 // is true. | 601 // is true. |
602 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupTrusted) { | 602 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupTrusted) { |
603 chrome::NavigateParams p(MakeNavigateParams()); | 603 chrome::NavigateParams params(MakeNavigateParams()); |
604 p.disposition = NEW_POPUP; | 604 params.disposition = NEW_POPUP; |
605 p.trusted_source = true; | 605 params.trusted_source = true; |
606 p.window_bounds = gfx::Rect(0, 0, 200, 200); | 606 params.window_bounds = gfx::Rect(0, 0, 200, 200); |
607 // Wait for new popup to to load and gain focus. | 607 // Wait for new popup to to load and gain focus. |
608 ui_test_utils::NavigateToURL(&p); | 608 ui_test_utils::NavigateToURL(¶ms); |
609 | 609 |
610 // Navigate() should have opened a new popup window of TYPE_TRUSTED_POPUP. | 610 // Navigate() should have opened a new popup window of TYPE_TRUSTED_POPUP. |
611 EXPECT_NE(browser(), p.browser); | 611 EXPECT_NE(browser(), params.browser); |
612 EXPECT_TRUE(p.browser->is_type_popup()); | 612 EXPECT_TRUE(params.browser->is_type_popup()); |
613 EXPECT_TRUE(p.browser->is_trusted_source()); | 613 EXPECT_TRUE(params.browser->is_trusted_source()); |
614 } | 614 } |
615 | 615 |
616 | 616 |
617 // This test verifies that navigating with WindowOpenDisposition = NEW_WINDOW | 617 // This test verifies that navigating with WindowOpenDisposition = NEW_WINDOW |
618 // always opens a new window. | 618 // always opens a new window. |
619 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewWindow) { | 619 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewWindow) { |
620 chrome::NavigateParams p(MakeNavigateParams()); | 620 chrome::NavigateParams params(MakeNavigateParams()); |
621 p.disposition = NEW_WINDOW; | 621 params.disposition = NEW_WINDOW; |
622 chrome::Navigate(&p); | 622 chrome::Navigate(¶ms); |
623 | 623 |
624 // Navigate() should have opened a new toplevel window. | 624 // Navigate() should have opened a new toplevel window. |
625 EXPECT_NE(browser(), p.browser); | 625 EXPECT_NE(browser(), params.browser); |
626 EXPECT_TRUE(p.browser->is_type_tabbed()); | 626 EXPECT_TRUE(params.browser->is_type_tabbed()); |
627 | 627 |
628 // We should now have two windows, the browser() provided by the framework and | 628 // We should now have two windows, the browser() provided by the framework and |
629 // the new normal window. | 629 // the new normal window. |
630 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 630 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
631 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 631 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
632 EXPECT_EQ(1, p.browser->tab_strip_model()->count()); | 632 EXPECT_EQ(1, params.browser->tab_strip_model()->count()); |
633 } | 633 } |
634 | 634 |
635 // This test verifies that navigating with WindowOpenDisposition = INCOGNITO | 635 // This test verifies that navigating with WindowOpenDisposition = INCOGNITO |
636 // opens a new incognito window if no existing incognito window is present. | 636 // opens a new incognito window if no existing incognito window is present. |
637 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_Incognito) { | 637 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_Incognito) { |
638 chrome::NavigateParams p(MakeNavigateParams()); | 638 chrome::NavigateParams params(MakeNavigateParams()); |
639 p.disposition = OFF_THE_RECORD; | 639 params.disposition = OFF_THE_RECORD; |
640 chrome::Navigate(&p); | 640 chrome::Navigate(¶ms); |
641 | 641 |
642 // Navigate() should have opened a new toplevel incognito window. | 642 // Navigate() should have opened a new toplevel incognito window. |
643 EXPECT_NE(browser(), p.browser); | 643 EXPECT_NE(browser(), params.browser); |
644 EXPECT_EQ(browser()->profile()->GetOffTheRecordProfile(), | 644 EXPECT_EQ(browser()->profile()->GetOffTheRecordProfile(), |
645 p.browser->profile()); | 645 params.browser->profile()); |
646 | 646 |
647 // |source_contents| should be set to NULL because the profile for the new | 647 // |source_contents| should be set to NULL because the profile for the new |
648 // page is different from the originating page. | 648 // page is different from the originating page. |
649 EXPECT_EQ(NULL, p.source_contents); | 649 EXPECT_EQ(NULL, params.source_contents); |
650 | 650 |
651 // We should now have two windows, the browser() provided by the framework and | 651 // We should now have two windows, the browser() provided by the framework and |
652 // the new incognito window. | 652 // the new incognito window. |
653 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 653 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
654 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 654 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
655 EXPECT_EQ(1, p.browser->tab_strip_model()->count()); | 655 EXPECT_EQ(1, params.browser->tab_strip_model()->count()); |
656 } | 656 } |
657 | 657 |
658 // This test verifies that navigating with WindowOpenDisposition = INCOGNITO | 658 // This test verifies that navigating with WindowOpenDisposition = INCOGNITO |
659 // reuses an existing incognito window when possible. | 659 // reuses an existing incognito window when possible. |
660 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IncognitoRefocus) { | 660 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IncognitoRefocus) { |
661 Browser* incognito_browser = | 661 Browser* incognito_browser = |
662 CreateEmptyBrowserForType(Browser::TYPE_TABBED, | 662 CreateEmptyBrowserForType(Browser::TYPE_TABBED, |
663 browser()->profile()->GetOffTheRecordProfile()); | 663 browser()->profile()->GetOffTheRecordProfile()); |
664 chrome::NavigateParams p(MakeNavigateParams()); | 664 chrome::NavigateParams params(MakeNavigateParams()); |
665 p.disposition = OFF_THE_RECORD; | 665 params.disposition = OFF_THE_RECORD; |
666 chrome::Navigate(&p); | 666 chrome::Navigate(¶ms); |
667 | 667 |
668 // Navigate() should have opened a new tab in the existing incognito window. | 668 // Navigate() should have opened a new tab in the existing incognito window. |
669 EXPECT_NE(browser(), p.browser); | 669 EXPECT_NE(browser(), params.browser); |
670 EXPECT_EQ(p.browser, incognito_browser); | 670 EXPECT_EQ(params.browser, incognito_browser); |
671 | 671 |
672 // We should now have two windows, the browser() provided by the framework and | 672 // We should now have two windows, the browser() provided by the framework and |
673 // the incognito window we opened earlier. | 673 // the incognito window we opened earlier. |
674 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 674 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
675 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 675 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
676 EXPECT_EQ(2, incognito_browser->tab_strip_model()->count()); | 676 EXPECT_EQ(2, incognito_browser->tab_strip_model()->count()); |
677 } | 677 } |
678 | 678 |
679 // This test verifies that no navigation action occurs when | 679 // This test verifies that no navigation action occurs when |
680 // WindowOpenDisposition = SUPPRESS_OPEN. | 680 // WindowOpenDisposition = SUPPRESS_OPEN. |
681 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SuppressOpen) { | 681 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SuppressOpen) { |
682 RunSuppressTest(SUPPRESS_OPEN); | 682 RunSuppressTest(SUPPRESS_OPEN); |
683 } | 683 } |
684 | 684 |
685 // This test verifies that no navigation action occurs when | 685 // This test verifies that no navigation action occurs when |
686 // WindowOpenDisposition = SAVE_TO_DISK. | 686 // WindowOpenDisposition = SAVE_TO_DISK. |
687 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SaveToDisk) { | 687 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SaveToDisk) { |
688 RunSuppressTest(SAVE_TO_DISK); | 688 RunSuppressTest(SAVE_TO_DISK); |
689 } | 689 } |
690 | 690 |
691 // This test verifies that no navigation action occurs when | 691 // This test verifies that no navigation action occurs when |
692 // WindowOpenDisposition = IGNORE_ACTION. | 692 // WindowOpenDisposition = IGNORE_ACTION. |
693 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IgnoreAction) { | 693 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IgnoreAction) { |
694 RunSuppressTest(IGNORE_ACTION); | 694 RunSuppressTest(IGNORE_ACTION); |
695 } | 695 } |
696 | 696 |
697 // This tests adding a foreground tab with a predefined WebContents. | 697 // This tests adding a foreground tab with a predefined WebContents. |
698 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) { | 698 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) { |
699 chrome::NavigateParams p(MakeNavigateParams()); | 699 chrome::NavigateParams params(MakeNavigateParams()); |
700 p.disposition = NEW_FOREGROUND_TAB; | 700 params.disposition = NEW_FOREGROUND_TAB; |
701 p.target_contents = CreateWebContents(); | 701 params.target_contents = CreateWebContents(); |
702 chrome::Navigate(&p); | 702 chrome::Navigate(¶ms); |
703 | 703 |
704 // Navigate() should have opened the contents in a new foreground in the | 704 // Navigate() should have opened the contents in a new foreground in the |
705 // current Browser. | 705 // current Browser. |
706 EXPECT_EQ(browser(), p.browser); | 706 EXPECT_EQ(browser(), params.browser); |
707 EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(), | 707 EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(), |
708 p.target_contents); | 708 params.target_contents); |
709 | 709 |
710 // We should have one window, with two tabs. | 710 // We should have one window, with two tabs. |
711 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 711 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
712 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 712 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
713 } | 713 } |
714 | 714 |
715 #if defined(OS_WIN) | 715 #if defined(OS_WIN) |
716 // This tests adding a popup with a predefined WebContents. | 716 // This tests adding a popup with a predefined WebContents. |
717 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_TargetContents_Popup) { | 717 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_TargetContents_Popup) { |
718 chrome::NavigateParams p(MakeNavigateParams()); | 718 chrome::NavigateParams params(MakeNavigateParams()); |
719 p.disposition = NEW_POPUP; | 719 params.disposition = NEW_POPUP; |
720 p.target_contents = CreateWebContents(); | 720 params.target_contents = CreateWebContents(); |
721 p.window_bounds = gfx::Rect(10, 10, 500, 500); | 721 params.window_bounds = gfx::Rect(10, 10, 500, 500); |
722 chrome::Navigate(&p); | 722 chrome::Navigate(¶ms); |
723 | 723 |
724 // Navigate() should have opened a new popup window. | 724 // Navigate() should have opened a new popup window. |
725 EXPECT_NE(browser(), p.browser); | 725 EXPECT_NE(browser(), params.browser); |
726 EXPECT_TRUE(p.browser->is_type_popup()); | 726 EXPECT_TRUE(params.browser->is_type_popup()); |
727 EXPECT_FALSE(p.browser->is_app()); | 727 EXPECT_FALSE(params.browser->is_app()); |
728 | 728 |
729 // The web platform is weird. The window bounds specified in | 729 // The web platform is weird. The window bounds specified in |
730 // |p.window_bounds| are used as follows: | 730 // |params.window_bounds| are used as follows: |
731 // - the origin is used to position the window | 731 // - the origin is used to position the window |
732 // - the size is used to size the WebContents of the window. | 732 // - the size is used to size the WebContents of the window. |
733 // As such the position of the resulting window will always match | 733 // As such the position of the resulting window will always match |
734 // p.window_bounds.origin(), but its size will not. We need to match | 734 // params.window_bounds.origin(), but its size will not. We need to match |
735 // the size against the selected tab's view's container size. | 735 // the size against the selected tab's view's container size. |
736 // Only Windows positions the window according to |p.window_bounds.origin()| - | 736 // Only Windows positions the window according to |
737 // on Mac the window is offset from the opener and on Linux it always opens | 737 // |params.window_bounds.origin()| - on Mac the window is offset from the |
738 // at 0,0. | 738 // opener and on Linux it always opens at 0,0. |
739 EXPECT_EQ(p.window_bounds.origin(), | 739 EXPECT_EQ(params.window_bounds.origin(), |
740 p.browser->window()->GetRestoredBounds().origin()); | 740 params.browser->window()->GetRestoredBounds().origin()); |
741 // All platforms should respect size however provided width > 400 (Mac has a | 741 // All platforms should respect size however provided width > 400 (Mac has a |
742 // minimum window width of 400). | 742 // minimum window width of 400). |
743 EXPECT_EQ(p.window_bounds.size(), | 743 EXPECT_EQ(params.window_bounds.size(), |
744 p.target_contents->GetContainerBounds().size()); | 744 params.target_contents->GetContainerBounds().size()); |
745 | 745 |
746 // We should have two windows, the new popup and the browser() provided by the | 746 // We should have two windows, the new popup and the browser() provided by the |
747 // framework. | 747 // framework. |
748 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 748 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
749 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 749 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
750 EXPECT_EQ(1, p.browser->tab_strip_model()->count()); | 750 EXPECT_EQ(1, params.browser->tab_strip_model()->count()); |
751 } | 751 } |
752 #endif | 752 #endif |
753 | 753 |
754 // This tests adding a tab at a specific index. | 754 // This tests adding a tab at a specific index. |
755 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Tabstrip_InsertAtIndex) { | 755 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Tabstrip_InsertAtIndex) { |
756 // This is not meant to be a comprehensive test of whether or not the tab | 756 // This is not meant to be a comprehensive test of whether or not the tab |
757 // implementation of the browser observes the insertion index. That is | 757 // implementation of the browser observes the insertion index. That is |
758 // covered by the unit tests for TabStripModel. This merely verifies that | 758 // covered by the unit tests for TabStripModel. This merely verifies that |
759 // insertion index preference is reflected in common cases. | 759 // insertion index preference is reflected in common cases. |
760 chrome::NavigateParams p(MakeNavigateParams()); | 760 chrome::NavigateParams params(MakeNavigateParams()); |
761 p.disposition = NEW_FOREGROUND_TAB; | 761 params.disposition = NEW_FOREGROUND_TAB; |
762 p.tabstrip_index = 0; | 762 params.tabstrip_index = 0; |
763 p.tabstrip_add_types = TabStripModel::ADD_FORCE_INDEX; | 763 params.tabstrip_add_types = TabStripModel::ADD_FORCE_INDEX; |
764 chrome::Navigate(&p); | 764 chrome::Navigate(¶ms); |
765 | 765 |
766 // Navigate() should have inserted a new tab at slot 0 in the tabstrip. | 766 // Navigate() should have inserted a new tab at slot 0 in the tabstrip. |
767 EXPECT_EQ(browser(), p.browser); | 767 EXPECT_EQ(browser(), params.browser); |
768 EXPECT_EQ(0, browser()->tab_strip_model()->GetIndexOfWebContents( | 768 EXPECT_EQ(0, browser()->tab_strip_model()->GetIndexOfWebContents( |
769 static_cast<const WebContents*>(p.target_contents))); | 769 static_cast<const WebContents*>(params.target_contents))); |
770 | 770 |
771 // We should have one window - the browser() provided by the framework. | 771 // We should have one window - the browser() provided by the framework. |
772 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 772 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
773 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 773 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
774 } | 774 } |
775 | 775 |
776 // This test verifies that constructing params with disposition = SINGLETON_TAB | 776 // This test verifies that constructing params with disposition = SINGLETON_TAB |
777 // and IGNORE_AND_NAVIGATE opens a new tab navigated to the specified URL if | 777 // and IGNORE_AND_NAVIGATE opens a new tab navigated to the specified URL if |
778 // no previous tab with that URL (minus the path) exists. | 778 // no previous tab with that URL (minus the path) exists. |
779 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 779 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
780 Disposition_SingletonTabNew_IgnorePath) { | 780 Disposition_SingletonTabNew_IgnorePath) { |
781 chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(), | 781 chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(), |
782 ui::PAGE_TRANSITION_LINK); | 782 ui::PAGE_TRANSITION_LINK); |
783 | 783 |
784 // We should have one browser with 2 tabs, the 2nd selected. | 784 // We should have one browser with 2 tabs, the 2nd selected. |
785 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 785 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
786 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 786 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
787 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 787 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
788 | 788 |
789 // Navigate to a new singleton tab with a sub-page. | 789 // Navigate to a new singleton tab with a sub-page. |
790 chrome::NavigateParams p(MakeNavigateParams()); | 790 chrome::NavigateParams params(MakeNavigateParams()); |
791 p.disposition = SINGLETON_TAB; | 791 params.disposition = SINGLETON_TAB; |
792 p.url = GetContentSettingsURL(); | 792 params.url = GetContentSettingsURL(); |
793 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 793 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
794 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 794 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
795 chrome::Navigate(&p); | 795 chrome::Navigate(¶ms); |
796 | 796 |
797 // The last tab should now be selected and navigated to the sub-page of the | 797 // The last tab should now be selected and navigated to the sub-page of the |
798 // URL. | 798 // URL. |
799 EXPECT_EQ(browser(), p.browser); | 799 EXPECT_EQ(browser(), params.browser); |
800 EXPECT_EQ(3, browser()->tab_strip_model()->count()); | 800 EXPECT_EQ(3, browser()->tab_strip_model()->count()); |
801 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); | 801 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); |
802 EXPECT_EQ(GetContentSettingsURL(), | 802 EXPECT_EQ(GetContentSettingsURL(), |
803 ShortenUberURL(browser()->tab_strip_model()-> | 803 ShortenUberURL(browser()->tab_strip_model()-> |
804 GetActiveWebContents()->GetURL())); | 804 GetActiveWebContents()->GetURL())); |
805 } | 805 } |
806 | 806 |
807 // This test verifies that constructing params with disposition = SINGLETON_TAB | 807 // This test verifies that constructing params with disposition = SINGLETON_TAB |
808 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus | 808 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus |
809 // the path) which is navigated to the specified URL. | 809 // the path) which is navigated to the specified URL. |
810 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 810 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
811 Disposition_SingletonTabExisting_IgnorePath) { | 811 Disposition_SingletonTabExisting_IgnorePath) { |
812 GURL singleton_url1(GetSettingsURL()); | 812 GURL singleton_url1(GetSettingsURL()); |
813 chrome::AddSelectedTabWithURL(browser(), singleton_url1, | 813 chrome::AddSelectedTabWithURL(browser(), singleton_url1, |
814 ui::PAGE_TRANSITION_LINK); | 814 ui::PAGE_TRANSITION_LINK); |
815 chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(), | 815 chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(), |
816 ui::PAGE_TRANSITION_LINK); | 816 ui::PAGE_TRANSITION_LINK); |
817 | 817 |
818 // We should have one browser with 3 tabs, the 3rd selected. | 818 // We should have one browser with 3 tabs, the 3rd selected. |
819 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 819 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
820 EXPECT_EQ(3, browser()->tab_strip_model()->count()); | 820 EXPECT_EQ(3, browser()->tab_strip_model()->count()); |
821 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); | 821 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); |
822 | 822 |
823 // Navigate to singleton_url1. | 823 // Navigate to singleton_url1. |
824 chrome::NavigateParams p(MakeNavigateParams()); | 824 chrome::NavigateParams params(MakeNavigateParams()); |
825 p.disposition = SINGLETON_TAB; | 825 params.disposition = SINGLETON_TAB; |
826 p.url = GetContentSettingsURL(); | 826 params.url = GetContentSettingsURL(); |
827 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 827 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
828 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 828 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
829 chrome::Navigate(&p); | 829 chrome::Navigate(¶ms); |
830 | 830 |
831 // The middle tab should now be selected and navigated to the sub-page of the | 831 // The middle tab should now be selected and navigated to the sub-page of the |
832 // URL. | 832 // URL. |
833 EXPECT_EQ(browser(), p.browser); | 833 EXPECT_EQ(browser(), params.browser); |
834 EXPECT_EQ(3, browser()->tab_strip_model()->count()); | 834 EXPECT_EQ(3, browser()->tab_strip_model()->count()); |
835 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 835 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
836 EXPECT_EQ(GetContentSettingsURL(), | 836 EXPECT_EQ(GetContentSettingsURL(), |
837 ShortenUberURL(browser()->tab_strip_model()-> | 837 ShortenUberURL(browser()->tab_strip_model()-> |
838 GetActiveWebContents()->GetURL())); | 838 GetActiveWebContents()->GetURL())); |
839 } | 839 } |
840 | 840 |
841 // This test verifies that constructing params with disposition = SINGLETON_TAB | 841 // This test verifies that constructing params with disposition = SINGLETON_TAB |
842 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus | 842 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus |
843 // the path) which is navigated to the specified URL. | 843 // the path) which is navigated to the specified URL. |
844 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 844 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
845 Disposition_SingletonTabExistingSubPath_IgnorePath) { | 845 Disposition_SingletonTabExistingSubPath_IgnorePath) { |
846 GURL singleton_url1(GetContentSettingsURL()); | 846 GURL singleton_url1(GetContentSettingsURL()); |
847 chrome::AddSelectedTabWithURL(browser(), singleton_url1, | 847 chrome::AddSelectedTabWithURL(browser(), singleton_url1, |
848 ui::PAGE_TRANSITION_LINK); | 848 ui::PAGE_TRANSITION_LINK); |
849 chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(), | 849 chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(), |
850 ui::PAGE_TRANSITION_LINK); | 850 ui::PAGE_TRANSITION_LINK); |
851 | 851 |
852 // We should have one browser with 3 tabs, the 3rd selected. | 852 // We should have one browser with 3 tabs, the 3rd selected. |
853 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 853 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
854 EXPECT_EQ(3, browser()->tab_strip_model()->count()); | 854 EXPECT_EQ(3, browser()->tab_strip_model()->count()); |
855 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); | 855 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); |
856 | 856 |
857 // Navigate to singleton_url1. | 857 // Navigate to singleton_url1. |
858 chrome::NavigateParams p(MakeNavigateParams()); | 858 chrome::NavigateParams params(MakeNavigateParams()); |
859 p.disposition = SINGLETON_TAB; | 859 params.disposition = SINGLETON_TAB; |
860 p.url = GetClearBrowsingDataURL(); | 860 params.url = GetClearBrowsingDataURL(); |
861 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 861 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
862 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 862 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
863 chrome::Navigate(&p); | 863 chrome::Navigate(¶ms); |
864 | 864 |
865 // The middle tab should now be selected and navigated to the sub-page of the | 865 // The middle tab should now be selected and navigated to the sub-page of the |
866 // URL. | 866 // URL. |
867 EXPECT_EQ(browser(), p.browser); | 867 EXPECT_EQ(browser(), params.browser); |
868 EXPECT_EQ(3, browser()->tab_strip_model()->count()); | 868 EXPECT_EQ(3, browser()->tab_strip_model()->count()); |
869 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 869 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
870 EXPECT_EQ(GetClearBrowsingDataURL(), | 870 EXPECT_EQ(GetClearBrowsingDataURL(), |
871 ShortenUberURL(browser()->tab_strip_model()-> | 871 ShortenUberURL(browser()->tab_strip_model()-> |
872 GetActiveWebContents()->GetURL())); | 872 GetActiveWebContents()->GetURL())); |
873 } | 873 } |
874 | 874 |
875 // This test verifies that constructing params with disposition = SINGLETON_TAB | 875 // This test verifies that constructing params with disposition = SINGLETON_TAB |
876 // and IGNORE_AND_STAY_PUT opens an existing tab with the matching URL (minus | 876 // and IGNORE_AND_STAY_PUT opens an existing tab with the matching URL (minus |
877 // the path). | 877 // the path). |
878 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 878 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
879 Disposition_SingletonTabExistingSubPath_IgnorePath2) { | 879 Disposition_SingletonTabExistingSubPath_IgnorePath2) { |
880 GURL singleton_url1(GetContentSettingsURL()); | 880 GURL singleton_url1(GetContentSettingsURL()); |
881 chrome::AddSelectedTabWithURL(browser(), singleton_url1, | 881 chrome::AddSelectedTabWithURL(browser(), singleton_url1, |
882 ui::PAGE_TRANSITION_LINK); | 882 ui::PAGE_TRANSITION_LINK); |
883 chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(), | 883 chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(), |
884 ui::PAGE_TRANSITION_LINK); | 884 ui::PAGE_TRANSITION_LINK); |
885 | 885 |
886 // We should have one browser with 3 tabs, the 3rd selected. | 886 // We should have one browser with 3 tabs, the 3rd selected. |
887 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 887 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
888 EXPECT_EQ(3, browser()->tab_strip_model()->count()); | 888 EXPECT_EQ(3, browser()->tab_strip_model()->count()); |
889 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); | 889 EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); |
890 | 890 |
891 // Navigate to singleton_url1. | 891 // Navigate to singleton_url1. |
892 chrome::NavigateParams p(MakeNavigateParams()); | 892 chrome::NavigateParams params(MakeNavigateParams()); |
893 p.disposition = SINGLETON_TAB; | 893 params.disposition = SINGLETON_TAB; |
894 p.url = GetClearBrowsingDataURL(); | 894 params.url = GetClearBrowsingDataURL(); |
895 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 895 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
896 p.path_behavior = chrome::NavigateParams::IGNORE_AND_STAY_PUT; | 896 params.path_behavior = chrome::NavigateParams::IGNORE_AND_STAY_PUT; |
897 chrome::Navigate(&p); | 897 chrome::Navigate(¶ms); |
898 | 898 |
899 // The middle tab should now be selected. | 899 // The middle tab should now be selected. |
900 EXPECT_EQ(browser(), p.browser); | 900 EXPECT_EQ(browser(), params.browser); |
901 EXPECT_EQ(3, browser()->tab_strip_model()->count()); | 901 EXPECT_EQ(3, browser()->tab_strip_model()->count()); |
902 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 902 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
903 EXPECT_EQ(singleton_url1, | 903 EXPECT_EQ(singleton_url1, |
904 ShortenUberURL(browser()->tab_strip_model()-> | 904 ShortenUberURL(browser()->tab_strip_model()-> |
905 GetActiveWebContents()->GetURL())); | 905 GetActiveWebContents()->GetURL())); |
906 } | 906 } |
907 | 907 |
908 // This test verifies that constructing params with disposition = SINGLETON_TAB | 908 // This test verifies that constructing params with disposition = SINGLETON_TAB |
909 // and IGNORE_AND_NAVIGATE will update the current tab's URL if the currently | 909 // and IGNORE_AND_NAVIGATE will update the current tab's URL if the currently |
910 // selected tab is a match but has a different path. | 910 // selected tab is a match but has a different path. |
911 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 911 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
912 Disposition_SingletonTabFocused_IgnorePath) { | 912 Disposition_SingletonTabFocused_IgnorePath) { |
913 GURL singleton_url_current(GetContentSettingsURL()); | 913 GURL singleton_url_current(GetContentSettingsURL()); |
914 chrome::AddSelectedTabWithURL(browser(), singleton_url_current, | 914 chrome::AddSelectedTabWithURL(browser(), singleton_url_current, |
915 ui::PAGE_TRANSITION_LINK); | 915 ui::PAGE_TRANSITION_LINK); |
916 | 916 |
917 // We should have one browser with 2 tabs, the 2nd selected. | 917 // We should have one browser with 2 tabs, the 2nd selected. |
918 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 918 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
919 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 919 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
920 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 920 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
921 | 921 |
922 // Navigate to a different settings path. | 922 // Navigate to a different settings path. |
923 GURL singleton_url_target(GetClearBrowsingDataURL()); | 923 GURL singleton_url_target(GetClearBrowsingDataURL()); |
924 chrome::NavigateParams p(MakeNavigateParams()); | 924 chrome::NavigateParams params(MakeNavigateParams()); |
925 p.disposition = SINGLETON_TAB; | 925 params.disposition = SINGLETON_TAB; |
926 p.url = singleton_url_target; | 926 params.url = singleton_url_target; |
927 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 927 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
928 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 928 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
929 chrome::Navigate(&p); | 929 chrome::Navigate(¶ms); |
930 | 930 |
931 // The second tab should still be selected, but navigated to the new path. | 931 // The second tab should still be selected, but navigated to the new path. |
932 EXPECT_EQ(browser(), p.browser); | 932 EXPECT_EQ(browser(), params.browser); |
933 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 933 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
934 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 934 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
935 EXPECT_EQ(singleton_url_target, | 935 EXPECT_EQ(singleton_url_target, |
936 ShortenUberURL(browser()->tab_strip_model()-> | 936 ShortenUberURL(browser()->tab_strip_model()-> |
937 GetActiveWebContents()->GetURL())); | 937 GetActiveWebContents()->GetURL())); |
938 } | 938 } |
939 | 939 |
940 // This test verifies that constructing params with disposition = SINGLETON_TAB | 940 // This test verifies that constructing params with disposition = SINGLETON_TAB |
941 // and IGNORE_AND_NAVIGATE will open an existing matching tab with a different | 941 // and IGNORE_AND_NAVIGATE will open an existing matching tab with a different |
942 // query. | 942 // query. |
943 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 943 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
944 Disposition_SingletonTabExisting_IgnoreQuery) { | 944 Disposition_SingletonTabExisting_IgnoreQuery) { |
945 int initial_tab_count = browser()->tab_strip_model()->count(); | 945 int initial_tab_count = browser()->tab_strip_model()->count(); |
946 GURL singleton_url_current("chrome://settings/internet"); | 946 GURL singleton_url_current("chrome://settings/internet"); |
947 chrome::AddSelectedTabWithURL(browser(), singleton_url_current, | 947 chrome::AddSelectedTabWithURL(browser(), singleton_url_current, |
948 ui::PAGE_TRANSITION_LINK); | 948 ui::PAGE_TRANSITION_LINK); |
949 | 949 |
950 EXPECT_EQ(initial_tab_count + 1, browser()->tab_strip_model()->count()); | 950 EXPECT_EQ(initial_tab_count + 1, browser()->tab_strip_model()->count()); |
951 EXPECT_EQ(initial_tab_count, browser()->tab_strip_model()->active_index()); | 951 EXPECT_EQ(initial_tab_count, browser()->tab_strip_model()->active_index()); |
952 | 952 |
953 // Navigate to a different settings path. | 953 // Navigate to a different settings path. |
954 GURL singleton_url_target( | 954 GURL singleton_url_target( |
955 "chrome://settings/internet?" | 955 "chrome://settings/internet?" |
956 "servicePath=/profile/ethernet_00aa00aa00aa&networkType=1"); | 956 "servicePath=/profile/ethernet_00aa00aa00aa&networkType=1"); |
957 chrome::NavigateParams p(MakeNavigateParams()); | 957 chrome::NavigateParams params(MakeNavigateParams()); |
958 p.disposition = SINGLETON_TAB; | 958 params.disposition = SINGLETON_TAB; |
959 p.url = singleton_url_target; | 959 params.url = singleton_url_target; |
960 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 960 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
961 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 961 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
962 chrome::Navigate(&p); | 962 chrome::Navigate(¶ms); |
963 | 963 |
964 // Last tab should still be selected. | 964 // Last tab should still be selected. |
965 EXPECT_EQ(browser(), p.browser); | 965 EXPECT_EQ(browser(), params.browser); |
966 EXPECT_EQ(initial_tab_count + 1, browser()->tab_strip_model()->count()); | 966 EXPECT_EQ(initial_tab_count + 1, browser()->tab_strip_model()->count()); |
967 EXPECT_EQ(initial_tab_count, browser()->tab_strip_model()->active_index()); | 967 EXPECT_EQ(initial_tab_count, browser()->tab_strip_model()->active_index()); |
968 } | 968 } |
969 | 969 |
970 // This test verifies that the settings page isn't opened in the incognito | 970 // This test verifies that the settings page isn't opened in the incognito |
971 // window. | 971 // window. |
972 // Disabled until fixed for uber settings: http://crbug.com/111243 | 972 // Disabled until fixed for uber settings: http://crbug.com/111243 |
973 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 973 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
974 DISABLED_Disposition_Settings_UseNonIncognitoWindow) { | 974 DISABLED_Disposition_Settings_UseNonIncognitoWindow) { |
975 RunUseNonIncognitoWindowTest(GetSettingsURL()); | 975 RunUseNonIncognitoWindowTest(GetSettingsURL()); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 | 1055 |
1056 // We should have one browser with 2 tabs, the 2nd selected. | 1056 // We should have one browser with 2 tabs, the 2nd selected. |
1057 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 1057 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
1058 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 1058 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
1059 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 1059 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
1060 | 1060 |
1061 // Kill the singleton tab. | 1061 // Kill the singleton tab. |
1062 web_contents->SetIsCrashed(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); | 1062 web_contents->SetIsCrashed(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); |
1063 EXPECT_TRUE(web_contents->IsCrashed()); | 1063 EXPECT_TRUE(web_contents->IsCrashed()); |
1064 | 1064 |
1065 chrome::NavigateParams p(MakeNavigateParams()); | 1065 chrome::NavigateParams params(MakeNavigateParams()); |
1066 p.disposition = SINGLETON_TAB; | 1066 params.disposition = SINGLETON_TAB; |
1067 p.url = singleton_url; | 1067 params.url = singleton_url; |
1068 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 1068 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
1069 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 1069 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
1070 ui_test_utils::NavigateToURL(&p); | 1070 ui_test_utils::NavigateToURL(¶ms); |
1071 | 1071 |
1072 // The tab should not be sad anymore. | 1072 // The tab should not be sad anymore. |
1073 EXPECT_FALSE(web_contents->IsCrashed()); | 1073 EXPECT_FALSE(web_contents->IsCrashed()); |
1074 } | 1074 } |
1075 | 1075 |
1076 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1076 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1077 NavigateFromDefaultToOptionsInSameTab) { | 1077 NavigateFromDefaultToOptionsInSameTab) { |
1078 { | 1078 { |
1079 content::WindowedNotificationObserver observer( | 1079 content::WindowedNotificationObserver observer( |
1080 content::NOTIFICATION_LOAD_STOP, | 1080 content::NOTIFICATION_LOAD_STOP, |
1081 content::NotificationService::AllSources()); | 1081 content::NotificationService::AllSources()); |
1082 chrome::ShowSettings(browser()); | 1082 chrome::ShowSettings(browser()); |
1083 observer.Wait(); | 1083 observer.Wait(); |
1084 } | 1084 } |
1085 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 1085 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
1086 EXPECT_EQ(GetSettingsURL(), | 1086 EXPECT_EQ(GetSettingsURL(), |
1087 ShortenUberURL(browser()->tab_strip_model()-> | 1087 ShortenUberURL(browser()->tab_strip_model()-> |
1088 GetActiveWebContents()->GetURL())); | 1088 GetActiveWebContents()->GetURL())); |
1089 } | 1089 } |
1090 | 1090 |
1091 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1091 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1092 NavigateFromBlankToOptionsInSameTab) { | 1092 NavigateFromBlankToOptionsInSameTab) { |
1093 chrome::NavigateParams p(MakeNavigateParams()); | 1093 chrome::NavigateParams params(MakeNavigateParams()); |
1094 p.url = GURL(url::kAboutBlankURL); | 1094 params.url = GURL(url::kAboutBlankURL); |
1095 ui_test_utils::NavigateToURL(&p); | 1095 ui_test_utils::NavigateToURL(¶ms); |
1096 | 1096 |
1097 { | 1097 { |
1098 content::WindowedNotificationObserver observer( | 1098 content::WindowedNotificationObserver observer( |
1099 content::NOTIFICATION_LOAD_STOP, | 1099 content::NOTIFICATION_LOAD_STOP, |
1100 content::NotificationService::AllSources()); | 1100 content::NotificationService::AllSources()); |
1101 chrome::ShowSettings(browser()); | 1101 chrome::ShowSettings(browser()); |
1102 observer.Wait(); | 1102 observer.Wait(); |
1103 } | 1103 } |
1104 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 1104 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
1105 EXPECT_EQ(GetSettingsURL(), | 1105 EXPECT_EQ(GetSettingsURL(), |
1106 ShortenUberURL(browser()->tab_strip_model()-> | 1106 ShortenUberURL(browser()->tab_strip_model()-> |
1107 GetActiveWebContents()->GetURL())); | 1107 GetActiveWebContents()->GetURL())); |
1108 } | 1108 } |
1109 | 1109 |
1110 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1110 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1111 NavigateFromNTPToOptionsInSameTab) { | 1111 NavigateFromNTPToOptionsInSameTab) { |
1112 chrome::NavigateParams p(MakeNavigateParams()); | 1112 chrome::NavigateParams params(MakeNavigateParams()); |
1113 p.url = GURL(chrome::kChromeUINewTabURL); | 1113 params.url = GURL(chrome::kChromeUINewTabURL); |
1114 ui_test_utils::NavigateToURL(&p); | 1114 ui_test_utils::NavigateToURL(¶ms); |
1115 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 1115 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
1116 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), | 1116 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), |
1117 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 1117 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
1118 | 1118 |
1119 { | 1119 { |
1120 content::WindowedNotificationObserver observer( | 1120 content::WindowedNotificationObserver observer( |
1121 content::NOTIFICATION_LOAD_STOP, | 1121 content::NOTIFICATION_LOAD_STOP, |
1122 content::NotificationService::AllSources()); | 1122 content::NotificationService::AllSources()); |
1123 chrome::ShowSettings(browser()); | 1123 chrome::ShowSettings(browser()); |
1124 observer.Wait(); | 1124 observer.Wait(); |
1125 } | 1125 } |
1126 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 1126 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
1127 EXPECT_EQ(GetSettingsURL(), | 1127 EXPECT_EQ(GetSettingsURL(), |
1128 ShortenUberURL(browser()->tab_strip_model()-> | 1128 ShortenUberURL(browser()->tab_strip_model()-> |
1129 GetActiveWebContents()->GetURL())); | 1129 GetActiveWebContents()->GetURL())); |
1130 } | 1130 } |
1131 | 1131 |
1132 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1132 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1133 NavigateFromPageToOptionsInNewTab) { | 1133 NavigateFromPageToOptionsInNewTab) { |
1134 chrome::NavigateParams p(MakeNavigateParams()); | 1134 chrome::NavigateParams params(MakeNavigateParams()); |
1135 ui_test_utils::NavigateToURL(&p); | 1135 ui_test_utils::NavigateToURL(¶ms); |
1136 EXPECT_EQ(GetGoogleURL(), | 1136 EXPECT_EQ(GetGoogleURL(), |
1137 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 1137 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
1138 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 1138 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
1139 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 1139 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
1140 | 1140 |
1141 { | 1141 { |
1142 content::WindowedNotificationObserver observer( | 1142 content::WindowedNotificationObserver observer( |
1143 content::NOTIFICATION_LOAD_STOP, | 1143 content::NOTIFICATION_LOAD_STOP, |
1144 content::NotificationService::AllSources()); | 1144 content::NotificationService::AllSources()); |
1145 chrome::ShowSettings(browser()); | 1145 chrome::ShowSettings(browser()); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 | 1369 |
1370 // Open a renderer initiated POST request in new foreground tab. | 1370 // Open a renderer initiated POST request in new foreground tab. |
1371 base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle)); | 1371 base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle)); |
1372 std::string post_data = kExpectedTitle; | 1372 std::string post_data = kExpectedTitle; |
1373 base::string16 title; | 1373 base::string16 title; |
1374 ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle( | 1374 ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle( |
1375 test_server()->GetURL(kEchoTitleCommand), post_data, false, &title)); | 1375 test_server()->GetURL(kEchoTitleCommand), post_data, false, &title)); |
1376 EXPECT_NE(expected_title, title); | 1376 EXPECT_NE(expected_title, title); |
1377 } | 1377 } |
1378 | 1378 |
| 1379 // This test navigates to a data URL that contains BiDi control |
| 1380 // characters. For security reasons, BiDi control chars should always be |
| 1381 // escaped in the URL but they should be unescaped in the rendered page. |
| 1382 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 1383 NavigateToDataURLWithBiDiControlChars) { |
| 1384 // Text in Arabic. |
| 1385 std::string text = "\xD8\xA7\xD8\xAE\xD8\xAA\xD8\xA8\xD8\xA7\xD8\xB1"; |
| 1386 // Page title starts with RTL mark. |
| 1387 std::string title = "\xE2\x80\x8F" + text; |
| 1388 std::string data_url = "data:text/html;charset=utf-8,<html><title>" + title + |
| 1389 "</title></html>"); |
| 1390 // BiDi control chars in URLs are always escaped, so the expected URL should |
| 1391 // have the title with the escaped RTL mark. |
| 1392 std::string escaped_title = "%E2%80%8F" + text; |
| 1393 std::string expected_url = "data:text/html;charset=utf-8,<html><title>" + |
| 1394 escaped_title + "</title></html>"); |
| 1395 |
| 1396 // Navigate to the page. |
| 1397 chrome::NavigateParams params(MakeNavigateParams()); |
| 1398 params.disposition = NEW_FOREGROUND_TAB; |
| 1399 params.url = GURL(data_url); |
| 1400 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 1401 ui_test_utils::NavigateToURL(¶ms); |
| 1402 |
| 1403 base::string16 expected_title(base::UTF8ToUTF16(title)); |
| 1404 EXPECT_TRUE(params.target_contents); |
| 1405 EXPECT_EQ(expected_url, params.target_contents->GetURL().spec()); |
| 1406 EXPECT_EQ(expected_title, params.target_contents->GetTitle()); |
| 1407 } |
| 1408 |
1379 } // namespace | 1409 } // namespace |
OLD | NEW |