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

Unified Diff: content/browser/compositor/reflector_impl_unittest.cc

Issue 899073003: Make Reflector Use Main Thread MessageLoop when in SingleThread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@turnitoff
Patch Set: Created 5 years, 10 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 | « content/browser/compositor/reflector_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/reflector_impl_unittest.cc
diff --git a/content/browser/compositor/reflector_impl_unittest.cc b/content/browser/compositor/reflector_impl_unittest.cc
index 7483ae6f1443e69b407fa46946834028415693cd..2ae28a6b79bd14f0f913dab18c6f0fb7d263a832 100644
--- a/content/browser/compositor/reflector_impl_unittest.cc
+++ b/content/browser/compositor/reflector_impl_unittest.cc
@@ -94,10 +94,18 @@ class ReflectorImplTest : public testing::Test {
mirroring_layer_.reset(new ui::Layer());
gfx::Size size = output_surface_->SurfaceSize();
mirroring_layer_->SetBounds(gfx::Rect(size.width(), size.height()));
+ }
+ void SetUpReflector(bool threaded) {
int32 surface_id = 1;
- reflector_ = new ReflectorImpl(compositor_.get(), mirroring_layer_.get(),
- &surface_map_, proxy_.get(), surface_id);
+
+ if (threaded) {
+ reflector_ = new ReflectorImpl(compositor_.get(), mirroring_layer_.get(),
+ &surface_map_, proxy_.get(), surface_id);
+ } else {
+ reflector_ = new ReflectorImpl(compositor_.get(), mirroring_layer_.get(),
+ &surface_map_, NULL, surface_id);
+ }
}
void TearDown() override {
@@ -133,6 +141,8 @@ class ReflectorImplTest : public testing::Test {
namespace {
TEST_F(ReflectorImplTest, CheckNormalOutputSurface) {
+ bool threaded = true;
+ SetUpReflector(threaded);
output_surface_->SetFlip(false);
Init();
UpdateTexture();
@@ -144,6 +154,31 @@ TEST_F(ReflectorImplTest, CheckNormalOutputSurface) {
}
TEST_F(ReflectorImplTest, CheckInvertedOutputSurface) {
+ bool threaded = true;
+ SetUpReflector(threaded);
+ output_surface_->SetFlip(true);
+ Init();
+ UpdateTexture();
+ EXPECT_FALSE(mirroring_layer_->TextureFlipped());
+ EXPECT_EQ(SkRegion(kSkSubRect), mirroring_layer_->damaged_region());
+}
+
+TEST_F(ReflectorImplTest, CheckNormalOutputSurface_SingleThread) {
+ bool threaded = false;
+ SetUpReflector(threaded);
+ output_surface_->SetFlip(false);
+ Init();
+ UpdateTexture();
+ EXPECT_TRUE(mirroring_layer_->TextureFlipped());
+ EXPECT_EQ(SkRegion(SkIRect::MakeXYWH(
+ 0, output_surface_->SurfaceSize().height() - kSubRect.height(),
+ kSubRect.width(), kSubRect.height())),
+ mirroring_layer_->damaged_region());
+}
+
+TEST_F(ReflectorImplTest, CheckInvertedOutputSurface_SingleThread) {
+ bool threaded = false;
+ SetUpReflector(threaded);
output_surface_->SetFlip(true);
Init();
UpdateTexture();
« no previous file with comments | « content/browser/compositor/reflector_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698