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

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

Issue 2050803002: Better way to implement FrameConnectedBluetoothDevicesTest Base URL: https://chromium.googlesource.com/chromium/src.git@patch_ortuno
Patch Set: Created 4 years, 6 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
« no previous file with comments | « content/test/test_render_frame_host.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/test_render_frame_host.h" 5 #include "content/test/test_render_frame_host.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "content/browser/bluetooth/frame_connected_bluetooth_devices.h" 8 #include "content/browser/bluetooth/frame_connected_bluetooth_devices.h"
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/navigation_handle_impl.h" 10 #include "content/browser/frame_host/navigation_handle_impl.h"
11 #include "content/browser/frame_host/navigation_request.h" 11 #include "content/browser/frame_host/navigation_request.h"
12 #include "content/browser/frame_host/navigator.h" 12 #include "content/browser/frame_host/navigator.h"
13 #include "content/browser/frame_host/navigator_impl.h" 13 #include "content/browser/frame_host/navigator_impl.h"
14 #include "content/browser/frame_host/render_frame_host_delegate.h" 14 #include "content/browser/frame_host/render_frame_host_delegate.h"
15 #include "content/browser/web_contents/web_contents_impl.h" 15 #include "content/browser/web_contents/web_contents_impl.h"
16 #include "content/common/frame_messages.h" 16 #include "content/common/frame_messages.h"
17 #include "content/public/browser/stream_handle.h" 17 #include "content/public/browser/stream_handle.h"
18 #include "content/public/common/browser_side_navigation_policy.h" 18 #include "content/public/common/browser_side_navigation_policy.h"
19 #include "content/public/common/url_constants.h" 19 #include "content/public/common/url_constants.h"
20 #include "content/test/browser_side_navigation_test_utils.h" 20 #include "content/test/browser_side_navigation_test_utils.h"
21 #include "content/test/test_navigation_url_loader.h" 21 #include "content/test/test_navigation_url_loader.h"
22 #include "content/test/test_render_view_host.h" 22 #include "content/test/test_render_view_host.h"
23 #include "mojo/public/cpp/bindings/interface_request.h"
23 #include "net/base/load_flags.h" 24 #include "net/base/load_flags.h"
25 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h"
24 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" 26 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
25 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 27 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
26 #include "third_party/WebKit/public/web/WebTreeScopeType.h" 28 #include "third_party/WebKit/public/web/WebTreeScopeType.h"
27 #include "ui/base/page_transition_types.h" 29 #include "ui/base/page_transition_types.h"
28 30
29 namespace content { 31 namespace content {
30 32
31 TestRenderFrameHostCreationObserver::TestRenderFrameHostCreationObserver( 33 TestRenderFrameHostCreationObserver::TestRenderFrameHostCreationObserver(
32 WebContents* web_contents) 34 WebContents* web_contents)
33 : WebContentsObserver(web_contents), last_created_frame_(NULL) { 35 : WebContentsObserver(web_contents), last_created_frame_(NULL) {
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 if (!redirect_url.is_empty()) 423 if (!redirect_url.is_empty())
422 url_loader->SimulateServerRedirect(redirect_url); 424 url_loader->SimulateServerRedirect(redirect_url);
423 425
424 // Simulate the network stack commit. 426 // Simulate the network stack commit.
425 scoped_refptr<ResourceResponse> response(new ResourceResponse); 427 scoped_refptr<ResourceResponse> response(new ResourceResponse);
426 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to 428 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to
427 // fully commit the navigation at this call to CallOnResponseStarted. 429 // fully commit the navigation at this call to CallOnResponseStarted.
428 url_loader->CallOnResponseStarted(response, MakeEmptyStream(), nullptr); 430 url_loader->CallOnResponseStarted(response, MakeEmptyStream(), nullptr);
429 } 431 }
430 432
433 WebBluetoothServiceImpl*
434 TestRenderFrameHost::CreateWebBluetoothServiceForTesting() {
435 // TODO(nick): Right now I'm leaking the WebBluetoothServicePtr, because I
436 // don't know the lifetime implications. We should either free it here or
437 // return it to the caller. In fact, it may be desireable to return it to the
438 // caller anyway (as a pair<ServicePtr, WebBluetoothServiceImpl> ?)
439 auto service_ptr = new blink::mojom::WebBluetoothServicePtr();
440 WebBluetoothServiceImpl* service =
441 RenderFrameHostImpl::CreateWebBluetoothService(
442 mojo::GetProxy(service_ptr)); // TODO(nick): Don't leak service_ptr.
443 return service;
444 }
445
431 int32_t TestRenderFrameHost::ComputeNextPageID() { 446 int32_t TestRenderFrameHost::ComputeNextPageID() {
432 const NavigationEntryImpl* entry = static_cast<NavigationEntryImpl*>( 447 const NavigationEntryImpl* entry = static_cast<NavigationEntryImpl*>(
433 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); 448 frame_tree_node()->navigator()->GetController()->GetPendingEntry());
434 DCHECK(!(entry && entry->site_instance()) || 449 DCHECK(!(entry && entry->site_instance()) ||
435 entry->site_instance() == GetSiteInstance()); 450 entry->site_instance() == GetSiteInstance());
436 // Entry can be null when committing an error page (the pending entry was 451 // Entry can be null when committing an error page (the pending entry was
437 // cleared during DidFailProvisionalLoad). 452 // cleared during DidFailProvisionalLoad).
438 int page_id = entry ? entry->GetPageID() : -1; 453 int page_id = entry ? entry->GetPageID() : -1;
439 if (page_id == -1) { 454 if (page_id == -1) {
440 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(delegate()); 455 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(delegate());
441 page_id = web_contents->GetMaxPageIDForSiteInstance(GetSiteInstance()) + 1; 456 page_id = web_contents->GetMaxPageIDForSiteInstance(GetSiteInstance()) + 1;
442 } 457 }
443 return page_id; 458 return page_id;
444 } 459 }
445 460
446 } // namespace content 461 } // namespace content
OLDNEW
« no previous file with comments | « content/test/test_render_frame_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698