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

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

Issue 1294243004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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
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 <cctype> 7 #include <cctype>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "components/scheduler/renderer/renderer_scheduler.h" 12 #include "components/scheduler/renderer/renderer_scheduler.h"
13 #include "content/app/mojo/mojo_init.h" 13 #include "content/app/mojo/mojo_init.h"
14 #include "content/common/dom_storage/dom_storage_types.h" 14 #include "content/common/dom_storage/dom_storage_types.h"
15 #include "content/common/frame_messages.h" 15 #include "content/common/frame_messages.h"
16 #include "content/common/input_messages.h" 16 #include "content/common/input_messages.h"
17 #include "content/common/service_worker/service_worker_types.h"
17 #include "content/common/view_messages.h" 18 #include "content/common/view_messages.h"
18 #include "content/public/browser/content_browser_client.h" 19 #include "content/public/browser/content_browser_client.h"
19 #include "content/public/browser/native_web_keyboard_event.h" 20 #include "content/public/browser/native_web_keyboard_event.h"
20 #include "content/public/common/content_client.h" 21 #include "content/public/common/content_client.h"
21 #include "content/public/common/renderer_preferences.h" 22 #include "content/public/common/renderer_preferences.h"
22 #include "content/public/renderer/content_renderer_client.h" 23 #include "content/public/renderer/content_renderer_client.h"
23 #include "content/public/test/frame_load_waiter.h" 24 #include "content/public/test/frame_load_waiter.h"
24 #include "content/renderer/history_controller.h" 25 #include "content/renderer/history_controller.h"
25 #include "content/renderer/history_serialization.h" 26 #include "content/renderer/history_serialization.h"
26 #include "content/renderer/render_thread_impl.h" 27 #include "content/renderer/render_thread_impl.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 435
435 void RenderViewTest::SetFocused(const blink::WebNode& node) { 436 void RenderViewTest::SetFocused(const blink::WebNode& node) {
436 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 437 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
437 impl->focusedNodeChanged(blink::WebNode(), node); 438 impl->focusedNodeChanged(blink::WebNode(), node);
438 } 439 }
439 440
440 void RenderViewTest::Reload(const GURL& url) { 441 void RenderViewTest::Reload(const GURL& url) {
441 CommonNavigationParams common_params( 442 CommonNavigationParams common_params(
442 url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD, 443 url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD,
443 true, false, base::TimeTicks(), 444 true, false, base::TimeTicks(),
444 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL()); 445 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(),
446 kInvalidServiceWorkerProviderId);
445 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 447 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
446 TestRenderFrame* frame = 448 TestRenderFrame* frame =
447 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); 449 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame());
448 frame->Navigate(common_params, StartNavigationParams(), 450 frame->Navigate(common_params, StartNavigationParams(),
449 RequestNavigationParams()); 451 RequestNavigationParams());
450 FrameLoadWaiter(frame).Wait(); 452 FrameLoadWaiter(frame).Wait();
451 } 453 }
452 454
453 uint32 RenderViewTest::GetNavigationIPCType() { 455 uint32 RenderViewTest::GetNavigationIPCType() {
454 return FrameHostMsg_DidCommitProvisionalLoad::ID; 456 return FrameHostMsg_DidCommitProvisionalLoad::ID;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 void RenderViewTest::GoToOffset(int offset, const PageState& state) { 568 void RenderViewTest::GoToOffset(int offset, const PageState& state) {
567 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 569 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
568 570
569 int history_list_length = impl->historyBackListCount() + 571 int history_list_length = impl->historyBackListCount() +
570 impl->historyForwardListCount() + 1; 572 impl->historyForwardListCount() + 1;
571 int pending_offset = offset + impl->history_list_offset_; 573 int pending_offset = offset + impl->history_list_offset_;
572 574
573 CommonNavigationParams common_params( 575 CommonNavigationParams common_params(
574 GURL(), Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK, 576 GURL(), Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK,
575 FrameMsg_Navigate_Type::NORMAL, true, false, base::TimeTicks(), 577 FrameMsg_Navigate_Type::NORMAL, true, false, base::TimeTicks(),
576 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL()); 578 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(),
579 kInvalidServiceWorkerProviderId);
577 RequestNavigationParams request_params; 580 RequestNavigationParams request_params;
578 request_params.page_state = state; 581 request_params.page_state = state;
579 request_params.page_id = impl->page_id_ + offset; 582 request_params.page_id = impl->page_id_ + offset;
580 request_params.nav_entry_id = pending_offset + 1; 583 request_params.nav_entry_id = pending_offset + 1;
581 request_params.pending_history_list_offset = pending_offset; 584 request_params.pending_history_list_offset = pending_offset;
582 request_params.current_history_list_offset = impl->history_list_offset_; 585 request_params.current_history_list_offset = impl->history_list_offset_;
583 request_params.current_history_list_length = history_list_length; 586 request_params.current_history_list_length = history_list_length;
584 587
585 TestRenderFrame* frame = 588 TestRenderFrame* frame =
586 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); 589 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame());
587 frame->Navigate(common_params, StartNavigationParams(), request_params); 590 frame->Navigate(common_params, StartNavigationParams(), request_params);
588 591
589 // The load actually happens asynchronously, so we pump messages to process 592 // The load actually happens asynchronously, so we pump messages to process
590 // the pending continuation. 593 // the pending continuation.
591 FrameLoadWaiter(frame).Wait(); 594 FrameLoadWaiter(frame).Wait();
592 } 595 }
593 596
594 } // namespace content 597 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698