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

Side by Side Diff: content/browser/renderer_host/render_view_host_browsertest.cc

Issue 8603015: Get rid of a bunch of view_messages.h includes from chrome by making the TabContentsObserver inte... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix linux and try to fix mac again Created 9 years, 1 month 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 "base/time.h" 5 #include "base/time.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/test/base/in_process_browser_test.h" 9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 class RenderViewHostTestTabContentsObserver : public TabContentsObserver { 163 class RenderViewHostTestTabContentsObserver : public TabContentsObserver {
164 public: 164 public:
165 explicit RenderViewHostTestTabContentsObserver(TabContents* tab_contents) 165 explicit RenderViewHostTestTabContentsObserver(TabContents* tab_contents)
166 : TabContentsObserver(tab_contents), 166 : TabContentsObserver(tab_contents),
167 navigation_count_(0) {} 167 navigation_count_(0) {}
168 virtual ~RenderViewHostTestTabContentsObserver() {} 168 virtual ~RenderViewHostTestTabContentsObserver() {}
169 169
170 virtual void DidNavigateMainFrame( 170 virtual void DidNavigateMainFrame(
171 const content::LoadCommittedDetails& details, 171 const content::LoadCommittedDetails& details,
172 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE { 172 const content::FrameNavigateParams& params) OVERRIDE {
173 observed_socket_address_ = params.socket_address; 173 observed_socket_address_ = params.socket_address;
174 ++navigation_count_; 174 ++navigation_count_;
175 } 175 }
176 176
177 const net::HostPortPair& observed_socket_address() const { 177 const net::HostPortPair& observed_socket_address() const {
178 return observed_socket_address_; 178 return observed_socket_address_;
179 } 179 }
180 180
181 int navigation_count() const { return navigation_count_; } 181 int navigation_count() const { return navigation_count_; }
182 182
183 private: 183 private:
184 net::HostPortPair observed_socket_address_; 184 net::HostPortPair observed_socket_address_;
185 int navigation_count_; 185 int navigation_count_;
186 186
187 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestTabContentsObserver); 187 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestTabContentsObserver);
188 }; 188 };
189 189
190 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) { 190 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) {
191 ASSERT_TRUE(test_server()->Start()); 191 ASSERT_TRUE(test_server()->Start());
192 RenderViewHostTestTabContentsObserver observer( 192 RenderViewHostTestTabContentsObserver observer(
193 browser()->GetSelectedTabContents()); 193 browser()->GetSelectedTabContents());
194 194
195 GURL test_url = test_server()->GetURL("files/simple.html"); 195 GURL test_url = test_server()->GetURL("files/simple.html");
196 ui_test_utils::NavigateToURL(browser(), test_url); 196 ui_test_utils::NavigateToURL(browser(), test_url);
197 197
198 EXPECT_EQ(test_server()->host_port_pair().ToString(), 198 EXPECT_EQ(test_server()->host_port_pair().ToString(),
199 observer.observed_socket_address().ToString()); 199 observer.observed_socket_address().ToString());
200 EXPECT_EQ(1, observer.navigation_count()); 200 EXPECT_EQ(1, observer.navigation_count());
201 } 201 }
OLDNEW
« no previous file with comments | « content/browser/intents/intent_injector.cc ('k') | content/browser/tab_contents/tab_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698