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

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

Issue 1558633002: Cleanup: Remove double semicolons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert CP code to a while loop, fix nit Created 4 years, 11 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/media/capture/desktop_capture_device.h" 5 #include "content/browser/media/capture/desktop_capture_device.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 #include <algorithm> 10 #include <algorithm>
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 DoOnIncomingCapturedVideoFrame(); 105 DoOnIncomingCapturedVideoFrame();
106 } 106 }
107 107
108 double GetBufferPoolUtilization() const override { return 0.0; } 108 double GetBufferPoolUtilization() const override { return 0.0; }
109 }; 109 };
110 110
111 // Creates a DesktopFrame that has the first pixel bytes set to 111 // Creates a DesktopFrame that has the first pixel bytes set to
112 // kFakePixelValueFirst, and the rest of the bytes set to kFakePixelValue, for 112 // kFakePixelValueFirst, and the rest of the bytes set to kFakePixelValue, for
113 // UnpackedFrame and InvertedFrame verification. 113 // UnpackedFrame and InvertedFrame verification.
114 webrtc::BasicDesktopFrame* CreateBasicFrame(const webrtc::DesktopSize& size) { 114 webrtc::BasicDesktopFrame* CreateBasicFrame(const webrtc::DesktopSize& size) {
115 webrtc::BasicDesktopFrame* frame = new webrtc::BasicDesktopFrame(size);; 115 webrtc::BasicDesktopFrame* frame = new webrtc::BasicDesktopFrame(size);
116 DCHECK_EQ(frame->size().width() * webrtc::DesktopFrame::kBytesPerPixel, 116 DCHECK_EQ(frame->size().width() * webrtc::DesktopFrame::kBytesPerPixel,
117 frame->stride()); 117 frame->stride());
118 memset(frame->data(), 118 memset(frame->data(),
119 kFakePixelValue, 119 kFakePixelValue,
120 frame->stride() * frame->size().height()); 120 frame->stride() * frame->size().height());
121 memset(frame->data(), 121 memset(frame->data(),
122 kFakePixelValueFirst, 122 kFakePixelValueFirst,
123 webrtc::DesktopFrame::kBytesPerPixel); 123 webrtc::DesktopFrame::kBytesPerPixel);
124 return frame; 124 return frame;
125 } 125 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 memset(data(), kFramePaddingValue, stride() * size().height()); 161 memset(data(), kFramePaddingValue, stride() * size().height());
162 CopyPixelsFrom(*frame, 162 CopyPixelsFrom(*frame,
163 webrtc::DesktopVector(), 163 webrtc::DesktopVector(),
164 webrtc::DesktopRect::MakeSize(size())); 164 webrtc::DesktopRect::MakeSize(size()));
165 delete frame; 165 delete frame;
166 } 166 }
167 ~UnpackedDesktopFrame() override { 167 ~UnpackedDesktopFrame() override {
168 delete[] data_; 168 delete[] data_;
169 } 169 }
170 170
171 private:
171 DISALLOW_COPY_AND_ASSIGN(UnpackedDesktopFrame); 172 DISALLOW_COPY_AND_ASSIGN(UnpackedDesktopFrame);
172 }; 173 };
173 174
174 // TODO(sergeyu): Move this to a separate file where it can be reused. 175 // TODO(sergeyu): Move this to a separate file where it can be reused.
175 class FakeScreenCapturer : public webrtc::ScreenCapturer { 176 class FakeScreenCapturer : public webrtc::ScreenCapturer {
176 public: 177 public:
177 FakeScreenCapturer() 178 FakeScreenCapturer()
178 : callback_(NULL), 179 : callback_(NULL),
179 frame_index_(0), 180 frame_index_(0),
180 generate_inverted_frames_(false), 181 generate_inverted_frames_(false),
(...skipping 14 matching lines...) Expand all
195 196
196 void Capture(const webrtc::DesktopRegion& region) override { 197 void Capture(const webrtc::DesktopRegion& region) override {
197 webrtc::DesktopSize size; 198 webrtc::DesktopSize size;
198 if (frame_index_ % 2 == 0) { 199 if (frame_index_ % 2 == 0) {
199 size = webrtc::DesktopSize(kTestFrameWidth1, kTestFrameHeight1); 200 size = webrtc::DesktopSize(kTestFrameWidth1, kTestFrameHeight1);
200 } else { 201 } else {
201 size = webrtc::DesktopSize(kTestFrameWidth2, kTestFrameHeight2); 202 size = webrtc::DesktopSize(kTestFrameWidth2, kTestFrameHeight2);
202 } 203 }
203 frame_index_++; 204 frame_index_++;
204 205
205 webrtc::DesktopFrame* frame = CreateBasicFrame(size);; 206 webrtc::DesktopFrame* frame = CreateBasicFrame(size);
206 207
207 if (generate_inverted_frames_) { 208 if (generate_inverted_frames_) {
208 frame = new InvertedDesktopFrame(frame); 209 frame = new InvertedDesktopFrame(frame);
209 } else if (generate_cropped_frames_) { 210 } else if (generate_cropped_frames_) {
210 frame = new UnpackedDesktopFrame(frame); 211 frame = new UnpackedDesktopFrame(frame);
211 } 212 }
212 callback_->OnCaptureCompleted(frame); 213 callback_->OnCaptureCompleted(frame);
213 } 214 }
214 215
215 bool GetScreenList(ScreenList* screens) override { return false; } 216 bool GetScreenList(ScreenList* screens) override { return false; }
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 frame_size); 524 frame_size);
524 for (int i = 0; i < output_frame_->size().height(); ++i) { 525 for (int i = 0; i < output_frame_->size().height(); ++i) {
525 EXPECT_EQ(0, 526 EXPECT_EQ(0,
526 memcmp(inverted_frame->data() + i * inverted_frame->stride(), 527 memcmp(inverted_frame->data() + i * inverted_frame->stride(),
527 output_frame_->data() + i * output_frame_->stride(), 528 output_frame_->data() + i * output_frame_->stride(),
528 output_frame_->stride())); 529 output_frame_->stride()));
529 } 530 }
530 } 531 }
531 532
532 } // namespace content 533 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698