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

Side by Side Diff: content/public/test/render_view_test.cc

Issue 743803002: Avoid stale navigation requests without excessive page id knowledge in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 6 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
« no previous file with comments | « content/public/test/render_view_test.h ('k') | content/renderer/render_frame_impl.h » ('j') | 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) 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 330 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
331 impl->OnMessageReceived(*input_message); 331 impl->OnMessageReceived(*input_message);
332 return true; 332 return true;
333 } 333 }
334 334
335 void RenderViewTest::SetFocused(const blink::WebNode& node) { 335 void RenderViewTest::SetFocused(const blink::WebNode& node) {
336 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 336 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
337 impl->focusedNodeChanged(node); 337 impl->focusedNodeChanged(node);
338 } 338 }
339 339
340 void RenderViewTest::ClearHistory() {
341 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
342 impl->page_id_ = -1;
343 impl->history_list_offset_ = -1;
344 impl->history_list_length_ = 0;
345 impl->history_page_ids_.clear();
346 }
347
348 void RenderViewTest::Reload(const GURL& url) { 340 void RenderViewTest::Reload(const GURL& url) {
349 FrameMsg_Navigate_Params params; 341 FrameMsg_Navigate_Params params;
350 params.common_params.url = url; 342 params.common_params.url = url;
351 params.common_params.navigation_type = FrameMsg_Navigate_Type::RELOAD; 343 params.common_params.navigation_type = FrameMsg_Navigate_Type::RELOAD;
352 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 344 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
353 impl->GetMainRenderFrame()->OnNavigate(params); 345 impl->GetMainRenderFrame()->OnNavigate(params);
354 FrameLoadWaiter(impl->GetMainRenderFrame()).Wait(); 346 FrameLoadWaiter(impl->GetMainRenderFrame()).Wait();
355 } 347 }
356 348
357 uint32 RenderViewTest::GetNavigationIPCType() { 349 uint32 RenderViewTest::GetNavigationIPCType() {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 407
416 scoped_ptr<ViewMsg_Resize_Params> RenderViewTest::InitialSizeParams() { 408 scoped_ptr<ViewMsg_Resize_Params> RenderViewTest::InitialSizeParams() {
417 return make_scoped_ptr(new ViewMsg_Resize_Params()); 409 return make_scoped_ptr(new ViewMsg_Resize_Params());
418 } 410 }
419 411
420 void RenderViewTest::GoToOffset(int offset, const PageState& state) { 412 void RenderViewTest::GoToOffset(int offset, const PageState& state) {
421 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 413 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
422 414
423 int history_list_length = impl->historyBackListCount() + 415 int history_list_length = impl->historyBackListCount() +
424 impl->historyForwardListCount() + 1; 416 impl->historyForwardListCount() + 1;
425 int pending_offset = offset + impl->history_list_offset(); 417 int pending_offset = offset + impl->history_list_offset_;
426 418
427 FrameMsg_Navigate_Params navigate_params; 419 FrameMsg_Navigate_Params navigate_params;
428 navigate_params.common_params.navigation_type = 420 navigate_params.common_params.navigation_type =
429 FrameMsg_Navigate_Type::NORMAL; 421 FrameMsg_Navigate_Type::NORMAL;
430 navigate_params.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; 422 navigate_params.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
431 navigate_params.current_history_list_length = history_list_length; 423 navigate_params.current_history_list_length = history_list_length;
432 navigate_params.current_history_list_offset = impl->history_list_offset(); 424 navigate_params.current_history_list_offset = impl->history_list_offset_;
433 navigate_params.pending_history_list_offset = pending_offset; 425 navigate_params.pending_history_list_offset = pending_offset;
434 navigate_params.page_id = impl->page_id_ + offset; 426 navigate_params.page_id = impl->page_id_ + offset;
435 navigate_params.commit_params.page_state = state; 427 navigate_params.commit_params.page_state = state;
436 navigate_params.request_time = base::Time::Now(); 428 navigate_params.request_time = base::Time::Now();
437 429
438 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), 430 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(),
439 navigate_params); 431 navigate_params);
440 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); 432 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message);
441 433
442 // The load actually happens asynchronously, so we pump messages to process 434 // The load actually happens asynchronously, so we pump messages to process
443 // the pending continuation. 435 // the pending continuation.
444 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); 436 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait();
445 } 437 }
446 438
447 } // namespace content 439 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/render_view_test.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698