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

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

Issue 3697009: Fix broken trybot compiles by moving test cases inside the anonymous namespac... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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 | « no previous file | no next file » | 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 "chrome/browser/browser.h" 5 #include "chrome/browser/browser.h"
6 #include "chrome/browser/browser_list.h" 6 #include "chrome/browser/browser_list.h"
7 #include "chrome/browser/browser_navigator.h" 7 #include "chrome/browser/browser_navigator.h"
8 #include "chrome/browser/browser_window.h" 8 #include "chrome/browser/browser_window.h"
9 #include "chrome/browser/profile.h" 9 #include "chrome/browser/profile.h"
10 #include "chrome/browser/tab_contents/tab_contents.h" 10 #include "chrome/browser/tab_contents/tab_contents.h"
11 #include "chrome/browser/tab_contents/tab_contents_view.h" 11 #include "chrome/browser/tab_contents/tab_contents_view.h"
12 #include "chrome/browser/tabs/tab_strip_model.h" 12 #include "chrome/browser/tabs/tab_strip_model.h"
13 #include "chrome/test/in_process_browser_test.h" 13 #include "chrome/test/in_process_browser_test.h"
14 #include "chrome/test/ui_test_utils.h" 14 #include "chrome/test/ui_test_utils.h"
15 #include "ipc/ipc_message.h" 15 #include "ipc/ipc_message.h"
16 16
17 namespace { 17 namespace {
Marc-Antoine Ruel (Google) 2010/10/13 00:05:29 Test base classes shouldn't be in an anonymous nam
18 18
19 class BrowserNavigatorTest : public InProcessBrowserTest, 19 class BrowserNavigatorTest : public InProcessBrowserTest,
20 public NavigatorDelegate { 20 public NavigatorDelegate {
21 public: 21 public:
22 // Overridden from NavigatorDelegate: 22 // Overridden from NavigatorDelegate:
23 virtual void UpdateUIForNavigationInTab(TabContents* contents, 23 virtual void UpdateUIForNavigationInTab(TabContents* contents,
24 PageTransition::Type transition, 24 PageTransition::Type transition,
25 bool user_initiated) { 25 bool user_initiated) {
26 // Nothing needed. 26 // Nothing needed.
27 } 27 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 p.disposition = disposition; 64 p.disposition = disposition;
65 browser::Navigate(&p, this); 65 browser::Navigate(&p, this);
66 66
67 // Nothing should have happened as a result of Navigate(); 67 // Nothing should have happened as a result of Navigate();
68 EXPECT_EQ(1, browser()->tab_count()); 68 EXPECT_EQ(1, browser()->tab_count());
69 EXPECT_EQ(1u, BrowserList::size()); 69 EXPECT_EQ(1u, BrowserList::size());
70 EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL()); 70 EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL());
71 } 71 }
72 }; 72 };
73 73
74 } // namespace
75
76 // This test verifies that when a navigation occurs within a tab, the tab count 74 // This test verifies that when a navigation occurs within a tab, the tab count
77 // of the Browser remains the same and the current tab bears the loaded URL. 75 // of the Browser remains the same and the current tab bears the loaded URL.
78 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_CurrentTab) { 76 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_CurrentTab) {
Marc-Antoine Ruel (Google) 2010/10/13 00:05:29 Tests shouldn't be in a anonymous namespace.
79 browser::NavigateParams p(MakeNavigateParams()); 77 browser::NavigateParams p(MakeNavigateParams());
80 browser::Navigate(&p, this); 78 browser::Navigate(&p, this);
81 ui_test_utils::WaitForNavigationInCurrentTab(browser()); 79 ui_test_utils::WaitForNavigationInCurrentTab(browser());
82 EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedTabContents()->GetURL()); 80 EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedTabContents()->GetURL());
83 // We should have one window with one tab. 81 // We should have one window with one tab.
84 EXPECT_EQ(1u, BrowserList::size()); 82 EXPECT_EQ(1u, BrowserList::size());
85 EXPECT_EQ(1, browser()->tab_count()); 83 EXPECT_EQ(1, browser()->tab_count());
86 } 84 }
87 85
88 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTab) { 86 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTab) {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // Navigate() should have inserted a new tab at slot 0 in the tabstrip. 372 // Navigate() should have inserted a new tab at slot 0 in the tabstrip.
375 EXPECT_EQ(browser(), p.browser); 373 EXPECT_EQ(browser(), p.browser);
376 EXPECT_EQ(0, browser()->tabstrip_model()->GetIndexOfTabContents( 374 EXPECT_EQ(0, browser()->tabstrip_model()->GetIndexOfTabContents(
377 static_cast<const TabContents*>(p.target_contents))); 375 static_cast<const TabContents*>(p.target_contents)));
378 376
379 // We should have one window - the browser() provided by the framework. 377 // We should have one window - the browser() provided by the framework.
380 EXPECT_EQ(1u, BrowserList::size()); 378 EXPECT_EQ(1u, BrowserList::size());
381 EXPECT_EQ(2, browser()->tab_count()); 379 EXPECT_EQ(2, browser()->tab_count());
382 } 380 }
383 381
382 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698