OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/cursor_renderer_mac.h" | 5 #include "content/browser/media/capture/cursor_renderer_mac.h" |
6 | 6 |
7 #include <Cocoa/Cocoa.h> | 7 #include <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/test/simple_test_tick_clock.h" | 11 #include "base/test/simple_test_tick_clock.h" |
12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "ui/gfx/mac/coordinate_conversion.h" | 14 #include "ui/gfx/mac/coordinate_conversion.h" |
15 #include "ui/gfx/test/ui_cocoa_test_helper.h" | 15 #include "ui/gfx/test/ui_cocoa_test_helper.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 const int kTestViewWidth = 800; | 19 const int kTestViewWidth = 800; |
20 const int kTestViewHeight = 600; | 20 const int kTestViewHeight = 600; |
21 | 21 |
22 class CursorRendererMacTest : public ui::CocoaTest { | 22 class CursorRendererMacTest : public ui::CocoaTest { |
23 public: | 23 public: |
24 CursorRendererMacTest() {} | 24 CursorRendererMacTest() {} |
25 ~CursorRendererMacTest() override{}; | 25 ~CursorRendererMacTest() override {} |
26 | 26 |
27 void SetUp() override { | 27 void SetUp() override { |
28 ui::CocoaTest::SetUp(); | 28 ui::CocoaTest::SetUp(); |
29 base::scoped_nsobject<NSView> view([[NSView alloc] | 29 base::scoped_nsobject<NSView> view([[NSView alloc] |
30 initWithFrame:NSMakeRect(0, 0, kTestViewWidth, kTestViewHeight)]); | 30 initWithFrame:NSMakeRect(0, 0, kTestViewWidth, kTestViewHeight)]); |
31 view_ = view.get(); | 31 view_ = view.get(); |
32 [[test_window() contentView] addSubview:view_]; | 32 [[test_window() contentView] addSubview:view_]; |
33 | 33 |
34 cursor_renderer_.reset(new CursorRendererMac(view_)); | 34 cursor_renderer_.reset(new CursorRendererMac(view_)); |
35 } | 35 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 MoveMouseCursorWithinWindow(gfx::Point(60, 60)); | 174 MoveMouseCursorWithinWindow(gfx::Point(60, 60)); |
175 SnapshotCursorState(gfx::Rect(size)); | 175 SnapshotCursorState(gfx::Rect(size)); |
176 EXPECT_TRUE(CursorDisplayed()); | 176 EXPECT_TRUE(CursorDisplayed()); |
177 | 177 |
178 EXPECT_FALSE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); | 178 EXPECT_FALSE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); |
179 RenderCursorOnVideoFrame(frame.get()); | 179 RenderCursorOnVideoFrame(frame.get()); |
180 EXPECT_TRUE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); | 180 EXPECT_TRUE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); |
181 } | 181 } |
182 | 182 |
183 } // namespace content | 183 } // namespace content |
OLD | NEW |