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

Side by Side Diff: ui/views/corewm/shadow_controller_unittest.cc

Issue 105813013: Adds views::corewm::WMState to install common state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix viewseventtestbase Created 7 years 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/corewm/shadow_controller.h" 5 #include "ui/views/corewm/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/root_window.h" 13 #include "ui/aura/root_window.h"
14 #include "ui/aura/test/aura_test_base.h" 14 #include "ui/aura/test/aura_test_base.h"
15 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
16 #include "ui/compositor/layer.h" 16 #include "ui/compositor/layer.h"
17 #include "ui/views/corewm/shadow.h" 17 #include "ui/views/corewm/shadow.h"
18 #include "ui/views/corewm/shadow_types.h" 18 #include "ui/views/corewm/shadow_types.h"
19 #include "ui/views/corewm/wm_state.h"
19 20
20 namespace views { 21 namespace views {
21 namespace corewm { 22 namespace corewm {
22 23
23 class ShadowControllerTest : public aura::test::AuraTestBase { 24 class ShadowControllerTest : public aura::test::AuraTestBase {
24 public: 25 public:
25 ShadowControllerTest() {} 26 ShadowControllerTest() {}
26 virtual ~ShadowControllerTest() {} 27 virtual ~ShadowControllerTest() {}
27 28
28 virtual void SetUp() OVERRIDE { 29 virtual void SetUp() OVERRIDE {
30 wm_state_.reset(new views::corewm::WMState);
29 AuraTestBase::SetUp(); 31 AuraTestBase::SetUp();
30 aura::client::ActivationClient* activation_client = 32 aura::client::ActivationClient* activation_client =
31 aura::client::GetActivationClient(root_window()); 33 aura::client::GetActivationClient(root_window());
32 shadow_controller_.reset(new ShadowController(activation_client)); 34 shadow_controller_.reset(new ShadowController(activation_client));
33 } 35 }
34 virtual void TearDown() OVERRIDE { 36 virtual void TearDown() OVERRIDE {
35 shadow_controller_.reset(); 37 shadow_controller_.reset();
36 AuraTestBase::TearDown(); 38 AuraTestBase::TearDown();
39 wm_state_.reset();
37 } 40 }
38 41
39 protected: 42 protected:
40 ShadowController* shadow_controller() { return shadow_controller_.get(); } 43 ShadowController* shadow_controller() { return shadow_controller_.get(); }
41 44
42 void ActivateWindow(aura::Window* window) { 45 void ActivateWindow(aura::Window* window) {
43 DCHECK(window); 46 DCHECK(window);
44 DCHECK(window->GetRootWindow()); 47 DCHECK(window->GetRootWindow());
45 aura::client::GetActivationClient(window->GetRootWindow())->ActivateWindow( 48 aura::client::GetActivationClient(window->GetRootWindow())->ActivateWindow(
46 window); 49 window);
47 } 50 }
48 51
49 private: 52 private:
50 scoped_ptr<ShadowController> shadow_controller_; 53 scoped_ptr<ShadowController> shadow_controller_;
54 scoped_ptr<views::corewm::WMState> wm_state_;
51 55
52 DISALLOW_COPY_AND_ASSIGN(ShadowControllerTest); 56 DISALLOW_COPY_AND_ASSIGN(ShadowControllerTest);
53 }; 57 };
54 58
55 // 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.
56 TEST_F(ShadowControllerTest, Shadow) { 60 TEST_F(ShadowControllerTest, Shadow) {
57 scoped_ptr<aura::Window> window(new aura::Window(NULL)); 61 scoped_ptr<aura::Window> window(new aura::Window(NULL));
58 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); 62 window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
59 window->Init(ui::LAYER_TEXTURED); 63 window->Init(ui::LAYER_TEXTURED);
60 ParentWindow(window.get()); 64 ParentWindow(window.get());
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 aura::client::SetHideOnDeactivate(window2.get(), true); 209 aura::client::SetHideOnDeactivate(window2.get(), true);
206 window2->Show(); 210 window2->Show();
207 ActivateWindow(window2.get()); 211 ActivateWindow(window2.get());
208 212
209 // window1 is now inactive, but its shadow should still appear active. 213 // window1 is now inactive, but its shadow should still appear active.
210 EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow1->style()); 214 EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow1->style());
211 } 215 }
212 216
213 } // namespace corewm 217 } // namespace corewm
214 } // namespace views 218 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/focus_controller_unittest.cc ('k') | ui/views/corewm/tooltip_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698