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 "ash/wm/video_detector.h" | 5 #include "ash/wm/video_detector.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
10 #include "ash/wm/wm_event.h" | 10 #include "ash/wm/wm_event.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 gfx::Size(VideoDetector::kMinUpdateWidth, | 259 gfx::Size(VideoDetector::kMinUpdateWidth, |
260 VideoDetector::kMinUpdateHeight)); | 260 VideoDetector::kMinUpdateHeight)); |
261 for (int i = 0; i < VideoDetector::kMinFramesPerSecond; ++i) | 261 for (int i = 0; i < VideoDetector::kMinFramesPerSecond; ++i) |
262 detector_->OnDelegatedFrameDamage(window.get(), update_region); | 262 detector_->OnDelegatedFrameDamage(window.get(), update_region); |
263 EXPECT_EQ(1, observer_->num_invocations()); | 263 EXPECT_EQ(1, observer_->num_invocations()); |
264 EXPECT_EQ(0, observer_->num_fullscreens()); | 264 EXPECT_EQ(0, observer_->num_fullscreens()); |
265 EXPECT_EQ(1, observer_->num_not_fullscreens()); | 265 EXPECT_EQ(1, observer_->num_not_fullscreens()); |
266 // Let enough time pass that a second notification should be sent. | 266 // Let enough time pass that a second notification should be sent. |
267 observer_->reset_stats(); | 267 observer_->reset_stats(); |
268 AdvanceTime(base::TimeDelta::FromSeconds( | 268 AdvanceTime(base::TimeDelta::FromSeconds( |
269 static_cast<int64>(VideoDetector::kNotifyIntervalSec + 1))); | 269 static_cast<int64_t>(VideoDetector::kNotifyIntervalSec + 1))); |
270 for (int i = 0; i < VideoDetector::kMinFramesPerSecond; ++i) | 270 for (int i = 0; i < VideoDetector::kMinFramesPerSecond; ++i) |
271 detector_->OnDelegatedFrameDamage(window.get(), update_region); | 271 detector_->OnDelegatedFrameDamage(window.get(), update_region); |
272 EXPECT_EQ(1, observer_->num_invocations()); | 272 EXPECT_EQ(1, observer_->num_invocations()); |
273 EXPECT_EQ(0, observer_->num_fullscreens()); | 273 EXPECT_EQ(0, observer_->num_fullscreens()); |
274 EXPECT_EQ(1, observer_->num_not_fullscreens()); | 274 EXPECT_EQ(1, observer_->num_not_fullscreens()); |
275 } | 275 } |
276 | 276 |
277 // Test that the observer receives a true value when the window is fullscreen. | 277 // Test that the observer receives a true value when the window is fullscreen. |
278 TEST_F(VideoDetectorTest, FullscreenWindow) { | 278 TEST_F(VideoDetectorTest, FullscreenWindow) { |
279 if (!SupportsMultipleDisplays()) | 279 if (!SupportsMultipleDisplays()) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 AdvanceTime(base::TimeDelta::FromSeconds(2)); | 330 AdvanceTime(base::TimeDelta::FromSeconds(2)); |
331 for (int i = 0; i < VideoDetector::kMinFramesPerSecond; ++i) | 331 for (int i = 0; i < VideoDetector::kMinFramesPerSecond; ++i) |
332 detector_->OnDelegatedFrameDamage(window.get(), kUpdateRegion); | 332 detector_->OnDelegatedFrameDamage(window.get(), kUpdateRegion); |
333 EXPECT_EQ(1, observer_->num_invocations()); | 333 EXPECT_EQ(1, observer_->num_invocations()); |
334 EXPECT_EQ(0, observer_->num_fullscreens()); | 334 EXPECT_EQ(0, observer_->num_fullscreens()); |
335 EXPECT_EQ(1, observer_->num_not_fullscreens()); | 335 EXPECT_EQ(1, observer_->num_not_fullscreens()); |
336 } | 336 } |
337 | 337 |
338 } // namespace test | 338 } // namespace test |
339 } // namespace ash | 339 } // namespace ash |
OLD | NEW |