Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/ui/browser_navigator_browsertest.cc

Issue 6177002: Flags: Enable Tabbed Options by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Line length fix. Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "chrome/browser/profiles/profile.h" 6 #include "chrome/browser/profiles/profile.h"
7 #include "chrome/browser/tab_contents/tab_contents.h" 7 #include "chrome/browser/tab_contents/tab_contents.h"
8 #include "chrome/browser/tab_contents/tab_contents_view.h" 8 #include "chrome/browser/tab_contents/tab_contents_view.h"
9 #include "chrome/browser/tabs/tab_strip_model.h" 9 #include "chrome/browser/tabs/tab_strip_model.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 browser::NavigateParams p(MakeNavigateParams()); 56 browser::NavigateParams p(MakeNavigateParams());
57 p.disposition = disposition; 57 p.disposition = disposition;
58 browser::Navigate(&p); 58 browser::Navigate(&p);
59 59
60 // Nothing should have happened as a result of Navigate(); 60 // Nothing should have happened as a result of Navigate();
61 EXPECT_EQ(1, browser()->tab_count()); 61 EXPECT_EQ(1, browser()->tab_count());
62 EXPECT_EQ(1u, BrowserList::size()); 62 EXPECT_EQ(1u, BrowserList::size());
63 EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL()); 63 EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL());
64 } 64 }
65 65
66 // TODO(jhawkins): Remove once tabbed options are enabled by default.
67 virtual void SetUpCommandLine(CommandLine* command_line) {
68 command_line->AppendSwitch(switches::kEnableTabbedOptions);
69 }
70
71 void Observe(NotificationType type, const NotificationSource& source, 66 void Observe(NotificationType type, const NotificationSource& source,
72 const NotificationDetails& details) { 67 const NotificationDetails& details) {
73 switch (type.value) { 68 switch (type.value) {
74 case NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB: { 69 case NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB: {
75 ++this->created_tab_contents_count_; 70 ++this->created_tab_contents_count_;
76 break; 71 break;
77 } 72 }
78 default: 73 default:
79 break; 74 break;
80 } 75 }
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 EXPECT_EQ(Browser::TYPE_NORMAL, p.browser->type()); 497 EXPECT_EQ(Browser::TYPE_NORMAL, p.browser->type());
503 498
504 // We should now have two windows, the browser() provided by the framework and 499 // We should now have two windows, the browser() provided by the framework and
505 // the new normal window. 500 // the new normal window.
506 EXPECT_EQ(2u, BrowserList::size()); 501 EXPECT_EQ(2u, BrowserList::size());
507 EXPECT_EQ(1, browser()->tab_count()); 502 EXPECT_EQ(1, browser()->tab_count());
508 EXPECT_EQ(1, p.browser->tab_count()); 503 EXPECT_EQ(1, p.browser->tab_count());
509 } 504 }
510 505
511 // This test verifies that constructing params with disposition = SINGLETON_TAB 506 // This test verifies that constructing params with disposition = SINGLETON_TAB
512 // and |ignore_paths| = true opens a new tab navigated to the specified URL if n o 507 // and |ignore_paths| = true opens a new tab navigated to the specified URL if
513 // previous tab with that URL (minus the path) exists. 508 // no previous tab with that URL (minus the path) exists.
514 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 509 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
515 Disposition_SingletonTabNew_IgnorePath) { 510 Disposition_SingletonTabNew_IgnorePath) {
516 GURL url("http://www.google.com/"); 511 GURL url("http://www.google.com/");
517 browser()->AddSelectedTabWithURL(url, PageTransition::LINK); 512 browser()->AddSelectedTabWithURL(url, PageTransition::LINK);
518 513
519 // We should have one browser with 2 tabs, the 2nd selected. 514 // We should have one browser with 2 tabs, the 2nd selected.
520 EXPECT_EQ(1u, BrowserList::size()); 515 EXPECT_EQ(1u, BrowserList::size());
521 EXPECT_EQ(2, browser()->tab_count()); 516 EXPECT_EQ(2, browser()->tab_count());
522 EXPECT_EQ(1, browser()->selected_index()); 517 EXPECT_EQ(1, browser()->selected_index());
523 518
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 // The middle tab should now be selected and navigated to the sub-page of the 591 // The middle tab should now be selected and navigated to the sub-page of the
597 // URL. 592 // URL.
598 EXPECT_EQ(browser(), p.browser); 593 EXPECT_EQ(browser(), p.browser);
599 EXPECT_EQ(3, browser()->tab_count()); 594 EXPECT_EQ(3, browser()->tab_count());
600 EXPECT_EQ(1, browser()->selected_index()); 595 EXPECT_EQ(1, browser()->selected_index());
601 EXPECT_EQ(GURL("chrome://settings/personal"), 596 EXPECT_EQ(GURL("chrome://settings/personal"),
602 browser()->GetSelectedTabContents()->GetURL()); 597 browser()->GetSelectedTabContents()->GetURL());
603 } 598 }
604 599
605 } // namespace 600 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698