| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_aura.h" | 5 #include "content/browser/media/capture/cursor_renderer_aura.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 scoped_ptr<aura::Window> window_; | 128 scoped_ptr<aura::Window> window_; |
| 129 scoped_ptr<CursorRendererAura> cursor_renderer_; | 129 scoped_ptr<CursorRendererAura> cursor_renderer_; |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 TEST_F(CursorRendererAuraTest, CursorDuringMouseMovement) { | 132 TEST_F(CursorRendererAuraTest, CursorDuringMouseMovement) { |
| 133 // Keep window activated. | 133 // Keep window activated. |
| 134 wm::ActivateWindow(window_.get()); | 134 wm::ActivateWindow(window_.get()); |
| 135 | 135 |
| 136 EXPECT_FALSE(CursorDisplayed()); | 136 EXPECT_FALSE(CursorDisplayed()); |
| 137 | 137 |
| 138 base::SimpleTestTickClock clock; | 138 base::SimpleTestTickClock clock((base::TimeTicks())); |
| 139 SetTickClock(&clock); | 139 SetTickClock(&clock); |
| 140 | 140 |
| 141 // Cursor displayed after mouse movement. | 141 // Cursor displayed after mouse movement. |
| 142 MoveMouseCursorWithinWindow(); | 142 MoveMouseCursorWithinWindow(); |
| 143 EXPECT_TRUE(CursorDisplayed()); | 143 EXPECT_TRUE(CursorDisplayed()); |
| 144 | 144 |
| 145 // Cursor not be displayed after idle period. | 145 // Cursor not be displayed after idle period. |
| 146 clock.Advance(base::TimeDelta::FromSeconds(5)); | 146 clock.Advance(base::TimeDelta::FromSeconds(5)); |
| 147 SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); | 147 SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); |
| 148 EXPECT_FALSE(CursorDisplayed()); | 148 EXPECT_FALSE(CursorDisplayed()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 MoveMouseCursorWithinWindow(gfx::Point(60, 60)); | 194 MoveMouseCursorWithinWindow(gfx::Point(60, 60)); |
| 195 SnapshotCursorState(gfx::Rect(size)); | 195 SnapshotCursorState(gfx::Rect(size)); |
| 196 EXPECT_TRUE(CursorDisplayed()); | 196 EXPECT_TRUE(CursorDisplayed()); |
| 197 | 197 |
| 198 EXPECT_FALSE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); | 198 EXPECT_FALSE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); |
| 199 RenderCursorOnVideoFrame(frame); | 199 RenderCursorOnVideoFrame(frame); |
| 200 EXPECT_TRUE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); | 200 EXPECT_TRUE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace content | 203 } // namespace content |
| OLD | NEW |