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

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

Issue 9699013: MonitorManager to manage multiple monitors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
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/env.h"
11 #include "ui/aura/layout_manager.h" 12 #include "ui/aura/layout_manager.h"
13 #include "ui/aura/monitor_manager.h"
12 #include "ui/aura/root_window.h" 14 #include "ui/aura/root_window.h"
13 #include "ui/aura/test/test_screen.h" 15 #include "ui/aura/test/test_screen.h"
14 #include "ui/aura/test/test_stacking_client.h" 16 #include "ui/aura/test/test_stacking_client.h"
15 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
16 #include "ui/views/widget/root_view.h" 18 #include "ui/views/widget/root_view.h"
17 #include "ui/views/widget/widget_delegate.h" 19 #include "ui/views/widget/widget_delegate.h"
18 20
19 namespace views { 21 namespace views {
20 namespace { 22 namespace {
21 23
22 NativeWidgetAura* Init(aura::Window* parent, Widget* widget) { 24 NativeWidgetAura* Init(aura::Window* parent, Widget* widget) {
23 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); 25 Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
24 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 26 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
25 params.parent = parent; 27 params.parent = parent;
26 widget->Init(params); 28 widget->Init(params);
27 return static_cast<NativeWidgetAura*>(widget->native_widget()); 29 return static_cast<NativeWidgetAura*>(widget->native_widget());
28 } 30 }
29 31
30 class NativeWidgetAuraTest : public testing::Test { 32 class NativeWidgetAuraTest : public testing::Test {
31 public: 33 public:
32 NativeWidgetAuraTest() {} 34 NativeWidgetAuraTest() {}
33 virtual ~NativeWidgetAuraTest() {} 35 virtual ~NativeWidgetAuraTest() {}
34 36
35 // testing::Test overrides: 37 // testing::Test overrides:
36 virtual void SetUp() OVERRIDE { 38 virtual void SetUp() OVERRIDE {
37 root_window_.reset(new aura::RootWindow); 39 root_window_.reset(new aura::RootWindow);
40 aura::Env::GetInstance()->SetMonitorManager(
41 aura::CreateSingleMonitorManager(root_window_.get()));
38 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); 42 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get()));
39 root_window_->SetBounds(gfx::Rect(0, 0, 640, 480)); 43 root_window_->SetBounds(gfx::Rect(0, 0, 640, 480));
40 root_window_->SetHostSize(gfx::Size(640, 480)); 44 root_window_->SetHostSize(gfx::Size(640, 480));
41 test_stacking_client_.reset( 45 test_stacking_client_.reset(
42 new aura::test::TestStackingClient(root_window_.get())); 46 new aura::test::TestStackingClient(root_window_.get()));
43 } 47 }
44 virtual void TearDown() OVERRIDE { 48 virtual void TearDown() OVERRIDE {
45 message_loop_.RunAllPending(); 49 message_loop_.RunAllPending();
46 test_stacking_client_.reset(); 50 test_stacking_client_.reset();
47 root_window_.reset(); 51 root_window_.reset();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // For Aura, client area bounds match window bounds. 175 // For Aura, client area bounds match window bounds.
172 gfx::Rect client_bounds = widget->GetClientAreaScreenBounds(); 176 gfx::Rect client_bounds = widget->GetClientAreaScreenBounds();
173 EXPECT_EQ(10, client_bounds.x()); 177 EXPECT_EQ(10, client_bounds.x());
174 EXPECT_EQ(20, client_bounds.y()); 178 EXPECT_EQ(20, client_bounds.y());
175 EXPECT_EQ(300, client_bounds.width()); 179 EXPECT_EQ(300, client_bounds.width());
176 EXPECT_EQ(400, client_bounds.height()); 180 EXPECT_EQ(400, client_bounds.height());
177 } 181 }
178 182
179 } // namespace 183 } // namespace
180 } // namespace views 184 } // namespace views
OLDNEW
« ash/wm/shelf_layout_manager_unittest.cc ('K') | « 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