OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/favicon/favicon_tab_helper.h" | 5 #include "chrome/browser/favicon/favicon_tab_helper.h" |
6 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 6 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
8 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 8 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Tests that the New Tab Page flags are correctly set and propogated by | 88 // Tests that the New Tab Page flags are correctly set and propogated by |
89 // TabContents when we first navigate to a Web UI page, then to a standard | 89 // TabContents when we first navigate to a Web UI page, then to a standard |
90 // non-DOM-UI page. | 90 // non-DOM-UI page. |
91 TEST_F(WebUITest, WebUIToStandard) { | 91 TEST_F(WebUITest, WebUIToStandard) { |
92 DoNavigationTest(contents_wrapper(), 1); | 92 DoNavigationTest(contents_wrapper(), 1); |
93 | 93 |
94 // Test the case where we're not doing the initial navigation. This is | 94 // Test the case where we're not doing the initial navigation. This is |
95 // slightly different than the very-first-navigation case since the | 95 // slightly different than the very-first-navigation case since the |
96 // SiteInstance will be the same (the original TabContents must still be | 96 // SiteInstance will be the same (the original TabContents must still be |
97 // alive), which will trigger different behavior in RenderViewHostManager. | 97 // alive), which will trigger different behavior in RenderViewHostManager. |
98 TestTabContents* contents2 = new TestTabContents(profile_.get(), NULL); | 98 TestTabContents* contents2 = new TestTabContents(profile(), NULL); |
99 TabContentsWrapper wrapper2(contents2); | 99 TabContentsWrapper wrapper2(contents2); |
100 | 100 |
101 DoNavigationTest(&wrapper2, 101); | 101 DoNavigationTest(&wrapper2, 101); |
102 } | 102 } |
103 | 103 |
104 TEST_F(WebUITest, WebUIToWebUI) { | 104 TEST_F(WebUITest, WebUIToWebUI) { |
105 // Do a load (this state is tested above). | 105 // Do a load (this state is tested above). |
106 GURL new_tab_url(chrome::kChromeUINewTabURL); | 106 GURL new_tab_url(chrome::kChromeUINewTabURL); |
107 controller().LoadURL(new_tab_url, GURL(), PageTransition::LINK, | 107 controller().LoadURL(new_tab_url, GURL(), PageTransition::LINK, |
108 std::string()); | 108 std::string()); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Navigate forward. Shouldn't focus the location bar. | 199 // Navigate forward. Shouldn't focus the location bar. |
200 focus_called = tc->focus_called(); | 200 focus_called = tc->focus_called(); |
201 ASSERT_TRUE(controller().CanGoForward()); | 201 ASSERT_TRUE(controller().CanGoForward()); |
202 controller().GoForward(); | 202 controller().GoForward(); |
203 old_rvh = rvh(); | 203 old_rvh = rvh(); |
204 old_rvh->SendShouldCloseACK(true); | 204 old_rvh->SendShouldCloseACK(true); |
205 pending_rvh()->SendNavigate(next_page_id, next_url); | 205 pending_rvh()->SendNavigate(next_page_id, next_url); |
206 old_rvh->OnSwapOutACK(); | 206 old_rvh->OnSwapOutACK(); |
207 EXPECT_EQ(focus_called, tc->focus_called()); | 207 EXPECT_EQ(focus_called, tc->focus_called()); |
208 } | 208 } |
OLD | NEW |