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

Side by Side Diff: content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc

Issue 117693002: Make RenderFrameHostManager swap RenderFrameHosts, not RenderViewHosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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/browser/renderer_host/media/web_contents_video_capture_device. h" 5 #include "content/browser/renderer_host/media/web_contents_video_capture_device. h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/debug/debugger.h" 8 #include "base/debug/debugger.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 #pragma warning(disable: 4250) 221 #pragma warning(disable: 4250)
222 #endif 222 #endif
223 223
224 // A stub implementation which returns solid-color bitmaps in calls to 224 // A stub implementation which returns solid-color bitmaps in calls to
225 // CopyFromBackingStore(). The behavior is controlled by a 225 // CopyFromBackingStore(). The behavior is controlled by a
226 // CaptureTestSourceController. 226 // CaptureTestSourceController.
227 class CaptureTestRenderViewHost : public TestRenderViewHost { 227 class CaptureTestRenderViewHost : public TestRenderViewHost {
228 public: 228 public:
229 CaptureTestRenderViewHost(SiteInstance* instance, 229 CaptureTestRenderViewHost(SiteInstance* instance,
230 RenderViewHostDelegate* delegate, 230 RenderViewHostDelegate* delegate,
231 RenderFrameHostDelegate* frame_delegate,
232 RenderWidgetHostDelegate* widget_delegate, 231 RenderWidgetHostDelegate* widget_delegate,
233 int routing_id, 232 int routing_id,
234 int main_frame_routing_id, 233 int main_frame_routing_id,
235 bool swapped_out, 234 bool swapped_out,
236 CaptureTestSourceController* controller) 235 CaptureTestSourceController* controller)
237 : TestRenderViewHost(instance, delegate, frame_delegate, widget_delegate, 236 : TestRenderViewHost(instance, delegate, widget_delegate, routing_id,
238 routing_id, main_frame_routing_id, swapped_out), 237 main_frame_routing_id, swapped_out),
239 controller_(controller) { 238 controller_(controller) {
240 // Override the default view installed by TestRenderViewHost; we need 239 // Override the default view installed by TestRenderViewHost; we need
241 // our special subclass which has mocked-out tab capture support. 240 // our special subclass which has mocked-out tab capture support.
242 RenderWidgetHostView* old_view = GetView(); 241 RenderWidgetHostView* old_view = GetView();
243 SetView(new CaptureTestView(this, controller)); 242 SetView(new CaptureTestView(this, controller));
244 delete old_view; 243 delete old_view;
245 } 244 }
246 245
247 // TestRenderViewHost overrides. 246 // TestRenderViewHost overrides.
248 virtual void CopyFromBackingStore( 247 virtual void CopyFromBackingStore(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 282 }
284 283
285 virtual ~CaptureTestRenderViewHostFactory() { 284 virtual ~CaptureTestRenderViewHostFactory() {
286 UnregisterFactory(); 285 UnregisterFactory();
287 } 286 }
288 287
289 // RenderViewHostFactory implementation. 288 // RenderViewHostFactory implementation.
290 virtual RenderViewHost* CreateRenderViewHost( 289 virtual RenderViewHost* CreateRenderViewHost(
291 SiteInstance* instance, 290 SiteInstance* instance,
292 RenderViewHostDelegate* delegate, 291 RenderViewHostDelegate* delegate,
293 RenderFrameHostDelegate* frame_delegate,
294 RenderWidgetHostDelegate* widget_delegate, 292 RenderWidgetHostDelegate* widget_delegate,
295 int routing_id, 293 int routing_id,
296 int main_frame_routing_id, 294 int main_frame_routing_id,
297 bool swapped_out) OVERRIDE { 295 bool swapped_out) OVERRIDE {
298 return new CaptureTestRenderViewHost(instance, delegate, frame_delegate, 296 return new CaptureTestRenderViewHost(instance, delegate, widget_delegate,
299 widget_delegate, routing_id, 297 routing_id, main_frame_routing_id,
300 main_frame_routing_id, swapped_out, 298 swapped_out, controller_);
301 controller_);
302 } 299 }
303 private: 300 private:
304 CaptureTestSourceController* controller_; 301 CaptureTestSourceController* controller_;
305 302
306 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHostFactory); 303 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHostFactory);
307 }; 304 };
308 305
309 // A stub consumer of captured video frames, which checks the output of 306 // A stub consumer of captured video frames, which checks the output of
310 // WebContentsVideoCaptureDevice. 307 // WebContentsVideoCaptureDevice.
311 class StubClient : public media::VideoCaptureDevice::Client { 308 class StubClient : public media::VideoCaptureDevice::Client {
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 source()->SetSolidColor(SK_ColorGREEN); 806 source()->SetSolidColor(SK_ColorGREEN);
810 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); 807 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN));
811 source()->SetSolidColor(SK_ColorRED); 808 source()->SetSolidColor(SK_ColorRED);
812 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); 809 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED));
813 810
814 device()->StopAndDeAllocate(); 811 device()->StopAndDeAllocate();
815 } 812 }
816 813
817 } // namespace 814 } // namespace
818 } // namespace content 815 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698