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

Side by Side Diff: ui/aura_shell/toplevel_layout_manager_unittest.cc

Issue 9035001: Move some more WM functionality down into ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 12 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/aura_shell/toplevel_layout_manager.cc ('k') | ui/aura_shell/toplevel_window_event_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/aura_shell/toplevel_layout_manager.h"
6
7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h"
9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/root_window.h"
11 #include "ui/aura/screen_aura.h"
12 #include "ui/aura/test/aura_test_base.h"
13 #include "ui/base/ui_base_types.h"
14 #include "ui/aura/window.h"
15
16 namespace aura_shell {
17
18 namespace {
19
20 class ToplevelLayoutManagerTest : public aura::test::AuraTestBase {
21 public:
22 ToplevelLayoutManagerTest() : layout_manager_(NULL) {}
23 virtual ~ToplevelLayoutManagerTest() {}
24
25 virtual void SetUp() OVERRIDE {
26 aura::test::AuraTestBase::SetUp();
27 aura::RootWindow::GetInstance()->screen()->set_work_area_insets(
28 gfx::Insets(1, 2, 3, 4));
29 aura::RootWindow::GetInstance()->SetHostSize(gfx::Size(500, 400));
30 container_.reset(new aura::Window(NULL));
31 container_->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
32 container_->SetBounds(gfx::Rect(0, 0, 500, 500));
33 layout_manager_ = new internal::ToplevelLayoutManager();
34 container_->SetLayoutManager(layout_manager_);
35 }
36
37 aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
38 aura::Window* window = new aura::Window(NULL);
39 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
40 window->SetBounds(bounds);
41 window->Show();
42 window->SetParent(container_.get());
43 return window;
44 }
45
46 private:
47 // Owned by |container_|.
48 internal::ToplevelLayoutManager* layout_manager_;
49
50 scoped_ptr<aura::Window> container_;
51
52 DISALLOW_COPY_AND_ASSIGN(ToplevelLayoutManagerTest);
53 };
54
55 } // namespace
56
57 // Tests normal->maximize->normal.
58 TEST_F(ToplevelLayoutManagerTest, Maximize) {
59 gfx::Rect bounds(100, 100, 200, 200);
60 scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
61 window->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
62 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()),
63 window->bounds());
64 window->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
65 EXPECT_EQ(bounds, window->bounds());
66 }
67
68 // Tests normal->fullscreen->normal.
69 TEST_F(ToplevelLayoutManagerTest, Fullscreen) {
70 gfx::Rect bounds(100, 100, 200, 200);
71 scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
72 window->SetIntProperty(aura::client::kShowStateKey,
73 ui::SHOW_STATE_FULLSCREEN);
74 EXPECT_EQ(gfx::Screen::GetMonitorAreaNearestWindow(window.get()),
75 window->bounds());
76 window->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
77 EXPECT_EQ(bounds, window->bounds());
78 }
79
80 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/toplevel_layout_manager.cc ('k') | ui/aura_shell/toplevel_window_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698