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

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

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