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

Side by Side Diff: ui/views/widget/native_widget_aura_unittest.cc

Issue 9289036: aura: Add Layer::LAYER_SOLID_COLOR to compositor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update WorkspaceManagerTest Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/native_widget_aura.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 "ui/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 30 matching lines...) Expand all
41 41
42 private: 42 private:
43 MessageLoopForUI message_loop_; 43 MessageLoopForUI message_loop_;
44 44
45 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAuraTest); 45 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAuraTest);
46 }; 46 };
47 47
48 TEST_F(NativeWidgetAuraTest, CenterWindowLargeParent) { 48 TEST_F(NativeWidgetAuraTest, CenterWindowLargeParent) {
49 // Make a parent window larger than the host represented by rootwindow. 49 // Make a parent window larger than the host represented by rootwindow.
50 scoped_ptr<aura::Window> parent(new aura::Window(NULL)); 50 scoped_ptr<aura::Window> parent(new aura::Window(NULL));
51 parent->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); 51 parent->Init(ui::Layer::LAYER_NOT_DRAWN);
52 parent->SetBounds(gfx::Rect(0, 0, 1024, 800)); 52 parent->SetBounds(gfx::Rect(0, 0, 1024, 800));
53 scoped_ptr<Widget> widget(new Widget()); 53 scoped_ptr<Widget> widget(new Widget());
54 NativeWidgetAura* window = Init(parent.get(), widget.get()); 54 NativeWidgetAura* window = Init(parent.get(), widget.get());
55 55
56 window->CenterWindow(gfx::Size(100, 100)); 56 window->CenterWindow(gfx::Size(100, 100));
57 EXPECT_EQ(gfx::Rect( (640 - 100) / 2, 57 EXPECT_EQ(gfx::Rect( (640 - 100) / 2,
58 (480 - 100) / 2, 58 (480 - 100) / 2,
59 100, 100), 59 100, 100),
60 window->GetNativeWindow()->bounds()); 60 window->GetNativeWindow()->bounds());
61 widget->CloseNow(); 61 widget->CloseNow();
62 } 62 }
63 63
64 TEST_F(NativeWidgetAuraTest, CenterWindowSmallParent) { 64 TEST_F(NativeWidgetAuraTest, CenterWindowSmallParent) {
65 // Make a parent window smaller than the host represented by rootwindow. 65 // Make a parent window smaller than the host represented by rootwindow.
66 scoped_ptr<aura::Window> parent(new aura::Window(NULL)); 66 scoped_ptr<aura::Window> parent(new aura::Window(NULL));
67 parent->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); 67 parent->Init(ui::Layer::LAYER_NOT_DRAWN);
68 parent->SetBounds(gfx::Rect(0, 0, 480, 320)); 68 parent->SetBounds(gfx::Rect(0, 0, 480, 320));
69 scoped_ptr<Widget> widget(new Widget()); 69 scoped_ptr<Widget> widget(new Widget());
70 NativeWidgetAura* window = Init(parent.get(), widget.get()); 70 NativeWidgetAura* window = Init(parent.get(), widget.get());
71 71
72 window->CenterWindow(gfx::Size(100, 100)); 72 window->CenterWindow(gfx::Size(100, 100));
73 EXPECT_EQ(gfx::Rect( (480 - 100) / 2, 73 EXPECT_EQ(gfx::Rect( (480 - 100) / 2,
74 (320 - 100) / 2, 74 (320 - 100) / 2,
75 100, 100), 75 100, 100),
76 window->GetNativeWindow()->bounds()); 76 window->GetNativeWindow()->bounds());
77 widget->CloseNow(); 77 widget->CloseNow();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // For Aura, client area bounds match window bounds. 159 // For Aura, client area bounds match window bounds.
160 gfx::Rect client_bounds = widget->GetClientAreaScreenBounds(); 160 gfx::Rect client_bounds = widget->GetClientAreaScreenBounds();
161 EXPECT_EQ(10, client_bounds.x()); 161 EXPECT_EQ(10, client_bounds.x());
162 EXPECT_EQ(20, client_bounds.y()); 162 EXPECT_EQ(20, client_bounds.y());
163 EXPECT_EQ(300, client_bounds.width()); 163 EXPECT_EQ(300, client_bounds.width());
164 EXPECT_EQ(400, client_bounds.height()); 164 EXPECT_EQ(400, client_bounds.height());
165 } 165 }
166 166
167 } // namespace 167 } // namespace
168 } // namespace views 168 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698