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

Side by Side Diff: chrome/browser/ui/webui/web_ui_unittest.cc

Issue 8949061: Move a bunch of methods from TabContents into the WebContents interface. This change either moves... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Check the flags. Some should reflect the new page (URL, title), some 59 // Check the flags. Some should reflect the new page (URL, title), some
60 // should reflect the old one (bookmark bar) until it has committed. 60 // should reflect the old one (bookmark bar) until it has committed.
61 EXPECT_TRUE(wrapper->favicon_tab_helper()->ShouldDisplayFavicon()); 61 EXPECT_TRUE(wrapper->favicon_tab_helper()->ShouldDisplayFavicon());
62 EXPECT_FALSE(contents->FocusLocationBarByDefault()); 62 EXPECT_FALSE(contents->FocusLocationBarByDefault());
63 63
64 // Commit the regular page load. Note that we must send it to the "pending" 64 // Commit the regular page load. Note that we must send it to the "pending"
65 // RenderViewHost if there is one, since this transition will also cause a 65 // RenderViewHost if there is one, since this transition will also cause a
66 // process transition, and our RVH pointer will be the "committed" one. 66 // process transition, and our RVH pointer will be the "committed" one.
67 // In the second call to this function from WebUIToStandard, it won't 67 // In the second call to this function from WebUIToStandard, it won't
68 // actually be pending, which is the point of this test. 68 // actually be pending, which is the point of this test.
69 if (contents->render_manager_for_testing()->pending_render_view_host()) { 69 if (contents->GetRenderManagerForTesting()->pending_render_view_host()) {
70 static_cast<TestRenderViewHost*>( 70 static_cast<TestRenderViewHost*>(
71 contents->render_manager_for_testing()-> 71 contents->GetRenderManagerForTesting()->
72 pending_render_view_host())->SendNavigate(page_id + 1, next_url); 72 pending_render_view_host())->SendNavigate(page_id + 1, next_url);
73 } else { 73 } else {
74 static_cast<TestRenderViewHost*>( 74 static_cast<TestRenderViewHost*>(
75 contents->GetRenderViewHost())->SendNavigate(page_id + 1, next_url); 75 contents->GetRenderViewHost())->SendNavigate(page_id + 1, next_url);
76 } 76 }
77 77
78 // The state should now reflect a regular page. 78 // The state should now reflect a regular page.
79 EXPECT_TRUE(wrapper->favicon_tab_helper()->ShouldDisplayFavicon()); 79 EXPECT_TRUE(wrapper->favicon_tab_helper()->ShouldDisplayFavicon());
80 EXPECT_FALSE(contents->FocusLocationBarByDefault()); 80 EXPECT_FALSE(contents->FocusLocationBarByDefault());
81 } 81 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Navigate forward. Shouldn't focus the location bar. 204 // Navigate forward. Shouldn't focus the location bar.
205 focus_called = tc->focus_called(); 205 focus_called = tc->focus_called();
206 ASSERT_TRUE(controller().CanGoForward()); 206 ASSERT_TRUE(controller().CanGoForward());
207 controller().GoForward(); 207 controller().GoForward();
208 old_rvh = rvh(); 208 old_rvh = rvh();
209 old_rvh->SendShouldCloseACK(true); 209 old_rvh->SendShouldCloseACK(true);
210 pending_rvh()->SendNavigate(next_page_id, next_url); 210 pending_rvh()->SendNavigate(next_page_id, next_url);
211 old_rvh->OnSwapOutACK(); 211 old_rvh->OnSwapOutACK();
212 EXPECT_EQ(focus_called, tc->focus_called()); 212 EXPECT_EQ(focus_called, tc->focus_called());
213 } 213 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/web_ui_browsertest.cc ('k') | chrome/test/base/browser_with_test_window_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698