OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/test/render_view_fake_resources_test.h" | 5 #include "content/public/test/render_view_fake_resources_test.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 mock_process_.reset(); | 107 mock_process_.reset(); |
108 RendererWebKitPlatformSupportImpl::SetSandboxEnabledForTesting( | 108 RendererWebKitPlatformSupportImpl::SetSandboxEnabledForTesting( |
109 sandbox_was_enabled_); | 109 sandbox_was_enabled_); |
110 } | 110 } |
111 | 111 |
112 RenderView* RenderViewFakeResourcesTest::view() { | 112 RenderView* RenderViewFakeResourcesTest::view() { |
113 return view_; | 113 return view_; |
114 } | 114 } |
115 | 115 |
116 WebKit::WebFrame* RenderViewFakeResourcesTest::GetMainFrame() { | 116 blink::WebFrame* RenderViewFakeResourcesTest::GetMainFrame() { |
117 return view_->GetWebView()->mainFrame(); | 117 return view_->GetWebView()->mainFrame(); |
118 } | 118 } |
119 | 119 |
120 void RenderViewFakeResourcesTest::LoadURL(const std::string& url) { | 120 void RenderViewFakeResourcesTest::LoadURL(const std::string& url) { |
121 GURL g_url(url); | 121 GURL g_url(url); |
122 GetMainFrame()->loadRequest(WebKit::WebURLRequest(g_url)); | 122 GetMainFrame()->loadRequest(blink::WebURLRequest(g_url)); |
123 message_loop_.Run(); | 123 message_loop_.Run(); |
124 } | 124 } |
125 | 125 |
126 void RenderViewFakeResourcesTest::LoadURLWithPost(const std::string& url) { | 126 void RenderViewFakeResourcesTest::LoadURLWithPost(const std::string& url) { |
127 GURL g_url(url); | 127 GURL g_url(url); |
128 WebKit::WebURLRequest request(g_url); | 128 blink::WebURLRequest request(g_url); |
129 request.setHTTPMethod(WebKit::WebString::fromUTF8("POST")); | 129 request.setHTTPMethod(blink::WebString::fromUTF8("POST")); |
130 GetMainFrame()->loadRequest(request); | 130 GetMainFrame()->loadRequest(request); |
131 message_loop_.Run(); | 131 message_loop_.Run(); |
132 } | 132 } |
133 | 133 |
134 void RenderViewFakeResourcesTest::GoBack() { | 134 void RenderViewFakeResourcesTest::GoBack() { |
135 GoToOffset(-1, GetMainFrame()->previousHistoryItem()); | 135 GoToOffset(-1, GetMainFrame()->previousHistoryItem()); |
136 } | 136 } |
137 | 137 |
138 void RenderViewFakeResourcesTest::GoForward( | 138 void RenderViewFakeResourcesTest::GoForward( |
139 const WebKit::WebHistoryItem& history_item) { | 139 const blink::WebHistoryItem& history_item) { |
140 GoToOffset(1, history_item); | 140 GoToOffset(1, history_item); |
141 } | 141 } |
142 | 142 |
143 void RenderViewFakeResourcesTest::OnDidStopLoading() { | 143 void RenderViewFakeResourcesTest::OnDidStopLoading() { |
144 message_loop_.Quit(); | 144 message_loop_.Quit(); |
145 } | 145 } |
146 | 146 |
147 void RenderViewFakeResourcesTest::OnRequestResource( | 147 void RenderViewFakeResourcesTest::OnRequestResource( |
148 const IPC::Message& message, | 148 const IPC::Message& message, |
149 int request_id, | 149 int request_id, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 void RenderViewFakeResourcesTest::OnRenderViewReady() { | 196 void RenderViewFakeResourcesTest::OnRenderViewReady() { |
197 // Grab a pointer to the new view using RenderViewVisitor. | 197 // Grab a pointer to the new view using RenderViewVisitor. |
198 ASSERT_TRUE(!view_); | 198 ASSERT_TRUE(!view_); |
199 RenderView::ForEach(this); | 199 RenderView::ForEach(this); |
200 ASSERT_TRUE(view_); | 200 ASSERT_TRUE(view_); |
201 message_loop_.Quit(); | 201 message_loop_.Quit(); |
202 } | 202 } |
203 | 203 |
204 void RenderViewFakeResourcesTest::GoToOffset( | 204 void RenderViewFakeResourcesTest::GoToOffset( |
205 int offset, | 205 int offset, |
206 const WebKit::WebHistoryItem& history_item) { | 206 const blink::WebHistoryItem& history_item) { |
207 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 207 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
208 ViewMsg_Navigate_Params params; | 208 ViewMsg_Navigate_Params params; |
209 params.page_id = impl->GetPageId() + offset; | 209 params.page_id = impl->GetPageId() + offset; |
210 params.pending_history_list_offset = | 210 params.pending_history_list_offset = |
211 impl->history_list_offset() + offset; | 211 impl->history_list_offset() + offset; |
212 params.current_history_list_offset = impl->history_list_offset(); | 212 params.current_history_list_offset = impl->history_list_offset(); |
213 params.current_history_list_length = (impl->historyBackListCount() + | 213 params.current_history_list_length = (impl->historyBackListCount() + |
214 impl->historyForwardListCount() + 1); | 214 impl->historyForwardListCount() + 1); |
215 params.url = GURL(history_item.urlString()); | 215 params.url = GURL(history_item.urlString()); |
216 params.transition = PAGE_TRANSITION_FORWARD_BACK; | 216 params.transition = PAGE_TRANSITION_FORWARD_BACK; |
217 params.page_state = HistoryItemToPageState(history_item); | 217 params.page_state = HistoryItemToPageState(history_item); |
218 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 218 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
219 params.request_time = base::Time::Now(); | 219 params.request_time = base::Time::Now(); |
220 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); | 220 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); |
221 message_loop_.Run(); | 221 message_loop_.Run(); |
222 } | 222 } |
223 | 223 |
224 } // namespace content | 224 } // namespace content |
OLD | NEW |