OLD | NEW |
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 "media/video/capture/screen/screen_capturer.h" | 5 #include "media/video/capture/screen/screen_capturer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #if defined(OS_MACOSX) | 8 #if defined(OS_MACOSX) |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #endif // defined(OS_MACOSX) | 10 #endif // defined(OS_MACOSX) |
(...skipping 30 matching lines...) Expand all Loading... |
41 uint32 size) { | 41 uint32 size) { |
42 return scoped_refptr<SharedBuffer>(new SharedBuffer(size)); | 42 return scoped_refptr<SharedBuffer>(new SharedBuffer(size)); |
43 } | 43 } |
44 | 44 |
45 TEST_F(ScreenCapturerTest, StartCapturer) { | 45 TEST_F(ScreenCapturerTest, StartCapturer) { |
46 capturer_ = ScreenCapturer::Create(); | 46 capturer_ = ScreenCapturer::Create(); |
47 capturer_->Start(&delegate_); | 47 capturer_->Start(&delegate_); |
48 capturer_->Stop(); | 48 capturer_->Stop(); |
49 } | 49 } |
50 | 50 |
51 #if defined(THREAD_SANITIZER) | 51 TEST_F(ScreenCapturerTest, Capture) { |
52 // ThreadSanitizer v2 reports a use-after-free, see http://crbug.com/163641. | |
53 #define MAYBE_Capture DISABLED_Capture | |
54 #else | |
55 #define MAYBE_Capture Capture | |
56 #endif | |
57 TEST_F(ScreenCapturerTest, MAYBE_Capture) { | |
58 // Assume that Start() treats the screen as invalid initially. | 52 // Assume that Start() treats the screen as invalid initially. |
59 EXPECT_CALL(delegate_, | 53 EXPECT_CALL(delegate_, |
60 OnCaptureCompleted(DirtyRegionIsNonEmptyRect())); | 54 OnCaptureCompleted(DirtyRegionIsNonEmptyRect())); |
61 EXPECT_CALL(delegate_, OnCursorShapeChangedPtr(_)) | 55 EXPECT_CALL(delegate_, OnCursorShapeChangedPtr(_)) |
62 .Times(AnyNumber()); | 56 .Times(AnyNumber()); |
63 | 57 |
64 EXPECT_CALL(delegate_, CreateSharedBuffer(_)) | 58 EXPECT_CALL(delegate_, CreateSharedBuffer(_)) |
65 .Times(AnyNumber()) | 59 .Times(AnyNumber()) |
66 .WillRepeatedly(Return(scoped_refptr<SharedBuffer>())); | 60 .WillRepeatedly(Return(scoped_refptr<SharedBuffer>())); |
67 | 61 |
(...skipping 20 matching lines...) Expand all Loading... |
88 capturer_ = ScreenCapturer::Create(); | 82 capturer_ = ScreenCapturer::Create(); |
89 capturer_->Start(&delegate_); | 83 capturer_->Start(&delegate_); |
90 capturer_->CaptureFrame(); | 84 capturer_->CaptureFrame(); |
91 capturer_->Stop(); | 85 capturer_->Stop(); |
92 capturer_.reset(); | 86 capturer_.reset(); |
93 } | 87 } |
94 | 88 |
95 #endif // defined(OS_WIN) | 89 #endif // defined(OS_WIN) |
96 | 90 |
97 } // namespace media | 91 } // namespace media |
OLD | NEW |