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

Side by Side Diff: ui/wm/core/shadow_controller_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/shadow_controller.cc ('k') | ui/wm/core/shadow_types.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 (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/wm/core/shadow_controller.h" 5 #include "ui/wm/core/shadow_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "ui/aura/client/activation_client.h" 11 #include "ui/aura/client/activation_client.h"
12 #include "ui/aura/client/window_tree_client.h" 12 #include "ui/aura/client/window_tree_client.h"
13 #include "ui/aura/test/aura_test_base.h" 13 #include "ui/aura/test/aura_test_base.h"
14 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
15 #include "ui/aura/window_event_dispatcher.h" 15 #include "ui/aura/window_event_dispatcher.h"
16 #include "ui/compositor/layer.h" 16 #include "ui/compositor/layer.h"
17 #include "ui/wm/core/shadow.h" 17 #include "ui/wm/core/shadow.h"
18 #include "ui/wm/core/shadow_types.h" 18 #include "ui/wm/core/shadow_types.h"
19 #include "ui/wm/core/window_util.h" 19 #include "ui/wm/core/window_util.h"
20 #include "ui/wm/core/wm_state.h" 20 #include "ui/wm/core/wm_state.h"
21 21
22 namespace views { 22 namespace wm {
23 namespace corewm {
24 23
25 class ShadowControllerTest : public aura::test::AuraTestBase { 24 class ShadowControllerTest : public aura::test::AuraTestBase {
26 public: 25 public:
27 ShadowControllerTest() {} 26 ShadowControllerTest() {}
28 virtual ~ShadowControllerTest() {} 27 virtual ~ShadowControllerTest() {}
29 28
30 virtual void SetUp() OVERRIDE { 29 virtual void SetUp() OVERRIDE {
31 wm_state_.reset(new views::corewm::WMState); 30 wm_state_.reset(new wm::WMState);
32 AuraTestBase::SetUp(); 31 AuraTestBase::SetUp();
33 aura::client::ActivationClient* activation_client = 32 aura::client::ActivationClient* activation_client =
34 aura::client::GetActivationClient(root_window()); 33 aura::client::GetActivationClient(root_window());
35 shadow_controller_.reset(new ShadowController(activation_client)); 34 shadow_controller_.reset(new ShadowController(activation_client));
36 } 35 }
37 virtual void TearDown() OVERRIDE { 36 virtual void TearDown() OVERRIDE {
38 shadow_controller_.reset(); 37 shadow_controller_.reset();
39 AuraTestBase::TearDown(); 38 AuraTestBase::TearDown();
40 wm_state_.reset(); 39 wm_state_.reset();
41 } 40 }
42 41
43 protected: 42 protected:
44 ShadowController* shadow_controller() { return shadow_controller_.get(); } 43 ShadowController* shadow_controller() { return shadow_controller_.get(); }
45 44
46 void ActivateWindow(aura::Window* window) { 45 void ActivateWindow(aura::Window* window) {
47 DCHECK(window); 46 DCHECK(window);
48 DCHECK(window->GetRootWindow()); 47 DCHECK(window->GetRootWindow());
49 aura::client::GetActivationClient(window->GetRootWindow())->ActivateWindow( 48 aura::client::GetActivationClient(window->GetRootWindow())->ActivateWindow(
50 window); 49 window);
51 } 50 }
52 51
53 private: 52 private:
54 scoped_ptr<ShadowController> shadow_controller_; 53 scoped_ptr<ShadowController> shadow_controller_;
55 scoped_ptr<views::corewm::WMState> wm_state_; 54 scoped_ptr<wm::WMState> wm_state_;
56 55
57 DISALLOW_COPY_AND_ASSIGN(ShadowControllerTest); 56 DISALLOW_COPY_AND_ASSIGN(ShadowControllerTest);
58 }; 57 };
59 58
60 // Tests that various methods in Window update the Shadow object as expected. 59 // Tests that various methods in Window update the Shadow object as expected.
61 TEST_F(ShadowControllerTest, Shadow) { 60 TEST_F(ShadowControllerTest, Shadow) {
62 scoped_ptr<aura::Window> window(new aura::Window(NULL)); 61 scoped_ptr<aura::Window> window(new aura::Window(NULL));
63 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); 62 window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
64 window->Init(aura::WINDOW_LAYER_TEXTURED); 63 window->Init(aura::WINDOW_LAYER_TEXTURED);
65 ParentWindow(window.get()); 64 ParentWindow(window.get());
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 window2->SetBounds(gfx::Rect(11, 21, 301, 401)); 207 window2->SetBounds(gfx::Rect(11, 21, 301, 401));
209 AddTransientChild(window1.get(), window2.get()); 208 AddTransientChild(window1.get(), window2.get());
210 aura::client::SetHideOnDeactivate(window2.get(), true); 209 aura::client::SetHideOnDeactivate(window2.get(), true);
211 window2->Show(); 210 window2->Show();
212 ActivateWindow(window2.get()); 211 ActivateWindow(window2.get());
213 212
214 // window1 is now inactive, but its shadow should still appear active. 213 // window1 is now inactive, but its shadow should still appear active.
215 EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow1->style()); 214 EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow1->style());
216 } 215 }
217 216
218 } // namespace corewm 217 } // namespace wm
219 } // namespace views
OLDNEW
« no previous file with comments | « ui/wm/core/shadow_controller.cc ('k') | ui/wm/core/shadow_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698