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

Side by Side Diff: ui/wm/core/transient_window_manager_unittest.cc

Issue 196063002: Move wm/core to wm namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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/wm/core/transient_window_manager.cc ('k') | ui/wm/core/transient_window_observer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/wm/core/transient_window_manager.h" 5 #include "ui/wm/core/transient_window_manager.h"
6 6
7 #include "ui/aura/client/visibility_client.h" 7 #include "ui/aura/client/visibility_client.h"
8 #include "ui/aura/client/window_tree_client.h" 8 #include "ui/aura/client/window_tree_client.h"
9 #include "ui/aura/layout_manager.h" 9 #include "ui/aura/layout_manager.h"
10 #include "ui/aura/test/aura_test_base.h" 10 #include "ui/aura/test/aura_test_base.h"
11 #include "ui/aura/test/test_windows.h" 11 #include "ui/aura/test/test_windows.h"
12 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
13 #include "ui/wm/core/transient_window_observer.h" 13 #include "ui/wm/core/transient_window_observer.h"
14 #include "ui/wm/core/window_util.h" 14 #include "ui/wm/core/window_util.h"
15 #include "ui/wm/core/wm_state.h" 15 #include "ui/wm/core/wm_state.h"
16 16
17 using aura::Window; 17 using aura::Window;
18 18
19 using aura::test::ChildWindowIDsAsString; 19 using aura::test::ChildWindowIDsAsString;
20 using aura::test::CreateTestWindowWithId; 20 using aura::test::CreateTestWindowWithId;
21 21
22 namespace views { 22 namespace wm {
23 namespace corewm {
24 23
25 class TestTransientWindowObserver : public TransientWindowObserver { 24 class TestTransientWindowObserver : public TransientWindowObserver {
26 public: 25 public:
27 TestTransientWindowObserver() : add_count_(0), remove_count_(0) { 26 TestTransientWindowObserver() : add_count_(0), remove_count_(0) {
28 } 27 }
29 28
30 virtual ~TestTransientWindowObserver() { 29 virtual ~TestTransientWindowObserver() {
31 } 30 }
32 31
33 int add_count() const { return add_count_; } 32 int add_count() const { return add_count_; }
(...skipping 16 matching lines...) Expand all
50 DISALLOW_COPY_AND_ASSIGN(TestTransientWindowObserver); 49 DISALLOW_COPY_AND_ASSIGN(TestTransientWindowObserver);
51 }; 50 };
52 51
53 class TransientWindowManagerTest : public aura::test::AuraTestBase { 52 class TransientWindowManagerTest : public aura::test::AuraTestBase {
54 public: 53 public:
55 TransientWindowManagerTest() {} 54 TransientWindowManagerTest() {}
56 virtual ~TransientWindowManagerTest() {} 55 virtual ~TransientWindowManagerTest() {}
57 56
58 virtual void SetUp() OVERRIDE { 57 virtual void SetUp() OVERRIDE {
59 AuraTestBase::SetUp(); 58 AuraTestBase::SetUp();
60 wm_state_.reset(new views::corewm::WMState); 59 wm_state_.reset(new wm::WMState);
61 } 60 }
62 61
63 virtual void TearDown() OVERRIDE { 62 virtual void TearDown() OVERRIDE {
64 wm_state_.reset(); 63 wm_state_.reset();
65 AuraTestBase::TearDown(); 64 AuraTestBase::TearDown();
66 } 65 }
67 66
68 protected: 67 protected:
69 // Creates a transient window that is transient to |parent|. 68 // Creates a transient window that is transient to |parent|.
70 Window* CreateTransientChild(int id, Window* parent) { 69 Window* CreateTransientChild(int id, Window* parent) {
71 Window* window = new Window(NULL); 70 Window* window = new Window(NULL);
72 window->set_id(id); 71 window->set_id(id);
73 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); 72 window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
74 window->Init(aura::WINDOW_LAYER_TEXTURED); 73 window->Init(aura::WINDOW_LAYER_TEXTURED);
75 aura::client::ParentWindowWithContext(window, root_window(), gfx::Rect()); 74 aura::client::ParentWindowWithContext(window, root_window(), gfx::Rect());
76 AddTransientChild(parent, window); 75 AddTransientChild(parent, window);
77 return window; 76 return window;
78 } 77 }
79 78
80 private: 79 private:
81 scoped_ptr<views::corewm::WMState> wm_state_; 80 scoped_ptr<wm::WMState> wm_state_;
82 81
83 DISALLOW_COPY_AND_ASSIGN(TransientWindowManagerTest); 82 DISALLOW_COPY_AND_ASSIGN(TransientWindowManagerTest);
84 }; 83 };
85 84
86 // Various assertions for transient children. 85 // Various assertions for transient children.
87 TEST_F(TransientWindowManagerTest, TransientChildren) { 86 TEST_F(TransientWindowManagerTest, TransientChildren) {
88 scoped_ptr<Window> parent(CreateTestWindowWithId(0, root_window())); 87 scoped_ptr<Window> parent(CreateTestWindowWithId(0, root_window()));
89 scoped_ptr<Window> w1(CreateTestWindowWithId(1, parent.get())); 88 scoped_ptr<Window> w1(CreateTestWindowWithId(1, parent.get()));
90 scoped_ptr<Window> w3(CreateTestWindowWithId(3, parent.get())); 89 scoped_ptr<Window> w3(CreateTestWindowWithId(3, parent.get()));
91 Window* w2 = CreateTestWindowWithId(2, parent.get()); 90 Window* w2 = CreateTestWindowWithId(2, parent.get());
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 EXPECT_EQ(1, test_observer.add_count()); 626 EXPECT_EQ(1, test_observer.add_count());
628 EXPECT_EQ(0, test_observer.remove_count()); 627 EXPECT_EQ(0, test_observer.remove_count());
629 628
630 RemoveTransientChild(parent.get(), w1.get()); 629 RemoveTransientChild(parent.get(), w1.get());
631 EXPECT_EQ(1, test_observer.add_count()); 630 EXPECT_EQ(1, test_observer.add_count());
632 EXPECT_EQ(1, test_observer.remove_count()); 631 EXPECT_EQ(1, test_observer.remove_count());
633 632
634 TransientWindowManager::Get(parent.get())->RemoveObserver(&test_observer); 633 TransientWindowManager::Get(parent.get())->RemoveObserver(&test_observer);
635 } 634 }
636 635
637 } // namespace corewm 636 } // namespace wm
638 } // namespace views
OLDNEW
« no previous file with comments | « ui/wm/core/transient_window_manager.cc ('k') | ui/wm/core/transient_window_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698