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

Side by Side Diff: content/test/render_view_fake_resources_test.cc

Issue 8220006: Rename RenderView to RenderViewImpl. Update Chrome's DEPS so that it can't include the RenderView... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | « content/test/render_view_fake_resources_test.h ('k') | 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) 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 "content/test/render_view_fake_resources_test.h" 5 #include "content/test/render_view_fake_resources_test.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "content/common/dom_storage_common.h" 12 #include "content/common/dom_storage_common.h"
13 #include "content/common/resource_messages.h" 13 #include "content/common/resource_messages.h"
14 #include "content/common/resource_response.h" 14 #include "content/common/resource_response.h"
15 #include "content/common/view_messages.h" 15 #include "content/common/view_messages.h"
16 #include "content/renderer/mock_render_process.h" 16 #include "content/renderer/mock_render_process.h"
17 #include "content/renderer/render_thread_impl.h" 17 #include "content/renderer/render_thread_impl.h"
18 #include "content/renderer/render_view.h" 18 #include "content/renderer/render_view_impl.h"
19 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
20 #include "net/base/upload_data.h" 20 #include "net/base/upload_data.h"
21 #include "net/http/http_response_headers.h" 21 #include "net/http/http_response_headers.h"
22 #include "net/url_request/url_request_status.h" 22 #include "net/url_request/url_request_status.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h"
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
28 #include "webkit/glue/glue_serialize.h" 28 #include "webkit/glue/glue_serialize.h"
(...skipping 12 matching lines...) Expand all
41 const IPC::Message& message) { 41 const IPC::Message& message) {
42 IPC_BEGIN_MESSAGE_MAP(RenderViewFakeResourcesTest, message) 42 IPC_BEGIN_MESSAGE_MAP(RenderViewFakeResourcesTest, message)
43 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) 43 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady)
44 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnDidStopLoading) 44 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnDidStopLoading)
45 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) 45 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource)
46 IPC_END_MESSAGE_MAP() 46 IPC_END_MESSAGE_MAP()
47 return true; 47 return true;
48 } 48 }
49 49
50 bool RenderViewFakeResourcesTest::Visit(content::RenderView* render_view) { 50 bool RenderViewFakeResourcesTest::Visit(content::RenderView* render_view) {
51 view_ = static_cast<RenderView*>(render_view); 51 view_ = render_view;
52 return false; 52 return false;
53 } 53 }
54 54
55 void RenderViewFakeResourcesTest::SetUp() { 55 void RenderViewFakeResourcesTest::SetUp() {
56 // Set up the renderer. This code is largely adapted from 56 // Set up the renderer. This code is largely adapted from
57 // render_view_test.cc and renderer_main.cc. Note that we use a 57 // render_view_test.cc and renderer_main.cc. Note that we use a
58 // MockRenderProcess (because we don't need to use IPC for painting), 58 // MockRenderProcess (because we don't need to use IPC for painting),
59 // but we use a real RenderThread so that we can use the ResourceDispatcher 59 // but we use a real RenderThread so that we can use the ResourceDispatcher
60 // to fetch network resources. These are then served canned content 60 // to fetch network resources. These are then served canned content
61 // in OnRequestResource(). 61 // in OnRequestResource().
(...skipping 25 matching lines...) Expand all
87 87
88 void RenderViewFakeResourcesTest::TearDown() { 88 void RenderViewFakeResourcesTest::TearDown() {
89 // Try very hard to collect garbage before shutting down. 89 // Try very hard to collect garbage before shutting down.
90 GetMainFrame()->collectGarbage(); 90 GetMainFrame()->collectGarbage();
91 GetMainFrame()->collectGarbage(); 91 GetMainFrame()->collectGarbage();
92 92
93 ASSERT_TRUE(channel_->Send(new ViewMsg_Close(kViewId))); 93 ASSERT_TRUE(channel_->Send(new ViewMsg_Close(kViewId)));
94 do { 94 do {
95 message_loop_.RunAllPending(); 95 message_loop_.RunAllPending();
96 view_ = NULL; 96 view_ = NULL;
97 RenderView::ForEach(this); 97 content::RenderView::ForEach(this);
98 } while (view_); 98 } while (view_);
99 99
100 mock_process_.reset(); 100 mock_process_.reset();
101 } 101 }
102 102
103 content::RenderView* RenderViewFakeResourcesTest::view() { 103 content::RenderView* RenderViewFakeResourcesTest::view() {
104 return view_; 104 return view_;
105 } 105 }
106 106
107 WebKit::WebFrame* RenderViewFakeResourcesTest::GetMainFrame() { 107 WebKit::WebFrame* RenderViewFakeResourcesTest::GetMainFrame() {
108 return view_->webview()->mainFrame(); 108 return view_->GetWebView()->mainFrame();
109 } 109 }
110 110
111 void RenderViewFakeResourcesTest::LoadURL(const std::string& url) { 111 void RenderViewFakeResourcesTest::LoadURL(const std::string& url) {
112 GURL g_url(url); 112 GURL g_url(url);
113 GetMainFrame()->loadRequest(WebKit::WebURLRequest(g_url)); 113 GetMainFrame()->loadRequest(WebKit::WebURLRequest(g_url));
114 message_loop_.Run(); 114 message_loop_.Run();
115 } 115 }
116 116
117 void RenderViewFakeResourcesTest::LoadURLWithPost(const std::string& url) { 117 void RenderViewFakeResourcesTest::LoadURLWithPost(const std::string& url) {
118 GURL g_url(url); 118 GURL g_url(url);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 message.routing_id(), 174 message.routing_id(),
175 request_id, 175 request_id,
176 net::URLRequestStatus(), 176 net::URLRequestStatus(),
177 std::string(), 177 std::string(),
178 base::Time()))); 178 base::Time())));
179 } 179 }
180 180
181 void RenderViewFakeResourcesTest::OnRenderViewReady() { 181 void RenderViewFakeResourcesTest::OnRenderViewReady() {
182 // Grab a pointer to the new view using RenderViewVisitor. 182 // Grab a pointer to the new view using RenderViewVisitor.
183 ASSERT_TRUE(!view_); 183 ASSERT_TRUE(!view_);
184 RenderView::ForEach(this); 184 content::RenderView::ForEach(this);
185 ASSERT_TRUE(view_); 185 ASSERT_TRUE(view_);
186 message_loop_.Quit(); 186 message_loop_.Quit();
187 } 187 }
188 188
189 void RenderViewFakeResourcesTest::GoToOffset( 189 void RenderViewFakeResourcesTest::GoToOffset(
190 int offset, 190 int offset,
191 const WebKit::WebHistoryItem& history_item) { 191 const WebKit::WebHistoryItem& history_item) {
192 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
192 ViewMsg_Navigate_Params params; 193 ViewMsg_Navigate_Params params;
193 params.page_id = view_->GetPageId() + offset; 194 params.page_id = impl->GetPageId() + offset;
194 params.pending_history_list_offset = 195 params.pending_history_list_offset =
195 view_->history_list_offset() + offset; 196 impl->history_list_offset() + offset;
196 params.current_history_list_offset = view_->history_list_offset(); 197 params.current_history_list_offset = impl->history_list_offset();
197 params.current_history_list_length = (view_->historyBackListCount() + 198 params.current_history_list_length = (impl->historyBackListCount() +
198 view_->historyForwardListCount() + 1); 199 impl->historyForwardListCount() + 1);
199 params.url = GURL(history_item.urlString()); 200 params.url = GURL(history_item.urlString());
200 params.transition = PageTransition::FORWARD_BACK; 201 params.transition = PageTransition::FORWARD_BACK;
201 params.state = webkit_glue::HistoryItemToString(history_item); 202 params.state = webkit_glue::HistoryItemToString(history_item);
202 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; 203 params.navigation_type = ViewMsg_Navigate_Type::NORMAL;
203 params.request_time = base::Time::Now(); 204 params.request_time = base::Time::Now();
204 channel_->Send(new ViewMsg_Navigate(view_->routing_id(), params)); 205 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params));
205 message_loop_.Run(); 206 message_loop_.Run();
206 } 207 }
OLDNEW
« no previous file with comments | « content/test/render_view_fake_resources_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698