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: content/public/test/render_view_test.cc

Issue 659093002: Pass the size to the RenderView on creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@java_enum
Patch Set: rebase Created 6 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
OLDNEW
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_test.h" 5 #include "content/public/test/render_view_test.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "content/common/dom_storage/dom_storage_types.h" 8 #include "content/common/dom_storage/dom_storage_types.h"
9 #include "content/common/frame_messages.h" 9 #include "content/common/frame_messages.h"
10 #include "content/common/input_messages.h" 10 #include "content/common/input_messages.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 kMainFrameRouteId, 191 kMainFrameRouteId,
192 kSurfaceId, 192 kSurfaceId,
193 kInvalidSessionStorageNamespaceId, 193 kInvalidSessionStorageNamespaceId,
194 base::string16(), 194 base::string16(),
195 false, // is_renderer_created 195 false, // is_renderer_created
196 false, // swapped_out 196 false, // swapped_out
197 MSG_ROUTING_NONE, // proxy_routing_id 197 MSG_ROUTING_NONE, // proxy_routing_id
198 false, // hidden 198 false, // hidden
199 false, // never_visible 199 false, // never_visible
200 1, // next_page_id 200 1, // next_page_id
201 blink::WebScreenInfo()); 201 *initial_size_params());
202 view->AddRef(); 202 view->AddRef();
203 view_ = view; 203 view_ = view;
204 } 204 }
205 205
206 void RenderViewTest::TearDown() { 206 void RenderViewTest::TearDown() {
207 // Try very hard to collect garbage before shutting down. 207 // Try very hard to collect garbage before shutting down.
208 // "5" was chosen following http://crbug.com/46571#c9 208 // "5" was chosen following http://crbug.com/46571#c9
209 const int kGCIterations = 5; 209 const int kGCIterations = 5;
210 for (int i = 0; i < kGCIterations; i++) 210 for (int i = 0; i < kGCIterations; i++)
211 GetMainFrame()->collectGarbage(); 211 GetMainFrame()->collectGarbage();
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 394 }
395 395
396 ContentBrowserClient* RenderViewTest::CreateContentBrowserClient() { 396 ContentBrowserClient* RenderViewTest::CreateContentBrowserClient() {
397 return new ContentBrowserClient; 397 return new ContentBrowserClient;
398 } 398 }
399 399
400 ContentRendererClient* RenderViewTest::CreateContentRendererClient() { 400 ContentRendererClient* RenderViewTest::CreateContentRendererClient() {
401 return new ContentRendererClient; 401 return new ContentRendererClient;
402 } 402 }
403 403
404 scoped_ptr<ViewMsg_Resize_Params> RenderViewTest::initial_size_params() {
405 return make_scoped_ptr(new ViewMsg_Resize_Params());
406 }
407
404 void RenderViewTest::GoToOffset(int offset, const PageState& state) { 408 void RenderViewTest::GoToOffset(int offset, const PageState& state) {
405 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 409 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
406 410
407 int history_list_length = impl->historyBackListCount() + 411 int history_list_length = impl->historyBackListCount() +
408 impl->historyForwardListCount() + 1; 412 impl->historyForwardListCount() + 1;
409 int pending_offset = offset + impl->history_list_offset(); 413 int pending_offset = offset + impl->history_list_offset();
410 414
411 FrameMsg_Navigate_Params navigate_params; 415 FrameMsg_Navigate_Params navigate_params;
412 navigate_params.common_params.navigation_type = 416 navigate_params.common_params.navigation_type =
413 FrameMsg_Navigate_Type::NORMAL; 417 FrameMsg_Navigate_Type::NORMAL;
414 navigate_params.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; 418 navigate_params.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
415 navigate_params.current_history_list_length = history_list_length; 419 navigate_params.current_history_list_length = history_list_length;
416 navigate_params.current_history_list_offset = impl->history_list_offset(); 420 navigate_params.current_history_list_offset = impl->history_list_offset();
417 navigate_params.pending_history_list_offset = pending_offset; 421 navigate_params.pending_history_list_offset = pending_offset;
418 navigate_params.page_id = impl->page_id_ + offset; 422 navigate_params.page_id = impl->page_id_ + offset;
419 navigate_params.commit_params.page_state = state; 423 navigate_params.commit_params.page_state = state;
420 navigate_params.request_time = base::Time::Now(); 424 navigate_params.request_time = base::Time::Now();
421 425
422 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), 426 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(),
423 navigate_params); 427 navigate_params);
424 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); 428 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message);
425 429
426 // The load actually happens asynchronously, so we pump messages to process 430 // The load actually happens asynchronously, so we pump messages to process
427 // the pending continuation. 431 // the pending continuation.
428 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); 432 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait();
429 } 433 }
430 434
431 } // namespace content 435 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698