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

Unified Diff: ash/wm/video_detector_unittest.cc

Issue 10928037: Revert 155224 - Add is_fullscreen to video updates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/video_detector.cc ('k') | chrome/browser/chromeos/power/video_activity_notifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/video_detector_unittest.cc
===================================================================
--- ash/wm/video_detector_unittest.cc (revision 155231)
+++ ash/wm/video_detector_unittest.cc (working copy)
@@ -11,7 +11,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
#include "third_party/skia/include/core/SkColor.h"
-#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/window_types.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/test_windows.h"
@@ -25,37 +24,17 @@
// video is playing.
class TestVideoDetectorObserver : public VideoDetectorObserver {
public:
- TestVideoDetectorObserver() : num_invocations_(0),
- num_fullscreens_(0),
- num_not_fullscreens_(0) {}
+ TestVideoDetectorObserver() : num_invocations_(0) {}
int num_invocations() const { return num_invocations_; }
- int num_fullscreens() const { return num_fullscreens_; }
- int num_not_fullscreens() const { return num_not_fullscreens_; }
- void reset_stats() {
- num_invocations_ = 0;
- num_fullscreens_ = 0;
- num_not_fullscreens_ = 0;
- }
+ void reset_stats() { num_invocations_ = 0; }
// VideoDetectorObserver implementation.
- virtual void OnVideoDetected(bool is_fullscreen) OVERRIDE {
- num_invocations_++;
- if (is_fullscreen)
- num_fullscreens_++;
- else
- num_not_fullscreens_++;
- }
+ virtual void OnVideoDetected() OVERRIDE { num_invocations_++; }
private:
// Number of times that OnVideoDetected() has been called.
int num_invocations_;
- // Number of times that OnVideoDetected() has been called with is_fullscreen
- // == true.
- int num_fullscreens_;
- // Number of times that OnVideoDetected() has been called with is_fullscreen
- // == false.
- int num_not_fullscreens_;
DISALLOW_COPY_AND_ASSIGN(TestVideoDetectorObserver);
};
@@ -125,12 +104,8 @@
// additional updates.
detector_->OnWindowPaintScheduled(window.get(), update_region);
EXPECT_EQ(1, observer_->num_invocations());
- EXPECT_EQ(0, observer_->num_fullscreens());
- EXPECT_EQ(1, observer_->num_not_fullscreens());
detector_->OnWindowPaintScheduled(window.get(), update_region);
EXPECT_EQ(1, observer_->num_invocations());
- EXPECT_EQ(0, observer_->num_fullscreens());
- EXPECT_EQ(1, observer_->num_not_fullscreens());
// Spread out the frames over two seconds; we shouldn't detect video.
observer_->reset_stats();
@@ -169,8 +144,6 @@
for (int i = 0; i < VideoDetector::kMinFramesPerSecond; ++i)
detector_->OnWindowPaintScheduled(window.get(), update_region);
EXPECT_EQ(1, observer_->num_invocations());
- EXPECT_EQ(0, observer_->num_fullscreens());
- EXPECT_EQ(1, observer_->num_not_fullscreens());
// We also shouldn't report video in a window that's fully offscreen.
observer_->reset_stats();
@@ -204,8 +177,6 @@
for (int i = 0; i < VideoDetector::kMinFramesPerSecond; ++i)
detector_->OnWindowPaintScheduled(window2.get(), update_region);
EXPECT_EQ(1, observer_->num_invocations());
- EXPECT_EQ(0, observer_->num_fullscreens());
- EXPECT_EQ(1, observer_->num_not_fullscreens());
}
// Test that the observer receives repeated notifications.
@@ -221,8 +192,7 @@
for (int i = 0; i < VideoDetector::kMinFramesPerSecond; ++i)
detector_->OnWindowPaintScheduled(window.get(), update_region);
EXPECT_EQ(1, observer_->num_invocations());
- EXPECT_EQ(0, observer_->num_fullscreens());
- EXPECT_EQ(1, observer_->num_not_fullscreens());
+
// Let enough time pass that a second notification should be sent.
observer_->reset_stats();
AdvanceTime(base::TimeDelta::FromSeconds(
@@ -230,27 +200,7 @@
for (int i = 0; i < VideoDetector::kMinFramesPerSecond; ++i)
detector_->OnWindowPaintScheduled(window.get(), update_region);
EXPECT_EQ(1, observer_->num_invocations());
- EXPECT_EQ(0, observer_->num_fullscreens());
- EXPECT_EQ(1, observer_->num_not_fullscreens());
}
-// Test that the observer receives a true value when the window is fullscreen.
-TEST_F(VideoDetectorTest, FullscreenWindow) {
- gfx::Rect window_bounds(gfx::Point(), gfx::Size(1024, 768));
- scoped_ptr<aura::Window> window(
- aura::test::CreateTestWindow(SK_ColorRED, 12345, window_bounds, NULL));
- window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
-
- gfx::Rect update_region(
- gfx::Point(),
- gfx::Size(VideoDetector::kMinUpdateWidth,
- VideoDetector::kMinUpdateHeight));
- for (int i = 0; i < VideoDetector::kMinFramesPerSecond; ++i)
- detector_->OnWindowPaintScheduled(window.get(), update_region);
- EXPECT_EQ(1, observer_->num_invocations());
- EXPECT_EQ(1, observer_->num_fullscreens());
- EXPECT_EQ(0, observer_->num_not_fullscreens());
-}
-
} // namespace test
} // namespace ash
« no previous file with comments | « ash/wm/video_detector.cc ('k') | chrome/browser/chromeos/power/video_activity_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698