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

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

Issue 9616045: Aura/Ash split: Move ScreenAura to ash::ScreenAsh. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a separate aura::TestScreen in tests instead, partially reverting to patchset 2 Created 8 years, 9 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/test/views_test_base.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"
11 #include "ui/aura/layout_manager.h" 11 #include "ui/aura/layout_manager.h"
12 #include "ui/aura/root_window.h" 12 #include "ui/aura/root_window.h"
13 #include "ui/aura/test/test_screen.h"
13 #include "ui/aura/test/test_stacking_client.h" 14 #include "ui/aura/test/test_stacking_client.h"
14 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
15 #include "ui/views/widget/root_view.h" 16 #include "ui/views/widget/root_view.h"
16 #include "ui/views/widget/widget_delegate.h" 17 #include "ui/views/widget/widget_delegate.h"
17 18
18 namespace views { 19 namespace views {
19 namespace { 20 namespace {
20 21
21 NativeWidgetAura* Init(aura::Window* parent, Widget* widget) { 22 NativeWidgetAura* Init(aura::Window* parent, Widget* widget) {
22 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); 23 Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
23 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 24 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
24 params.parent = parent; 25 params.parent = parent;
25 widget->Init(params); 26 widget->Init(params);
26 return static_cast<NativeWidgetAura*>(widget->native_widget()); 27 return static_cast<NativeWidgetAura*>(widget->native_widget());
27 } 28 }
28 29
29 class NativeWidgetAuraTest : public testing::Test { 30 class NativeWidgetAuraTest : public testing::Test {
30 public: 31 public:
31 NativeWidgetAuraTest() {} 32 NativeWidgetAuraTest() {}
32 virtual ~NativeWidgetAuraTest() {} 33 virtual ~NativeWidgetAuraTest() {}
33 34
34 // testing::Test overrides: 35 // testing::Test overrides:
35 virtual void SetUp() OVERRIDE { 36 virtual void SetUp() OVERRIDE {
36 root_window_.reset(new aura::RootWindow); 37 root_window_.reset(new aura::RootWindow);
38 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get()));
37 root_window_->SetBounds(gfx::Rect(0, 0, 640, 480)); 39 root_window_->SetBounds(gfx::Rect(0, 0, 640, 480));
38 root_window_->SetHostSize(gfx::Size(640, 480)); 40 root_window_->SetHostSize(gfx::Size(640, 480));
39 test_stacking_client_.reset( 41 test_stacking_client_.reset(
40 new aura::test::TestStackingClient(root_window_.get())); 42 new aura::test::TestStackingClient(root_window_.get()));
41 } 43 }
42 virtual void TearDown() OVERRIDE { 44 virtual void TearDown() OVERRIDE {
43 message_loop_.RunAllPending(); 45 message_loop_.RunAllPending();
44 test_stacking_client_.reset(); 46 test_stacking_client_.reset();
45 root_window_.reset(); 47 root_window_.reset();
46 } 48 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // For Aura, client area bounds match window bounds. 171 // For Aura, client area bounds match window bounds.
170 gfx::Rect client_bounds = widget->GetClientAreaScreenBounds(); 172 gfx::Rect client_bounds = widget->GetClientAreaScreenBounds();
171 EXPECT_EQ(10, client_bounds.x()); 173 EXPECT_EQ(10, client_bounds.x());
172 EXPECT_EQ(20, client_bounds.y()); 174 EXPECT_EQ(20, client_bounds.y());
173 EXPECT_EQ(300, client_bounds.width()); 175 EXPECT_EQ(300, client_bounds.width());
174 EXPECT_EQ(400, client_bounds.height()); 176 EXPECT_EQ(400, client_bounds.height());
175 } 177 }
176 178
177 } // namespace 179 } // namespace
178 } // namespace views 180 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/test/views_test_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698