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

Side by Side Diff: ui/views/view_unittest.cc

Issue 271533014: Make ui::Layer use the cc:LayerTreeHost scale factor directly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove texture scaling fix Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « ui/compositor/layer_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <map> 5 #include <map>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after
3356 scoped_ptr<ui::Layer> layer(c1->AcquireLayer()); 3356 scoped_ptr<ui::Layer> layer(c1->AcquireLayer());
3357 EXPECT_EQ(layer.get(), c1->layer()); 3357 EXPECT_EQ(layer.get(), c1->layer());
3358 3358
3359 scoped_ptr<ui::Layer> layer2(c1->RecreateLayer()); 3359 scoped_ptr<ui::Layer> layer2(c1->RecreateLayer());
3360 EXPECT_NE(c1->layer(), layer2.get()); 3360 EXPECT_NE(c1->layer(), layer2.get());
3361 3361
3362 // Destroy view before destroying layer. 3362 // Destroy view before destroying layer.
3363 c1.reset(); 3363 c1.reset();
3364 } 3364 }
3365 3365
3366 // Verify that new layer scales content only if the old layer does.
3367 TEST_F(ViewLayerTest, RecreateLayerScaling) {
3368 scoped_ptr<View> v(new View());
3369 v->SetPaintToLayer(true);
3370 // Set to non default value.
3371 v->layer()->set_scale_content(false);
3372 scoped_ptr<ui::Layer> old_layer(v->RecreateLayer());
3373 ui::Layer* new_layer = v->layer();
3374 EXPECT_FALSE(new_layer->scale_content());
3375 }
3376
3377 // Verify the z-order of the layers as a result of calling RecreateLayer(). 3366 // Verify the z-order of the layers as a result of calling RecreateLayer().
3378 TEST_F(ViewLayerTest, RecreateLayerZOrder) { 3367 TEST_F(ViewLayerTest, RecreateLayerZOrder) {
3379 scoped_ptr<View> v(new View()); 3368 scoped_ptr<View> v(new View());
3380 v->SetPaintToLayer(true); 3369 v->SetPaintToLayer(true);
3381 3370
3382 View* v1 = new View(); 3371 View* v1 = new View();
3383 v1->SetPaintToLayer(true); 3372 v1->SetPaintToLayer(true);
3384 v->AddChildView(v1); 3373 v->AddChildView(v1);
3385 View* v2 = new View(); 3374 View* v2 = new View();
3386 v2->SetPaintToLayer(true); 3375 v2->SetPaintToLayer(true);
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
3898 // notification. 3887 // notification.
3899 TestView* test_view_child_2 = new TestView(); 3888 TestView* test_view_child_2 = new TestView();
3900 test_view->AddChildView(test_view_child_2); 3889 test_view->AddChildView(test_view_child_2);
3901 EXPECT_TRUE(test_view_child_2->native_theme_); 3890 EXPECT_TRUE(test_view_child_2->native_theme_);
3902 EXPECT_EQ(widget->GetNativeTheme(), test_view_child_2->native_theme_); 3891 EXPECT_EQ(widget->GetNativeTheme(), test_view_child_2->native_theme_);
3903 3892
3904 widget->CloseNow(); 3893 widget->CloseNow();
3905 } 3894 }
3906 3895
3907 } // namespace views 3896 } // namespace views
OLDNEW
« no previous file with comments | « ui/compositor/layer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698