blob: 2ac3d381a75ad5b765402d9918d5a554272f7cb5 [file] [log] [blame]
[email protected]1ea49d52011-04-12 17:44:441// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]a1feae52010-10-11 22:14:452// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]bd817c22011-02-09 08:16:465#include "chrome/browser/ui/browser_navigator_browsertest.h"
6
[email protected]bb89e7482010-11-17 18:27:047#include "base/command_line.h"
[email protected]26c53e662011-07-09 02:21:028#include "chrome/app/chrome_command_ids.h"
9#include "chrome/browser/autocomplete/autocomplete_edit.h"
[email protected]8ecad5e2010-12-02 21:18:3310#include "chrome/browser/profiles/profile.h"
[email protected]a1feae52010-10-11 22:14:4511#include "chrome/browser/tabs/tab_strip_model.h"
[email protected]bb89e7482010-11-17 18:27:0412#include "chrome/browser/ui/browser_list.h"
[email protected]339d6dd2010-11-12 00:41:5813#include "chrome/browser/ui/browser_navigator.h"
[email protected]bb89e7482010-11-17 18:27:0414#include "chrome/browser/ui/browser_window.h"
[email protected]26c53e662011-07-09 02:21:0215#include "chrome/browser/ui/omnibox/location_bar.h"
16#include "chrome/browser/ui/omnibox/omnibox_view.h"
[email protected]6a3ec2312010-12-02 19:30:1917#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
[email protected]bb89e7482010-11-17 18:27:0418#include "chrome/common/chrome_switches.h"
[email protected]ddddfda2011-07-14 23:19:3919#include "chrome/common/url_constants.h"
[email protected]af44e7fb2011-07-29 18:32:3220#include "chrome/test/base/ui_test_utils.h"
[email protected]299425b2011-03-02 07:45:2021#include "content/browser/tab_contents/tab_contents.h"
[email protected]ddddfda2011-07-14 23:19:3922#include "content/browser/tab_contents/tab_contents_view.h"
[email protected]0d6e9bd2011-10-18 04:29:1623#include "content/public/browser/notification_types.h"
[email protected]a1feae52010-10-11 22:14:4524
[email protected]ddddfda2011-07-14 23:19:3925namespace {
26
27GURL GetGoogleURL() {
[email protected]bd817c22011-02-09 08:16:4628 return GURL("http://www.google.com/");
29}
[email protected]a1feae52010-10-11 22:14:4530
[email protected]ddddfda2011-07-14 23:19:3931GURL GetSettingsURL() {
32 return GURL(chrome::kChromeUISettingsURL);
33}
34
35GURL GetSettingsAdvancedURL() {
36 return GURL(chrome::kChromeUISettingsURL).Resolve(
37 chrome::kAdvancedOptionsSubPage);
38}
39
40GURL GetSettingsBrowserURL() {
41 return GURL(chrome::kChromeUISettingsURL).Resolve(
42 chrome::kBrowserOptionsSubPage);
43}
44
45GURL GetSettingsPersonalURL() {
46 return GURL(chrome::kChromeUISettingsURL).Resolve(
47 chrome::kPersonalOptionsSubPage);
48}
49
50} // namespace
51
52
[email protected]bd817c22011-02-09 08:16:4653browser::NavigateParams BrowserNavigatorTest::MakeNavigateParams() const {
54 return MakeNavigateParams(browser());
55}
[email protected]a1feae52010-10-11 22:14:4556
[email protected]bd817c22011-02-09 08:16:4657browser::NavigateParams BrowserNavigatorTest::MakeNavigateParams(
58 Browser* browser) const {
59 browser::NavigateParams params(browser, GetGoogleURL(),
[email protected]2905f742011-10-13 03:51:5860 content::PAGE_TRANSITION_LINK);
[email protected]7d329992011-04-15 18:20:0261 params.window_action = browser::NavigateParams::SHOW_WINDOW;
[email protected]bd817c22011-02-09 08:16:4662 return params;
63}
[email protected]a1feae52010-10-11 22:14:4564
[email protected]bd817c22011-02-09 08:16:4665Browser* BrowserNavigatorTest::CreateEmptyBrowserForType(Browser::Type type,
66 Profile* profile) {
67 Browser* browser = Browser::CreateForType(type, profile);
68 browser->AddBlankTab(true);
69 return browser;
70}
[email protected]a1feae52010-10-11 22:14:4571
[email protected]b35b26b32011-05-05 20:35:1472Browser* BrowserNavigatorTest::CreateEmptyBrowserForApp(Browser::Type type,
73 Profile* profile) {
74 Browser* browser = Browser::CreateForApp(Browser::TYPE_POPUP, "Test",
[email protected]5c209242011-06-06 20:36:1775 gfx::Rect(), profile);
[email protected]b35b26b32011-05-05 20:35:1476 browser->AddBlankTab(true);
77 return browser;
78}
79
[email protected]bd817c22011-02-09 08:16:4680TabContentsWrapper* BrowserNavigatorTest::CreateTabContents() {
81 return Browser::TabContentsFactory(
82 browser()->profile(),
83 NULL,
84 MSG_ROUTING_NONE,
85 browser()->GetSelectedTabContents(),
86 NULL);
87}
[email protected]a1feae52010-10-11 22:14:4588
[email protected]bd817c22011-02-09 08:16:4689void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) {
90 GURL old_url = browser()->GetSelectedTabContents()->GetURL();
91 browser::NavigateParams p(MakeNavigateParams());
92 p.disposition = disposition;
93 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:4594
[email protected]bd817c22011-02-09 08:16:4695 // Nothing should have happened as a result of Navigate();
96 EXPECT_EQ(1, browser()->tab_count());
97 EXPECT_EQ(1u, BrowserList::size());
98 EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL());
99}
[email protected]bb89e7482010-11-17 18:27:04100
[email protected]6c2381d2011-10-19 02:52:53101void BrowserNavigatorTest::Observe(
102 int type,
103 const content::NotificationSource& source,
104 const content::NotificationDetails& details) {
[email protected]432115822011-07-10 15:52:27105 switch (type) {
106 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: {
[email protected]bd817c22011-02-09 08:16:46107 ++this->created_tab_contents_count_;
108 break;
[email protected]fa7ebe02010-11-29 23:04:57109 }
[email protected]bd817c22011-02-09 08:16:46110 default:
111 break;
[email protected]fa7ebe02010-11-29 23:04:57112 }
[email protected]bd817c22011-02-09 08:16:46113}
[email protected]fa7ebe02010-11-29 23:04:57114
[email protected]ddddfda2011-07-14 23:19:39115
[email protected]bd817c22011-02-09 08:16:46116namespace {
[email protected]a1feae52010-10-11 22:14:45117
[email protected]a1feae52010-10-11 22:14:45118// This test verifies that when a navigation occurs within a tab, the tab count
119// of the Browser remains the same and the current tab bears the loaded URL.
120IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_CurrentTab) {
[email protected]ddddfda2011-07-14 23:19:39121 ui_test_utils::NavigateToURL(browser(), GetGoogleURL());
[email protected]a1feae52010-10-11 22:14:45122 EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedTabContents()->GetURL());
123 // We should have one window with one tab.
124 EXPECT_EQ(1u, BrowserList::size());
125 EXPECT_EQ(1, browser()->tab_count());
126}
127
[email protected]bd817c22011-02-09 08:16:46128// This test verifies that a singleton tab is refocused if one is already opened
[email protected]19d9f3a2010-10-14 21:49:36129// in another or an existing window, or added if it is not.
130IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) {
[email protected]19d9f3a2010-10-14 21:49:36131 GURL singleton_url1("http://maps.google.com/");
[email protected]fa7ebe02010-11-29 23:04:57132
133 // Register for a notification if an additional tab_contents was instantiated.
[email protected]bd817c22011-02-09 08:16:46134 // Opening a Singleton tab that is already opened should not be opening a new
[email protected]fa7ebe02010-11-29 23:04:57135 // tab nor be creating a new TabContents object
[email protected]6c2381d2011-10-19 02:52:53136 content::NotificationRegistrar registrar;
[email protected]fa7ebe02010-11-29 23:04:57137
138 // As the registrar object goes out of scope, this will get unregistered
[email protected]432115822011-07-10 15:52:27139 registrar.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB,
[email protected]fa7ebe02010-11-29 23:04:57140 NotificationService::AllSources());
141
[email protected]2905f742011-10-13 03:51:58142 browser()->AddSelectedTabWithURL(
143 singleton_url1, content::PAGE_TRANSITION_LINK);
144 browser()->AddSelectedTabWithURL(
145 GetGoogleURL(), content::PAGE_TRANSITION_LINK);
[email protected]19d9f3a2010-10-14 21:49:36146
147 // We should have one browser with 3 tabs, the 3rd selected.
148 EXPECT_EQ(1u, BrowserList::size());
[email protected]1ea49d52011-04-12 17:44:44149 EXPECT_EQ(2, browser()->active_index());
[email protected]19d9f3a2010-10-14 21:49:36150
[email protected]fa7ebe02010-11-29 23:04:57151 unsigned int previous_tab_contents_count =
152 created_tab_contents_count_ = 0;
153
[email protected]19d9f3a2010-10-14 21:49:36154 // Navigate to singleton_url1.
155 browser::NavigateParams p(MakeNavigateParams());
156 p.disposition = SINGLETON_TAB;
157 p.url = singleton_url1;
158 browser::Navigate(&p);
159
160 // The middle tab should now be selected.
161 EXPECT_EQ(browser(), p.browser);
[email protected]1ea49d52011-04-12 17:44:44162 EXPECT_EQ(1, browser()->active_index());
[email protected]fa7ebe02010-11-29 23:04:57163
164 // No tab contents should have been created
165 EXPECT_EQ(previous_tab_contents_count,
166 created_tab_contents_count_);
[email protected]19d9f3a2010-10-14 21:49:36167}
168
169IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
[email protected]578c6962011-08-24 22:06:40170 Disposition_SingletonTabRespectingRef) {
171 GURL singleton_ref_url1("http://maps.google.com/#a");
172 GURL singleton_ref_url2("http://maps.google.com/#b");
173 GURL singleton_ref_url3("http://maps.google.com/");
174
[email protected]2905f742011-10-13 03:51:58175 browser()->AddSelectedTabWithURL(
176 singleton_ref_url1, content::PAGE_TRANSITION_LINK);
[email protected]578c6962011-08-24 22:06:40177
178 // We should have one browser with 2 tabs, 2nd selected.
179 EXPECT_EQ(1u, BrowserList::size());
180 EXPECT_EQ(2, browser()->tab_count());
181 EXPECT_EQ(1, browser()->active_index());
182
183 // Navigate to singleton_url2.
184 browser::NavigateParams p(MakeNavigateParams());
185 p.disposition = SINGLETON_TAB;
186 p.url = singleton_ref_url2;
187 browser::Navigate(&p);
188
189 // We should now have 2 tabs, the 2nd one selected.
190 EXPECT_EQ(browser(), p.browser);
191 EXPECT_EQ(2, browser()->tab_count());
192 EXPECT_EQ(1, browser()->active_index());
193
194 // Navigate to singleton_url2, but with respect ref set.
195 p = MakeNavigateParams();
196 p.disposition = SINGLETON_TAB;
197 p.url = singleton_ref_url2;
198 p.ref_behavior = browser::NavigateParams::RESPECT_REF;
199 browser::Navigate(&p);
200
201 // We should now have 3 tabs, the 3th one selected.
202 EXPECT_EQ(browser(), p.browser);
203 EXPECT_EQ(3, browser()->tab_count());
204 EXPECT_EQ(2, browser()->active_index());
205
206 // Navigate to singleton_url3.
207 p = MakeNavigateParams();
208 p.disposition = SINGLETON_TAB;
209 p.url = singleton_ref_url3;
210 p.ref_behavior = browser::NavigateParams::RESPECT_REF;
211 browser::Navigate(&p);
212
213 // We should now have 4 tabs, the 4th one selected.
214 EXPECT_EQ(browser(), p.browser);
215 EXPECT_EQ(4, browser()->tab_count());
216 EXPECT_EQ(3, browser()->active_index());
217}
218
219IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
[email protected]19d9f3a2010-10-14 21:49:36220 Disposition_SingletonTabNoneExisting) {
[email protected]19d9f3a2010-10-14 21:49:36221 GURL singleton_url1("http://maps.google.com/");
222
[email protected]bd817c22011-02-09 08:16:46223 // We should have one browser with 1 tab.
[email protected]19d9f3a2010-10-14 21:49:36224 EXPECT_EQ(1u, BrowserList::size());
[email protected]1ea49d52011-04-12 17:44:44225 EXPECT_EQ(0, browser()->active_index());
[email protected]19d9f3a2010-10-14 21:49:36226
227 // Navigate to singleton_url1.
228 browser::NavigateParams p(MakeNavigateParams());
229 p.disposition = SINGLETON_TAB;
230 p.url = singleton_url1;
231 browser::Navigate(&p);
232
233 // We should now have 2 tabs, the 2nd one selected.
234 EXPECT_EQ(browser(), p.browser);
235 EXPECT_EQ(2, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44236 EXPECT_EQ(1, browser()->active_index());
[email protected]a1feae52010-10-11 22:14:45237}
238
239// This test verifies that when a navigation results in a foreground tab, the
240// tab count of the Browser increases and the selected tab shifts to the new
241// foreground tab.
242IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) {
243 TabContents* old_contents = browser()->GetSelectedTabContents();
244 browser::NavigateParams p(MakeNavigateParams());
245 p.disposition = NEW_FOREGROUND_TAB;
[email protected]19d9f3a2010-10-14 21:49:36246 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:45247 EXPECT_NE(old_contents, browser()->GetSelectedTabContents());
[email protected]3c9e1872010-11-18 16:17:49248 EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents);
[email protected]a1feae52010-10-11 22:14:45249 EXPECT_EQ(2, browser()->tab_count());
250}
251
252// This test verifies that when a navigation results in a background tab, the
253// tab count of the Browser increases but the selected tab remains the same.
254IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewBackgroundTab) {
255 TabContents* old_contents = browser()->GetSelectedTabContents();
256 browser::NavigateParams p(MakeNavigateParams());
257 p.disposition = NEW_BACKGROUND_TAB;
[email protected]19d9f3a2010-10-14 21:49:36258 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:45259 TabContents* new_contents = browser()->GetSelectedTabContents();
260 // The selected tab should have remained unchanged, since the new tab was
261 // opened in the background.
262 EXPECT_EQ(old_contents, new_contents);
263 EXPECT_EQ(2, browser()->tab_count());
264}
265
266// This test verifies that when a navigation requiring a new foreground tab
267// occurs in a Browser that cannot host multiple tabs, the new foreground tab
268// is created in an existing compatible Browser.
269IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
270 Disposition_IncompatibleWindow_Existing) {
271 // Open a foreground tab in a window that cannot open popups when there is an
272 // existing compatible window somewhere else that they can be opened within.
273 Browser* popup = CreateEmptyBrowserForType(Browser::TYPE_POPUP,
274 browser()->profile());
275 browser::NavigateParams p(MakeNavigateParams(popup));
276 p.disposition = NEW_FOREGROUND_TAB;
[email protected]19d9f3a2010-10-14 21:49:36277 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:45278
279 // Navigate() should have opened the tab in a different browser since the
280 // one we supplied didn't support additional tabs.
281 EXPECT_NE(popup, p.browser);
282
283 // Since browser() is an existing compatible tabbed browser, it should have
284 // opened the tab there.
285 EXPECT_EQ(browser(), p.browser);
286
287 // We should be left with 2 windows, the popup with one tab and the browser()
288 // provided by the framework with two.
289 EXPECT_EQ(2u, BrowserList::size());
290 EXPECT_EQ(1, popup->tab_count());
291 EXPECT_EQ(2, browser()->tab_count());
292}
293
294// This test verifies that when a navigation requiring a new foreground tab
295// occurs in a Browser that cannot host multiple tabs and no compatible Browser
296// that can is open, a compatible Browser is created.
297IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
298 Disposition_IncompatibleWindow_NoExisting) {
299 // We want to simulate not being able to find an existing window compatible
300 // with our non-tabbed browser window so Navigate() is forced to create a
301 // new compatible window. Because browser() supplied by the in-process
302 // browser testing framework is compatible with browser()->profile(), we
303 // need a different profile, and creating a popup window with an incognito
304 // profile is a quick and dirty way of achieving this.
305 Browser* popup = CreateEmptyBrowserForType(
[email protected]b35b26b32011-05-05 20:35:14306 Browser::TYPE_POPUP,
307 browser()->profile()->GetOffTheRecordProfile());
[email protected]a1feae52010-10-11 22:14:45308 browser::NavigateParams p(MakeNavigateParams(popup));
309 p.disposition = NEW_FOREGROUND_TAB;
[email protected]19d9f3a2010-10-14 21:49:36310 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:45311
312 // Navigate() should have opened the tab in a different browser since the
313 // one we supplied didn't support additional tabs.
314 EXPECT_NE(popup, p.browser);
315
316 // This time, browser() is _not_ compatible with popup since it is not an
317 // incognito window.
318 EXPECT_NE(browser(), p.browser);
319
320 // We should have three windows, each with one tab:
321 // 1. the browser() provided by the framework (unchanged in this test)
322 // 2. the incognito popup we created originally
323 // 3. the new incognito tabbed browser that was created by Navigate().
324 EXPECT_EQ(3u, BrowserList::size());
325 EXPECT_EQ(1, browser()->tab_count());
326 EXPECT_EQ(1, popup->tab_count());
327 EXPECT_EQ(1, p.browser->tab_count());
[email protected]b35b26b32011-05-05 20:35:14328 EXPECT_TRUE(p.browser->is_type_tabbed());
[email protected]a1feae52010-10-11 22:14:45329}
330
331// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
332// from a normal Browser results in a new Browser with TYPE_POPUP.
333IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup) {
334 browser::NavigateParams p(MakeNavigateParams());
335 p.disposition = NEW_POPUP;
[email protected]588300d2011-04-28 21:06:35336 p.window_bounds = gfx::Rect(0, 0, 200, 200);
[email protected]7d329992011-04-15 18:20:02337 // Wait for new popup to to load and gain focus.
[email protected]ddddfda2011-07-14 23:19:39338 ui_test_utils::NavigateToURL(&p);
[email protected]a1feae52010-10-11 22:14:45339
[email protected]7d329992011-04-15 18:20:02340 // Navigate() should have opened a new, focused popup window.
[email protected]a1feae52010-10-11 22:14:45341 EXPECT_NE(browser(), p.browser);
[email protected]9db263a2011-04-15 20:53:47342#if 0
343 // TODO(stevenjb): Enable this test. See: crbug.com/79493
[email protected]7d329992011-04-15 18:20:02344 EXPECT_TRUE(p.browser->window()->IsActive());
345#endif
[email protected]b35b26b32011-05-05 20:35:14346 EXPECT_TRUE(p.browser->is_type_popup());
347 EXPECT_FALSE(p.browser->is_app());
[email protected]a1feae52010-10-11 22:14:45348
349 // We should have two windows, the browser() provided by the framework and the
350 // new popup window.
351 EXPECT_EQ(2u, BrowserList::size());
352 EXPECT_EQ(1, browser()->tab_count());
353 EXPECT_EQ(1, p.browser->tab_count());
354}
355
356// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
[email protected]f112b0f2011-05-26 01:53:52357// from a normal Browser results in a new Browser with is_app() true.
358IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup_ExtensionId) {
359 browser::NavigateParams p(MakeNavigateParams());
360 p.disposition = NEW_POPUP;
361 p.extension_app_id = "extensionappid";
362 p.window_bounds = gfx::Rect(0, 0, 200, 200);
[email protected]f112b0f2011-05-26 01:53:52363 // Wait for new popup to to load and gain focus.
[email protected]ddddfda2011-07-14 23:19:39364 ui_test_utils::NavigateToURL(&p);
[email protected]f112b0f2011-05-26 01:53:52365
366 // Navigate() should have opened a new, focused popup window.
367 EXPECT_NE(browser(), p.browser);
368 EXPECT_TRUE(p.browser->is_type_popup());
369 EXPECT_TRUE(p.browser->is_app());
370
371 // We should have two windows, the browser() provided by the framework and the
372 // new popup window.
373 EXPECT_EQ(2u, BrowserList::size());
374 EXPECT_EQ(1, browser()->tab_count());
375 EXPECT_EQ(1, p.browser->tab_count());
376}
377
378// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
[email protected]300d1e52011-01-19 23:57:57379// from a normal popup results in a new Browser with TYPE_POPUP.
380IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupFromPopup) {
381 // Open a popup.
382 browser::NavigateParams p1(MakeNavigateParams());
383 p1.disposition = NEW_POPUP;
[email protected]588300d2011-04-28 21:06:35384 p1.window_bounds = gfx::Rect(0, 0, 200, 200);
[email protected]300d1e52011-01-19 23:57:57385 browser::Navigate(&p1);
386 // Open another popup.
387 browser::NavigateParams p2(MakeNavigateParams(p1.browser));
388 p2.disposition = NEW_POPUP;
[email protected]588300d2011-04-28 21:06:35389 p2.window_bounds = gfx::Rect(0, 0, 200, 200);
[email protected]300d1e52011-01-19 23:57:57390 browser::Navigate(&p2);
391
392 // Navigate() should have opened a new normal popup window.
393 EXPECT_NE(p1.browser, p2.browser);
[email protected]b35b26b32011-05-05 20:35:14394 EXPECT_TRUE(p2.browser->is_type_popup());
395 EXPECT_FALSE(p2.browser->is_app());
[email protected]300d1e52011-01-19 23:57:57396
397 // We should have three windows, the browser() provided by the framework,
398 // the first popup window, and the second popup window.
399 EXPECT_EQ(3u, BrowserList::size());
400 EXPECT_EQ(1, browser()->tab_count());
401 EXPECT_EQ(1, p1.browser->tab_count());
402 EXPECT_EQ(1, p2.browser->tab_count());
403}
404
405// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
[email protected]a1feae52010-10-11 22:14:45406// from an app frame results in a new Browser with TYPE_APP_POPUP.
407IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
408 Disposition_NewPopupFromAppWindow) {
[email protected]b35b26b32011-05-05 20:35:14409 Browser* app_browser = CreateEmptyBrowserForApp(Browser::TYPE_TABBED,
410 browser()->profile());
[email protected]a1feae52010-10-11 22:14:45411 browser::NavigateParams p(MakeNavigateParams(app_browser));
412 p.disposition = NEW_POPUP;
[email protected]588300d2011-04-28 21:06:35413 p.window_bounds = gfx::Rect(0, 0, 200, 200);
[email protected]19d9f3a2010-10-14 21:49:36414 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:45415
416 // Navigate() should have opened a new popup app window.
417 EXPECT_NE(app_browser, p.browser);
418 EXPECT_NE(browser(), p.browser);
[email protected]b35b26b32011-05-05 20:35:14419 EXPECT_TRUE(p.browser->is_type_popup());
420 EXPECT_TRUE(p.browser->is_app());
[email protected]a1feae52010-10-11 22:14:45421
422 // We should now have three windows, the app window, the app popup it created,
423 // and the original browser() provided by the framework.
424 EXPECT_EQ(3u, BrowserList::size());
425 EXPECT_EQ(1, browser()->tab_count());
426 EXPECT_EQ(1, app_browser->tab_count());
427 EXPECT_EQ(1, p.browser->tab_count());
428}
429
430// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
[email protected]300d1e52011-01-19 23:57:57431// from an app popup results in a new Browser also of TYPE_APP_POPUP.
432IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
433 Disposition_NewPopupFromAppPopup) {
[email protected]b35b26b32011-05-05 20:35:14434 Browser* app_browser = CreateEmptyBrowserForApp(Browser::TYPE_TABBED,
435 browser()->profile());
[email protected]300d1e52011-01-19 23:57:57436 // Open an app popup.
437 browser::NavigateParams p1(MakeNavigateParams(app_browser));
438 p1.disposition = NEW_POPUP;
[email protected]588300d2011-04-28 21:06:35439 p1.window_bounds = gfx::Rect(0, 0, 200, 200);
[email protected]300d1e52011-01-19 23:57:57440 browser::Navigate(&p1);
441 // Now open another app popup.
442 browser::NavigateParams p2(MakeNavigateParams(p1.browser));
443 p2.disposition = NEW_POPUP;
[email protected]588300d2011-04-28 21:06:35444 p2.window_bounds = gfx::Rect(0, 0, 200, 200);
[email protected]300d1e52011-01-19 23:57:57445 browser::Navigate(&p2);
446
447 // Navigate() should have opened a new popup app window.
448 EXPECT_NE(browser(), p1.browser);
449 EXPECT_NE(p1.browser, p2.browser);
[email protected]b35b26b32011-05-05 20:35:14450 EXPECT_TRUE(p2.browser->is_type_popup());
451 EXPECT_TRUE(p2.browser->is_app());
[email protected]300d1e52011-01-19 23:57:57452
453 // We should now have four windows, the app window, the first app popup,
454 // the second app popup, and the original browser() provided by the framework.
455 EXPECT_EQ(4u, BrowserList::size());
456 EXPECT_EQ(1, browser()->tab_count());
457 EXPECT_EQ(1, app_browser->tab_count());
458 EXPECT_EQ(1, p1.browser->tab_count());
459 EXPECT_EQ(1, p2.browser->tab_count());
460}
461
462// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
[email protected]a1feae52010-10-11 22:14:45463// from an extension app tab results in a new Browser with TYPE_APP_POPUP.
464IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
465 Disposition_NewPopupFromExtensionApp) {
466 // TODO(beng): TBD.
467}
468
[email protected]7d329992011-04-15 18:20:02469// This test verifies that navigating with window_action = SHOW_WINDOW_INACTIVE
470// does not focus a new new popup window.
471IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupUnfocused) {
472 browser::NavigateParams p(MakeNavigateParams());
473 p.disposition = NEW_POPUP;
[email protected]588300d2011-04-28 21:06:35474 p.window_bounds = gfx::Rect(0, 0, 200, 200);
[email protected]7d329992011-04-15 18:20:02475 p.window_action = browser::NavigateParams::SHOW_WINDOW_INACTIVE;
[email protected]7d329992011-04-15 18:20:02476 // Wait for new popup to load (and gain focus if the test fails).
[email protected]ddddfda2011-07-14 23:19:39477 ui_test_utils::NavigateToURL(&p);
[email protected]7d329992011-04-15 18:20:02478
479 // Navigate() should have opened a new, unfocused, popup window.
480 EXPECT_NE(browser(), p.browser);
481 EXPECT_EQ(Browser::TYPE_POPUP, p.browser->type());
[email protected]9db263a2011-04-15 20:53:47482#if 0
483// TODO(stevenjb): Enable this test. See: crbug.com/79493
[email protected]7d329992011-04-15 18:20:02484 EXPECT_FALSE(p.browser->window()->IsActive());
[email protected]7d329992011-04-15 18:20:02485#endif
[email protected]9db263a2011-04-15 20:53:47486}
[email protected]7d329992011-04-15 18:20:02487
[email protected]a1feae52010-10-11 22:14:45488// This test verifies that navigating with WindowOpenDisposition = NEW_WINDOW
489// always opens a new window.
490IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewWindow) {
491 browser::NavigateParams p(MakeNavigateParams());
492 p.disposition = NEW_WINDOW;
[email protected]19d9f3a2010-10-14 21:49:36493 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:45494
495 // Navigate() should have opened a new toplevel window.
496 EXPECT_NE(browser(), p.browser);
[email protected]b35b26b32011-05-05 20:35:14497 EXPECT_TRUE(p.browser->is_type_tabbed());
[email protected]a1feae52010-10-11 22:14:45498
499 // We should now have two windows, the browser() provided by the framework and
500 // the new normal window.
501 EXPECT_EQ(2u, BrowserList::size());
502 EXPECT_EQ(1, browser()->tab_count());
503 EXPECT_EQ(1, p.browser->tab_count());
504}
505
506// This test verifies that navigating with WindowOpenDisposition = INCOGNITO
507// opens a new incognito window if no existing incognito window is present.
508IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_Incognito) {
509 browser::NavigateParams p(MakeNavigateParams());
510 p.disposition = OFF_THE_RECORD;
[email protected]19d9f3a2010-10-14 21:49:36511 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:45512
513 // Navigate() should have opened a new toplevel incognito window.
514 EXPECT_NE(browser(), p.browser);
515 EXPECT_EQ(browser()->profile()->GetOffTheRecordProfile(),
516 p.browser->profile());
517
[email protected]d7ff3592010-11-30 21:50:46518 // |source_contents| should be set to NULL because the profile for the new
519 // page is different from the originating page.
520 EXPECT_EQ(NULL, p.source_contents);
521
[email protected]a1feae52010-10-11 22:14:45522 // We should now have two windows, the browser() provided by the framework and
523 // the new incognito window.
524 EXPECT_EQ(2u, BrowserList::size());
525 EXPECT_EQ(1, browser()->tab_count());
526 EXPECT_EQ(1, p.browser->tab_count());
527}
528
529// This test verifies that navigating with WindowOpenDisposition = INCOGNITO
530// reuses an existing incognito window when possible.
531IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IncognitoRefocus) {
532 Browser* incognito_browser =
[email protected]b35b26b32011-05-05 20:35:14533 CreateEmptyBrowserForType(Browser::TYPE_TABBED,
[email protected]a1feae52010-10-11 22:14:45534 browser()->profile()->GetOffTheRecordProfile());
535 browser::NavigateParams p(MakeNavigateParams());
536 p.disposition = OFF_THE_RECORD;
[email protected]19d9f3a2010-10-14 21:49:36537 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:45538
539 // Navigate() should have opened a new tab in the existing incognito window.
540 EXPECT_NE(browser(), p.browser);
541 EXPECT_EQ(p.browser, incognito_browser);
542
543 // We should now have two windows, the browser() provided by the framework and
544 // the incognito window we opened earlier.
545 EXPECT_EQ(2u, BrowserList::size());
546 EXPECT_EQ(1, browser()->tab_count());
547 EXPECT_EQ(2, incognito_browser->tab_count());
548}
549
550// This test verifies that no navigation action occurs when
551// WindowOpenDisposition = SUPPRESS_OPEN.
552IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SuppressOpen) {
553 RunSuppressTest(SUPPRESS_OPEN);
554}
555
556// This test verifies that no navigation action occurs when
557// WindowOpenDisposition = SAVE_TO_DISK.
558IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SaveToDisk) {
559 RunSuppressTest(SAVE_TO_DISK);
560}
561
562// This test verifies that no navigation action occurs when
563// WindowOpenDisposition = IGNORE_ACTION.
564IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IgnoreAction) {
565 RunSuppressTest(IGNORE_ACTION);
566}
567
568// This tests adding a foreground tab with a predefined TabContents.
569IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) {
570 browser::NavigateParams p(MakeNavigateParams());
571 p.disposition = NEW_FOREGROUND_TAB;
572 p.target_contents = CreateTabContents();
[email protected]19d9f3a2010-10-14 21:49:36573 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:45574
575 // Navigate() should have opened the contents in a new foreground in the
576 // current Browser.
577 EXPECT_EQ(browser(), p.browser);
[email protected]3c9e1872010-11-18 16:17:49578 EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents);
[email protected]a1feae52010-10-11 22:14:45579
580 // We should have one window, with two tabs.
581 EXPECT_EQ(1u, BrowserList::size());
582 EXPECT_EQ(2, browser()->tab_count());
583}
584
585#if defined(OS_WIN)
586// This tests adding a popup with a predefined TabContents.
[email protected]76edb672011-03-04 21:48:39587IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_TargetContents_Popup) {
[email protected]a1feae52010-10-11 22:14:45588 browser::NavigateParams p(MakeNavigateParams());
589 p.disposition = NEW_POPUP;
590 p.target_contents = CreateTabContents();
591 p.window_bounds = gfx::Rect(10, 10, 500, 500);
[email protected]19d9f3a2010-10-14 21:49:36592 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:45593
594 // Navigate() should have opened a new popup window.
595 EXPECT_NE(browser(), p.browser);
[email protected]b35b26b32011-05-05 20:35:14596 EXPECT_TRUE(p.browser->is_type_popup());
597 EXPECT_FALSE(p.browser->is_app());
[email protected]a1feae52010-10-11 22:14:45598
599 // The web platform is weird. The window bounds specified in
600 // |p.window_bounds| are used as follows:
601 // - the origin is used to position the window
602 // - the size is used to size the TabContents of the window.
603 // As such the position of the resulting window will always match
604 // p.window_bounds.origin(), but its size will not. We need to match
605 // the size against the selected tab's view's container size.
606 // Only Windows positions the window according to |p.window_bounds.origin()| -
607 // on Mac the window is offset from the opener and on Linux it always opens
608 // at 0,0.
609 EXPECT_EQ(p.window_bounds.origin(),
610 p.browser->window()->GetRestoredBounds().origin());
611 // All platforms should respect size however provided width > 400 (Mac has a
612 // minimum window width of 400).
613 EXPECT_EQ(p.window_bounds.size(),
[email protected]3c9e1872010-11-18 16:17:49614 p.target_contents->tab_contents()->view()->GetContainerSize());
[email protected]a1feae52010-10-11 22:14:45615
616 // We should have two windows, the new popup and the browser() provided by the
617 // framework.
618 EXPECT_EQ(2u, BrowserList::size());
619 EXPECT_EQ(1, browser()->tab_count());
620 EXPECT_EQ(1, p.browser->tab_count());
621}
622#endif
623
624// This tests adding a tab at a specific index.
625IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Tabstrip_InsertAtIndex) {
626 // This is not meant to be a comprehensive test of whether or not the tab
627 // implementation of the browser observes the insertion index. That is
628 // covered by the unit tests for TabStripModel. This merely verifies that
629 // insertion index preference is reflected in common cases.
630 browser::NavigateParams p(MakeNavigateParams());
631 p.disposition = NEW_FOREGROUND_TAB;
632 p.tabstrip_index = 0;
633 p.tabstrip_add_types = TabStripModel::ADD_FORCE_INDEX;
[email protected]19d9f3a2010-10-14 21:49:36634 browser::Navigate(&p);
[email protected]a1feae52010-10-11 22:14:45635
636 // Navigate() should have inserted a new tab at slot 0 in the tabstrip.
637 EXPECT_EQ(browser(), p.browser);
638 EXPECT_EQ(0, browser()->tabstrip_model()->GetIndexOfTabContents(
[email protected]3c9e1872010-11-18 16:17:49639 static_cast<const TabContentsWrapper*>(p.target_contents)));
[email protected]a1feae52010-10-11 22:14:45640
641 // We should have one window - the browser() provided by the framework.
642 EXPECT_EQ(1u, BrowserList::size());
643 EXPECT_EQ(2, browser()->tab_count());
644}
645
[email protected]2dd85482010-11-06 01:56:47646// This test verifies that constructing params with a NULL browser has
647// the same result as navigating to a new foreground tab in the (only)
648// active browser. Tests are the same as for Disposition_NewForegroundTab.
649IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_NewForegroundTab) {
650 TabContents* old_contents = browser()->GetSelectedTabContents();
651 // Navigate with a NULL browser.
652 browser::NavigateParams p(MakeNavigateParams(NULL));
653 p.disposition = NEW_FOREGROUND_TAB;
654 p.profile = browser()->profile();
655 browser::Navigate(&p);
656
657 // Navigate() should have found browser() and create a new tab.
658 EXPECT_EQ(browser(), p.browser);
659 EXPECT_NE(old_contents, browser()->GetSelectedTabContents());
[email protected]3c9e1872010-11-18 16:17:49660 EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents);
[email protected]2dd85482010-11-06 01:56:47661 EXPECT_EQ(2, browser()->tab_count());
662}
663
664// This test verifies that constructing params with a NULL browser and
665// a specific profile matches the specified profile.
[email protected]c8a31a72011-09-30 01:53:32666IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_MatchProfile) {
[email protected]2dd85482010-11-06 01:56:47667 // Create a new browser with using the incognito profile.
668 Browser* incognito =
669 Browser::Create(browser()->profile()->GetOffTheRecordProfile());
670
671 // Navigate with a NULL browser and the incognito profile.
672 browser::NavigateParams p(MakeNavigateParams(NULL));
673 p.disposition = NEW_FOREGROUND_TAB;
674 p.profile = incognito->profile();
675 browser::Navigate(&p);
676
677 // Navigate() should have found incognito, not browser().
678 EXPECT_EQ(incognito, p.browser);
[email protected]3c9e1872010-11-18 16:17:49679 EXPECT_EQ(incognito->GetSelectedTabContentsWrapper(), p.target_contents);
[email protected]2dd85482010-11-06 01:56:47680 EXPECT_EQ(1, incognito->tab_count());
681}
682
683// This test verifies that constructing params with a NULL browser and
684// disposition = NEW_WINDOW always opens exactly one new window.
685IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_NewWindow) {
686 browser::NavigateParams p(MakeNavigateParams(NULL));
687 p.disposition = NEW_WINDOW;
688 p.profile = browser()->profile();
689 browser::Navigate(&p);
690
691 // Navigate() should have created a new browser.
692 EXPECT_NE(browser(), p.browser);
[email protected]b35b26b32011-05-05 20:35:14693 EXPECT_TRUE( p.browser->is_type_tabbed());
[email protected]2dd85482010-11-06 01:56:47694
695 // We should now have two windows, the browser() provided by the framework and
696 // the new normal window.
697 EXPECT_EQ(2u, BrowserList::size());
698 EXPECT_EQ(1, browser()->tab_count());
699 EXPECT_EQ(1, p.browser->tab_count());
700}
701
[email protected]bb89e7482010-11-17 18:27:04702// This test verifies that constructing params with disposition = SINGLETON_TAB
[email protected]fee320542011-03-02 01:30:49703// and IGNORE_AND_NAVIGATE opens a new tab navigated to the specified URL if
[email protected]67ed83e2011-01-07 22:54:00704// no previous tab with that URL (minus the path) exists.
[email protected]bb89e7482010-11-17 18:27:04705IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
706 Disposition_SingletonTabNew_IgnorePath) {
[email protected]2905f742011-10-13 03:51:58707 browser()->AddSelectedTabWithURL(
708 GetGoogleURL(), content::PAGE_TRANSITION_LINK);
[email protected]bb89e7482010-11-17 18:27:04709
710 // We should have one browser with 2 tabs, the 2nd selected.
711 EXPECT_EQ(1u, BrowserList::size());
712 EXPECT_EQ(2, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44713 EXPECT_EQ(1, browser()->active_index());
[email protected]bb89e7482010-11-17 18:27:04714
715 // Navigate to a new singleton tab with a sub-page.
716 browser::NavigateParams p(MakeNavigateParams());
717 p.disposition = SINGLETON_TAB;
[email protected]ddddfda2011-07-14 23:19:39718 p.url = GetSettingsAdvancedURL();
[email protected]7d329992011-04-15 18:20:02719 p.window_action = browser::NavigateParams::SHOW_WINDOW;
[email protected]fee320542011-03-02 01:30:49720 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
[email protected]bb89e7482010-11-17 18:27:04721 browser::Navigate(&p);
722
723 // The last tab should now be selected and navigated to the sub-page of the
724 // URL.
725 EXPECT_EQ(browser(), p.browser);
726 EXPECT_EQ(3, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44727 EXPECT_EQ(2, browser()->active_index());
[email protected]ddddfda2011-07-14 23:19:39728 EXPECT_EQ(GetSettingsAdvancedURL(),
[email protected]bb89e7482010-11-17 18:27:04729 browser()->GetSelectedTabContents()->GetURL());
730}
731
732// This test verifies that constructing params with disposition = SINGLETON_TAB
[email protected]fee320542011-03-02 01:30:49733// and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus
[email protected]bb89e7482010-11-17 18:27:04734// the path) which is navigated to the specified URL.
735IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
736 Disposition_SingletonTabExisting_IgnorePath) {
[email protected]ddddfda2011-07-14 23:19:39737 GURL singleton_url1(GetSettingsURL());
[email protected]2905f742011-10-13 03:51:58738 browser()->AddSelectedTabWithURL(
739 singleton_url1, content::PAGE_TRANSITION_LINK);
740 browser()->AddSelectedTabWithURL(
741 GetGoogleURL(), content::PAGE_TRANSITION_LINK);
[email protected]bb89e7482010-11-17 18:27:04742
743 // We should have one browser with 3 tabs, the 3rd selected.
744 EXPECT_EQ(1u, BrowserList::size());
745 EXPECT_EQ(3, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44746 EXPECT_EQ(2, browser()->active_index());
[email protected]bb89e7482010-11-17 18:27:04747
748 // Navigate to singleton_url1.
749 browser::NavigateParams p(MakeNavigateParams());
750 p.disposition = SINGLETON_TAB;
[email protected]ddddfda2011-07-14 23:19:39751 p.url = GetSettingsAdvancedURL();
[email protected]7d329992011-04-15 18:20:02752 p.window_action = browser::NavigateParams::SHOW_WINDOW;
[email protected]fee320542011-03-02 01:30:49753 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
[email protected]bb89e7482010-11-17 18:27:04754 browser::Navigate(&p);
755
756 // The middle tab should now be selected and navigated to the sub-page of the
757 // URL.
758 EXPECT_EQ(browser(), p.browser);
759 EXPECT_EQ(3, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44760 EXPECT_EQ(1, browser()->active_index());
[email protected]ddddfda2011-07-14 23:19:39761 EXPECT_EQ(GetSettingsAdvancedURL(),
[email protected]bb89e7482010-11-17 18:27:04762 browser()->GetSelectedTabContents()->GetURL());
763}
764
765// This test verifies that constructing params with disposition = SINGLETON_TAB
[email protected]fee320542011-03-02 01:30:49766// and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus
[email protected]bb89e7482010-11-17 18:27:04767// the path) which is navigated to the specified URL.
768IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
769 Disposition_SingletonTabExistingSubPath_IgnorePath) {
[email protected]ddddfda2011-07-14 23:19:39770 GURL singleton_url1(GetSettingsAdvancedURL());
[email protected]2905f742011-10-13 03:51:58771 browser()->AddSelectedTabWithURL(
772 singleton_url1, content::PAGE_TRANSITION_LINK);
773 browser()->AddSelectedTabWithURL(
774 GetGoogleURL(), content::PAGE_TRANSITION_LINK);
[email protected]bb89e7482010-11-17 18:27:04775
776 // We should have one browser with 3 tabs, the 3rd selected.
777 EXPECT_EQ(1u, BrowserList::size());
778 EXPECT_EQ(3, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44779 EXPECT_EQ(2, browser()->active_index());
[email protected]bb89e7482010-11-17 18:27:04780
781 // Navigate to singleton_url1.
782 browser::NavigateParams p(MakeNavigateParams());
783 p.disposition = SINGLETON_TAB;
[email protected]ddddfda2011-07-14 23:19:39784 p.url = GetSettingsPersonalURL();
[email protected]7d329992011-04-15 18:20:02785 p.window_action = browser::NavigateParams::SHOW_WINDOW;
[email protected]fee320542011-03-02 01:30:49786 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
[email protected]bb89e7482010-11-17 18:27:04787 browser::Navigate(&p);
788
789 // The middle tab should now be selected and navigated to the sub-page of the
790 // URL.
791 EXPECT_EQ(browser(), p.browser);
792 EXPECT_EQ(3, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44793 EXPECT_EQ(1, browser()->active_index());
[email protected]ddddfda2011-07-14 23:19:39794 EXPECT_EQ(GetSettingsPersonalURL(),
[email protected]bb89e7482010-11-17 18:27:04795 browser()->GetSelectedTabContents()->GetURL());
796}
[email protected]2dd85482010-11-06 01:56:47797
[email protected]637b3442011-01-10 23:31:48798// This test verifies that constructing params with disposition = SINGLETON_TAB
[email protected]fee320542011-03-02 01:30:49799// and IGNORE_AND_STAY_PUT opens an existing tab with the matching URL (minus
800// the path).
801IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
802 Disposition_SingletonTabExistingSubPath_IgnorePath2) {
[email protected]ddddfda2011-07-14 23:19:39803 GURL singleton_url1(GetSettingsAdvancedURL());
[email protected]2905f742011-10-13 03:51:58804 browser()->AddSelectedTabWithURL(
805 singleton_url1, content::PAGE_TRANSITION_LINK);
806 browser()->AddSelectedTabWithURL(
807 GetGoogleURL(), content::PAGE_TRANSITION_LINK);
[email protected]fee320542011-03-02 01:30:49808
809 // We should have one browser with 3 tabs, the 3rd selected.
810 EXPECT_EQ(1u, BrowserList::size());
811 EXPECT_EQ(3, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44812 EXPECT_EQ(2, browser()->active_index());
[email protected]fee320542011-03-02 01:30:49813
814 // Navigate to singleton_url1.
815 browser::NavigateParams p(MakeNavigateParams());
816 p.disposition = SINGLETON_TAB;
[email protected]ddddfda2011-07-14 23:19:39817 p.url = GetSettingsPersonalURL();
[email protected]7d329992011-04-15 18:20:02818 p.window_action = browser::NavigateParams::SHOW_WINDOW;
[email protected]fee320542011-03-02 01:30:49819 p.path_behavior = browser::NavigateParams::IGNORE_AND_STAY_PUT;
820 browser::Navigate(&p);
821
822 // The middle tab should now be selected.
823 EXPECT_EQ(browser(), p.browser);
824 EXPECT_EQ(3, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44825 EXPECT_EQ(1, browser()->active_index());
[email protected]fee320542011-03-02 01:30:49826 EXPECT_EQ(singleton_url1,
827 browser()->GetSelectedTabContents()->GetURL());
828}
829
830// This test verifies that constructing params with disposition = SINGLETON_TAB
831// and IGNORE_AND_NAVIGATE will update the current tab's URL if the currently
[email protected]637b3442011-01-10 23:31:48832// selected tab is a match but has a different path.
833IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
834 Disposition_SingletonTabFocused_IgnorePath) {
[email protected]ddddfda2011-07-14 23:19:39835 GURL singleton_url_current(GetSettingsAdvancedURL());
[email protected]2905f742011-10-13 03:51:58836 browser()->AddSelectedTabWithURL(
837 singleton_url_current, content::PAGE_TRANSITION_LINK);
[email protected]637b3442011-01-10 23:31:48838
839 // We should have one browser with 2 tabs, the 2nd selected.
840 EXPECT_EQ(1u, BrowserList::size());
841 EXPECT_EQ(2, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44842 EXPECT_EQ(1, browser()->active_index());
[email protected]637b3442011-01-10 23:31:48843
844 // Navigate to a different settings path.
[email protected]ddddfda2011-07-14 23:19:39845 GURL singleton_url_target(GetSettingsPersonalURL());
[email protected]637b3442011-01-10 23:31:48846 browser::NavigateParams p(MakeNavigateParams());
847 p.disposition = SINGLETON_TAB;
848 p.url = singleton_url_target;
[email protected]7d329992011-04-15 18:20:02849 p.window_action = browser::NavigateParams::SHOW_WINDOW;
[email protected]fee320542011-03-02 01:30:49850 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
[email protected]637b3442011-01-10 23:31:48851 browser::Navigate(&p);
852
853 // The second tab should still be selected, but navigated to the new path.
854 EXPECT_EQ(browser(), p.browser);
855 EXPECT_EQ(2, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44856 EXPECT_EQ(1, browser()->active_index());
[email protected]637b3442011-01-10 23:31:48857 EXPECT_EQ(singleton_url_target,
858 browser()->GetSelectedTabContents()->GetURL());
859}
860
[email protected]07afd7c2011-02-17 10:07:11861// This test verifies that constructing params with disposition = SINGLETON_TAB
[email protected]fee320542011-03-02 01:30:49862// and IGNORE_AND_NAVIGATE will open an existing matching tab with a different
863// query.
[email protected]07afd7c2011-02-17 10:07:11864IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
865 Disposition_SingletonTabExisting_IgnoreQuery) {
866 int initial_tab_count = browser()->tab_count();
867 GURL singleton_url_current("chrome://settings/internet");
[email protected]2905f742011-10-13 03:51:58868 browser()->AddSelectedTabWithURL(
869 singleton_url_current, content::PAGE_TRANSITION_LINK);
[email protected]07afd7c2011-02-17 10:07:11870
871 EXPECT_EQ(initial_tab_count + 1, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44872 EXPECT_EQ(initial_tab_count, browser()->active_index());
[email protected]07afd7c2011-02-17 10:07:11873
874 // Navigate to a different settings path.
875 GURL singleton_url_target(
876 "chrome://settings/internet?"
877 "servicePath=/profile/ethernet_00aa00aa00aa&networkType=1");
878 browser::NavigateParams p(MakeNavigateParams());
879 p.disposition = SINGLETON_TAB;
880 p.url = singleton_url_target;
[email protected]7d329992011-04-15 18:20:02881 p.window_action = browser::NavigateParams::SHOW_WINDOW;
[email protected]fee320542011-03-02 01:30:49882 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
[email protected]07afd7c2011-02-17 10:07:11883 browser::Navigate(&p);
884
885 // Last tab should still be selected.
886 EXPECT_EQ(browser(), p.browser);
887 EXPECT_EQ(initial_tab_count + 1, browser()->tab_count());
[email protected]1ea49d52011-04-12 17:44:44888 EXPECT_EQ(initial_tab_count, browser()->active_index());
[email protected]07afd7c2011-02-17 10:07:11889}
890
[email protected]bd817c22011-02-09 08:16:46891// This test verifies that the settings page isn't opened in the incognito
892// window.
893IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
894 Disposition_Settings_UseNonIncognitoWindow) {
895 Browser* incognito_browser = CreateIncognitoBrowser();
896
897 EXPECT_EQ(2u, BrowserList::size());
898 EXPECT_EQ(1, browser()->tab_count());
899 EXPECT_EQ(1, incognito_browser->tab_count());
900
901 // Navigate to the settings page.
902 browser::NavigateParams p(MakeNavigateParams(incognito_browser));
903 p.disposition = SINGLETON_TAB;
[email protected]ddddfda2011-07-14 23:19:39904 p.url = GetSettingsURL();
[email protected]7d329992011-04-15 18:20:02905 p.window_action = browser::NavigateParams::SHOW_WINDOW;
[email protected]bd817c22011-02-09 08:16:46906 browser::Navigate(&p);
907
908 // The settings page should be opened in browser() window.
909 EXPECT_NE(incognito_browser, p.browser);
910 EXPECT_EQ(browser(), p.browser);
911 EXPECT_EQ(2, browser()->tab_count());
[email protected]ddddfda2011-07-14 23:19:39912 EXPECT_EQ(GetSettingsURL(),
[email protected]bd817c22011-02-09 08:16:46913 browser()->GetSelectedTabContents()->GetURL());
914}
915
[email protected]82404cd2011-07-12 19:55:14916// This test verifies that the settings page isn't opened in the incognito
917// window from a non-incognito window (bookmark open-in-incognito trigger).
918IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
919 Disposition_Settings_UseNonIncognitoWindowForBookmark) {
920 browser::NavigateParams params(browser(), GURL("chrome://settings"),
[email protected]2905f742011-10-13 03:51:58921 content::PAGE_TRANSITION_AUTO_BOOKMARK);
[email protected]82404cd2011-07-12 19:55:14922 params.disposition = OFF_THE_RECORD;
923 {
924 ui_test_utils::WindowedNotificationObserver observer(
925 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
926 browser::Navigate(&params);
927 observer.Wait();
928 }
929
930 EXPECT_EQ(1u, BrowserList::size());
931 EXPECT_EQ(GURL("chrome://settings"),
932 browser()->GetSelectedTabContents()->GetURL().GetOrigin());
933}
934
[email protected]bd817c22011-02-09 08:16:46935// This test verifies that the bookmarks page isn't opened in the incognito
936// window.
937IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
938 Disposition_Bookmarks_UseNonIncognitoWindow) {
939 Browser* incognito_browser = CreateIncognitoBrowser();
940
941 EXPECT_EQ(2u, BrowserList::size());
942 EXPECT_EQ(1, browser()->tab_count());
943 EXPECT_EQ(1, incognito_browser->tab_count());
944
945 // Navigate to the settings page.
946 browser::NavigateParams p(MakeNavigateParams(incognito_browser));
947 p.disposition = SINGLETON_TAB;
[email protected]ddddfda2011-07-14 23:19:39948 p.url = GURL(chrome::kChromeUIBookmarksURL);
[email protected]7d329992011-04-15 18:20:02949 p.window_action = browser::NavigateParams::SHOW_WINDOW;
[email protected]bd817c22011-02-09 08:16:46950 browser::Navigate(&p);
951
952 // The bookmarks page should be opened in browser() window.
953 EXPECT_NE(incognito_browser, p.browser);
954 EXPECT_EQ(browser(), p.browser);
955 EXPECT_EQ(2, browser()->tab_count());
[email protected]ddddfda2011-07-14 23:19:39956 EXPECT_EQ(GURL(chrome::kChromeUIBookmarksURL),
[email protected]bd817c22011-02-09 08:16:46957 browser()->GetSelectedTabContents()->GetURL());
958}
959
[email protected]7de53c62011-05-13 06:44:16960// This test makes sure a crashed singleton tab reloads from a new navigation.
961IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
962 NavigateToCrashedSingletonTab) {
[email protected]ddddfda2011-07-14 23:19:39963 GURL singleton_url(GetSettingsAdvancedURL());
[email protected]2905f742011-10-13 03:51:58964 TabContentsWrapper* wrapper = browser()->AddSelectedTabWithURL(
965 singleton_url, content::PAGE_TRANSITION_LINK);
[email protected]7de53c62011-05-13 06:44:16966 TabContents* tab_contents = wrapper->tab_contents();
967
968 // We should have one browser with 2 tabs, the 2nd selected.
969 EXPECT_EQ(1u, BrowserList::size());
970 EXPECT_EQ(2, browser()->tab_count());
971 EXPECT_EQ(1, browser()->active_index());
972
973 // Kill the singleton tab.
974 tab_contents->SetIsCrashed(base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
975 EXPECT_TRUE(tab_contents->is_crashed());
976
977 browser::NavigateParams p(MakeNavigateParams());
978 p.disposition = SINGLETON_TAB;
979 p.url = singleton_url;
980 p.window_action = browser::NavigateParams::SHOW_WINDOW;
981 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
[email protected]ddddfda2011-07-14 23:19:39982 ui_test_utils::NavigateToURL(&p);
[email protected]7de53c62011-05-13 06:44:16983
984 // The tab should not be sad anymore.
985 EXPECT_FALSE(tab_contents->is_crashed());
986}
987
[email protected]fcca741b2011-06-17 22:46:37988IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
989 NavigateFromDefaultToOptionsInSameTab) {
[email protected]ddddfda2011-07-14 23:19:39990 {
991 ui_test_utils::WindowedNotificationObserver observer(
992 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
993 browser()->OpenOptionsDialog();
994 observer.Wait();
995 }
[email protected]fcca741b2011-06-17 22:46:37996 EXPECT_EQ(1, browser()->tab_count());
[email protected]ddddfda2011-07-14 23:19:39997 EXPECT_EQ(GetSettingsURL(),
998 browser()->GetSelectedTabContents()->GetURL().GetOrigin());
[email protected]fcca741b2011-06-17 22:46:37999}
1000
1001IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1002 NavigateFromBlankToOptionsInSameTab) {
1003 browser::NavigateParams p(MakeNavigateParams());
[email protected]ddddfda2011-07-14 23:19:391004 p.url = GURL(chrome::kAboutBlankURL);
1005 ui_test_utils::NavigateToURL(&p);
[email protected]fcca741b2011-06-17 22:46:371006
[email protected]ddddfda2011-07-14 23:19:391007 {
1008 ui_test_utils::WindowedNotificationObserver observer(
1009 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1010 browser()->OpenOptionsDialog();
1011 observer.Wait();
1012 }
[email protected]fcca741b2011-06-17 22:46:371013 EXPECT_EQ(1, browser()->tab_count());
[email protected]ddddfda2011-07-14 23:19:391014 EXPECT_EQ(GetSettingsURL(),
1015 browser()->GetSelectedTabContents()->GetURL().GetOrigin());
[email protected]fcca741b2011-06-17 22:46:371016}
1017
1018IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1019 NavigateFromNTPToOptionsInSameTab) {
1020 browser::NavigateParams p(MakeNavigateParams());
[email protected]ddddfda2011-07-14 23:19:391021 p.url = GURL(chrome::kChromeUINewTabURL);
1022 ui_test_utils::NavigateToURL(&p);
[email protected]fcca741b2011-06-17 22:46:371023 EXPECT_EQ(1, browser()->tab_count());
[email protected]ddddfda2011-07-14 23:19:391024 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
[email protected]fcca741b2011-06-17 22:46:371025 browser()->GetSelectedTabContents()->GetURL());
1026
[email protected]ddddfda2011-07-14 23:19:391027 {
1028 ui_test_utils::WindowedNotificationObserver observer(
1029 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1030 browser()->OpenOptionsDialog();
1031 observer.Wait();
1032 }
[email protected]fcca741b2011-06-17 22:46:371033 EXPECT_EQ(1, browser()->tab_count());
[email protected]ddddfda2011-07-14 23:19:391034 EXPECT_EQ(GetSettingsURL(),
1035 browser()->GetSelectedTabContents()->GetURL().GetOrigin());
[email protected]fcca741b2011-06-17 22:46:371036}
1037
1038IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1039 NavigateFromPageToOptionsInNewTab) {
1040 browser::NavigateParams p(MakeNavigateParams());
[email protected]ddddfda2011-07-14 23:19:391041 ui_test_utils::NavigateToURL(&p);
[email protected]fcca741b2011-06-17 22:46:371042 EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedTabContents()->GetURL());
1043 EXPECT_EQ(1u, BrowserList::size());
1044 EXPECT_EQ(1, browser()->tab_count());
1045
[email protected]ddddfda2011-07-14 23:19:391046 {
1047 ui_test_utils::WindowedNotificationObserver observer(
1048 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1049 browser()->OpenOptionsDialog();
1050 observer.Wait();
1051 }
[email protected]fcca741b2011-06-17 22:46:371052 EXPECT_EQ(2, browser()->tab_count());
[email protected]ddddfda2011-07-14 23:19:391053 EXPECT_EQ(GetSettingsURL(),
1054 browser()->GetSelectedTabContents()->GetURL().GetOrigin());
[email protected]fcca741b2011-06-17 22:46:371055}
1056
1057IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1058 NavigateFromNTPToOptionsSingleton) {
[email protected]ddddfda2011-07-14 23:19:391059 {
1060 ui_test_utils::WindowedNotificationObserver observer(
1061 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1062 browser()->OpenOptionsDialog();
1063 observer.Wait();
1064 }
[email protected]fcca741b2011-06-17 22:46:371065 EXPECT_EQ(1, browser()->tab_count());
1066
1067 browser()->NewTab();
1068 EXPECT_EQ(2, browser()->tab_count());
1069
[email protected]ddddfda2011-07-14 23:19:391070 {
1071 ui_test_utils::WindowedNotificationObserver observer(
1072 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1073 browser()->OpenOptionsDialog();
1074 observer.Wait();
1075 }
[email protected]fcca741b2011-06-17 22:46:371076 EXPECT_EQ(2, browser()->tab_count());
[email protected]ddddfda2011-07-14 23:19:391077 EXPECT_EQ(GetSettingsURL(),
1078 browser()->GetSelectedTabContents()->GetURL().GetOrigin());
[email protected]fcca741b2011-06-17 22:46:371079}
1080
1081IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1082 NavigateFromNTPToOptionsPageInSameTab) {
[email protected]ddddfda2011-07-14 23:19:391083 {
1084 ui_test_utils::WindowedNotificationObserver observer(
1085 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1086 browser()->ShowOptionsTab(chrome::kPersonalOptionsSubPage);
1087 observer.Wait();
1088 }
[email protected]fcca741b2011-06-17 22:46:371089 EXPECT_EQ(1, browser()->tab_count());
[email protected]ddddfda2011-07-14 23:19:391090 EXPECT_EQ(GetSettingsPersonalURL(),
[email protected]fcca741b2011-06-17 22:46:371091 browser()->GetSelectedTabContents()->GetURL());
1092
1093 browser()->NewTab();
1094 EXPECT_EQ(2, browser()->tab_count());
1095
[email protected]ddddfda2011-07-14 23:19:391096 {
1097 ui_test_utils::WindowedNotificationObserver observer(
1098 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1099 browser()->ShowOptionsTab(chrome::kPersonalOptionsSubPage);
1100 observer.Wait();
1101 }
[email protected]fcca741b2011-06-17 22:46:371102 EXPECT_EQ(2, browser()->tab_count());
[email protected]ddddfda2011-07-14 23:19:391103 EXPECT_EQ(GetSettingsPersonalURL(),
[email protected]fcca741b2011-06-17 22:46:371104 browser()->GetSelectedTabContents()->GetURL());
1105}
1106
1107IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1108 NavigateFromOtherTabToSingletonOptions) {
[email protected]ddddfda2011-07-14 23:19:391109 {
1110 ui_test_utils::WindowedNotificationObserver observer(
1111 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1112 browser()->OpenOptionsDialog();
1113 observer.Wait();
1114 }
1115 {
1116 ui_test_utils::WindowedNotificationObserver observer(
1117 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
[email protected]2905f742011-10-13 03:51:581118 browser()->AddSelectedTabWithURL(
1119 GetGoogleURL(), content::PAGE_TRANSITION_LINK);
[email protected]ddddfda2011-07-14 23:19:391120 observer.Wait();
1121 }
[email protected]fcca741b2011-06-17 22:46:371122
[email protected]ddddfda2011-07-14 23:19:391123 {
1124 ui_test_utils::WindowedNotificationObserver observer(
1125 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1126 browser()->OpenOptionsDialog();
1127 observer.Wait();
1128 }
[email protected]fcca741b2011-06-17 22:46:371129 EXPECT_EQ(2, browser()->tab_count());
[email protected]ddddfda2011-07-14 23:19:391130 EXPECT_EQ(GetSettingsURL(),
1131 browser()->GetSelectedTabContents()->GetURL().GetOrigin());
[email protected]fcca741b2011-06-17 22:46:371132}
1133
[email protected]26c53e662011-07-09 02:21:021134// Tests that when a new tab is opened from the omnibox, the focus is moved from
1135// the omnibox for the current tab.
1136IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1137 NavigateFromOmniboxIntoNewTab) {
1138 GURL url("http://www.google.com/");
1139 GURL url2("http://maps.google.com/");
1140
1141 // Navigate to url.
1142 browser::NavigateParams p(MakeNavigateParams());
1143 p.disposition = CURRENT_TAB;
1144 p.url = url;
1145 browser::Navigate(&p);
1146
1147 // Focus the omnibox.
1148 browser()->FocusLocationBar();
1149
1150 AutocompleteEditController* controller =
1151 browser()->window()->GetLocationBar()->location_entry()->model()->
1152 controller();
1153
1154 // Simulate an alt-enter.
1155 controller->OnAutocompleteAccept(url2, NEW_FOREGROUND_TAB,
[email protected]2905f742011-10-13 03:51:581156 content::PAGE_TRANSITION_TYPED, GURL());
[email protected]26c53e662011-07-09 02:21:021157
1158 // Make sure the second tab is selected.
1159 EXPECT_EQ(1, browser()->active_index());
1160
1161 // The tab contents should have the focus in the second tab.
1162 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
1163 VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
1164
1165 // Go back to the first tab. The focus should not be in the omnibox.
1166 browser()->SelectPreviousTab();
1167 EXPECT_EQ(0, browser()->active_index());
1168 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(),
1169 VIEW_ID_LOCATION_BAR));
1170}
1171
[email protected]ddddfda2011-07-14 23:19:391172IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1173 NavigateFromDefaultToHistoryInSameTab) {
1174 {
1175 ui_test_utils::WindowedNotificationObserver observer(
1176 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1177 browser()->ShowHistoryTab();
1178 observer.Wait();
1179 }
1180 EXPECT_EQ(1, browser()->tab_count());
1181 EXPECT_EQ(GURL(chrome::kChromeUIHistoryURL),
1182 browser()->GetSelectedTabContents()->GetURL());
1183}
1184
1185IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1186 NavigateFromDefaultToBookmarksInSameTab) {
1187 {
1188 ui_test_utils::WindowedNotificationObserver observer(
1189 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
[email protected]0af8f132011-07-16 01:37:021190 browser()->OpenBookmarkManager();
[email protected]ddddfda2011-07-14 23:19:391191 observer.Wait();
1192 }
1193 EXPECT_EQ(1, browser()->tab_count());
1194 EXPECT_EQ(GURL(chrome::kChromeUIBookmarksURL),
1195 browser()->GetSelectedTabContents()->GetURL());
1196}
1197
1198IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1199 NavigateFromDefaultToDownloadsInSameTab) {
1200 {
1201 ui_test_utils::WindowedNotificationObserver observer(
1202 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
1203 browser()->ShowDownloadsTab();
1204 observer.Wait();
1205 }
1206 EXPECT_EQ(1, browser()->tab_count());
1207 EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL),
1208 browser()->GetSelectedTabContents()->GetURL());
1209}
1210
1211} // namespace