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

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

Issue 2688413007: Add display::GetDisplayNearestView (Closed)
Patch Set: add missing files Created 3 years, 10 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/browser/media/capture/web_contents_video_capture_device.h" 5 #include "content/browser/media/capture/web_contents_video_capture_device.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 return static_cast<CaptureTestView*>( 511 return static_cast<CaptureTestView*>(
512 web_contents_->GetRenderViewHost()->GetWidget()->GetView()); 512 web_contents_->GetRenderViewHost()->GetWidget()->GetView());
513 } 513 }
514 media::VideoCaptureDevice* device() { return device_.get(); } 514 media::VideoCaptureDevice* device() { return device_.get(); }
515 515
516 // Returns the device scale factor of the capture target's native view. 516 // Returns the device scale factor of the capture target's native view.
517 float GetDeviceScaleFactor() const { 517 float GetDeviceScaleFactor() const {
518 RenderWidgetHostView* const view = 518 RenderWidgetHostView* const view =
519 web_contents_->GetRenderViewHost()->GetWidget()->GetView(); 519 web_contents_->GetRenderViewHost()->GetWidget()->GetView();
520 CHECK(view); 520 CHECK(view);
521 return ui::GetScaleFactorForNativeView(view->GetNativeView()); 521 return view->GetScaleFactorForNativeView();
522 } 522 }
523 523
524 void SimulateDrawEvent() { 524 void SimulateDrawEvent() {
525 DCHECK_CURRENTLY_ON(BrowserThread::UI); 525 DCHECK_CURRENTLY_ON(BrowserThread::UI);
526 526
527 // Force at least one frame period's worth of time to pass. Otherwise, 527 // Force at least one frame period's worth of time to pass. Otherwise,
528 // internal logic may decide not to capture a frame because the draw events 528 // internal logic may decide not to capture a frame because the draw events
529 // are more frequent that kTestFramesPerSecond. 529 // are more frequent that kTestFramesPerSecond.
530 // 530 //
531 // TODO(miu): Instead of physically waiting, we should inject simulated 531 // TODO(miu): Instead of physically waiting, we should inject simulated
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 for (int i = 0; i < 3; ++i) { 1009 for (int i = 0; i < 3; ++i) {
1010 SimulateRefreshFrameRequest(); 1010 SimulateRefreshFrameRequest();
1011 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); 1011 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN));
1012 } 1012 }
1013 1013
1014 device()->StopAndDeAllocate(); 1014 device()->StopAndDeAllocate();
1015 } 1015 }
1016 1016
1017 } // namespace 1017 } // namespace
1018 } // namespace content 1018 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698