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

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

Issue 2038843003: bluetooth: Don't call methods of WebContentsImpl while it's being destroyed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address moar comments 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
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 #ifndef CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_ 5 #ifndef CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_
6 #define CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_ 6 #define CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "content/browser/frame_host/render_frame_host_impl.h" 13 #include "content/browser/frame_host/render_frame_host_impl.h"
14 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
15 #include "content/public/test/mock_render_process_host.h" 15 #include "content/public/test/mock_render_process_host.h"
16 #include "content/public/test/test_renderer_host.h" 16 #include "content/public/test/test_renderer_host.h"
17 #include "content/test/test_render_view_host.h" 17 #include "content/test/test_render_view_host.h"
18 #include "ui/base/page_transition_types.h" 18 #include "ui/base/page_transition_types.h"
19 19
20 struct FrameHostMsg_DidCommitProvisionalLoad_Params; 20 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
21 21
22 namespace content { 22 namespace content {
23 23
24 class FrameConnectedBluetoothDevices;
25
24 class TestRenderFrameHostCreationObserver : public WebContentsObserver { 26 class TestRenderFrameHostCreationObserver : public WebContentsObserver {
25 public: 27 public:
26 explicit TestRenderFrameHostCreationObserver(WebContents* web_contents); 28 explicit TestRenderFrameHostCreationObserver(WebContents* web_contents);
27 ~TestRenderFrameHostCreationObserver() override; 29 ~TestRenderFrameHostCreationObserver() override;
28 30
29 // WebContentsObserver implementation. 31 // WebContentsObserver implementation.
30 void RenderFrameCreated(RenderFrameHost* render_frame_host) override; 32 void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
31 33
32 RenderFrameHost* last_created_frame() const { return last_created_frame_; } 34 RenderFrameHost* last_created_frame() const { return last_created_frame_; }
33 35
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // Simulate a renderer-initiated navigation up until commit. 102 // Simulate a renderer-initiated navigation up until commit.
101 void NavigateAndCommitRendererInitiated(int page_id, 103 void NavigateAndCommitRendererInitiated(int page_id,
102 bool did_create_new_entry, 104 bool did_create_new_entry,
103 const GURL& url); 105 const GURL& url);
104 106
105 // With the current navigation logic this method is a no-op. 107 // With the current navigation logic this method is a no-op.
106 // PlzNavigate: this method simulates receiving a BeginNavigation IPC. 108 // PlzNavigate: this method simulates receiving a BeginNavigation IPC.
107 void SendRendererInitiatedNavigationRequest(const GURL& url, 109 void SendRendererInitiatedNavigationRequest(const GURL& url,
108 bool has_user_gesture); 110 bool has_user_gesture);
109 111
112 void SetFrameConnectedBluetoothDevices(
113 std::unique_ptr<FrameConnectedBluetoothDevices> connected_devices);
114
110 void DidChangeOpener(int opener_routing_id); 115 void DidChangeOpener(int opener_routing_id);
111 116
112 void DidEnforceStrictMixedContentChecking(); 117 void DidEnforceStrictMixedContentChecking();
113 118
114 // If set, navigations will appear to have cleared the history list in the 119 // If set, navigations will appear to have cleared the history list in the
115 // RenderFrame 120 // RenderFrame
116 // (FrameHostMsg_DidCommitProvisionalLoad_Params::history_list_was_cleared). 121 // (FrameHostMsg_DidCommitProvisionalLoad_Params::history_list_was_cleared).
117 // False by default. 122 // False by default.
118 void set_simulate_history_list_was_cleared(bool cleared) { 123 void set_simulate_history_list_was_cleared(bool cleared) {
119 simulate_history_list_was_cleared_ = cleared; 124 simulate_history_list_was_cleared_ = cleared;
(...skipping 26 matching lines...) Expand all
146 int response_code, 151 int response_code,
147 const ModificationCallback& callback); 152 const ModificationCallback& callback);
148 153
149 // Computes the page ID for a pending navigation in this RenderFrameHost; 154 // Computes the page ID for a pending navigation in this RenderFrameHost;
150 int32_t ComputeNextPageID(); 155 int32_t ComputeNextPageID();
151 156
152 TestRenderFrameHostCreationObserver child_creation_observer_; 157 TestRenderFrameHostCreationObserver child_creation_observer_;
153 158
154 std::string contents_mime_type_; 159 std::string contents_mime_type_;
155 160
161 // This exists to test destruction of an instance of this type while
162 // the owning WebContentsImpl is being destroyed.
163 std::unique_ptr<FrameConnectedBluetoothDevices> connected_devices_;
ncarter (slow) 2016/06/06 22:52:25 I'm not sure why this is needed here, since you ne
ortuno 2016/06/06 23:01:18 The particular case we are trying to hit is when a
ncarter (slow) 2016/06/08 19:15:35 Sorry for the delay in replying to this. Let's spl
ortuno 2016/06/09 17:40:02 Thanks for the patch! I really appreciate it :) I
164
156 // See set_simulate_history_list_was_cleared() above. 165 // See set_simulate_history_list_was_cleared() above.
157 bool simulate_history_list_was_cleared_; 166 bool simulate_history_list_was_cleared_;
158 167
159 DISALLOW_COPY_AND_ASSIGN(TestRenderFrameHost); 168 DISALLOW_COPY_AND_ASSIGN(TestRenderFrameHost);
160 }; 169 };
161 170
162 } // namespace content 171 } // namespace content
163 172
164 #endif // CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_ 173 #endif // CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698