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

Side by Side Diff: aura/window_unittest.cc

Issue 7770002: gfx::Compositor: SchedulePaint. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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 | « aura/desktop.cc ('k') | ui/gfx/compositor/compositor.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) 2011 The Chromium Authors. All rights reserved. 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 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 "aura/desktop.h" 5 #include "aura/desktop.h"
6 #include "aura/event.h" 6 #include "aura/event.h"
7 #include "aura/focus_manager.h" 7 #include "aura/focus_manager.h"
8 #include "aura/root_window.h" 8 #include "aura/root_window.h"
9 #include "aura/window_delegate.h" 9 #include "aura/window_delegate.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 private: 52 private:
53 SkColor color_; 53 SkColor color_;
54 ui::KeyboardCode last_key_code_; 54 ui::KeyboardCode last_key_code_;
55 55
56 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); 56 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate);
57 }; 57 };
58 58
59 class WindowTest : public testing::Test { 59 class WindowTest : public testing::Test {
60 public: 60 public:
61 WindowTest() { 61 WindowTest() : main_message_loop(MessageLoop::TYPE_UI) {
62 aura::Desktop::GetInstance()->Show(); 62 aura::Desktop::GetInstance()->Show();
63 aura::Desktop::GetInstance()->SetSize(gfx::Size(500, 500)); 63 aura::Desktop::GetInstance()->SetSize(gfx::Size(500, 500));
64 } 64 }
65 virtual ~WindowTest() {} 65 virtual ~WindowTest() {}
66 66
67 // Overridden from testing::Test: 67 // Overridden from testing::Test:
68 virtual void SetUp() OVERRIDE { 68 virtual void SetUp() OVERRIDE {
69 } 69 }
70 70
71 virtual void TearDown() OVERRIDE { 71 virtual void TearDown() OVERRIDE {
(...skipping 14 matching lines...) Expand all
86 Window* window = new Window(delegate); 86 Window* window = new Window(delegate);
87 window->set_id(id); 87 window->set_id(id);
88 window->Init(); 88 window->Init();
89 window->SetBounds(bounds, 0); 89 window->SetBounds(bounds, 0);
90 window->SetVisibility(Window::VISIBILITY_SHOWN); 90 window->SetVisibility(Window::VISIBILITY_SHOWN);
91 window->SetParent(parent); 91 window->SetParent(parent);
92 return window; 92 return window;
93 } 93 }
94 94
95 void RunPendingMessages() { 95 void RunPendingMessages() {
96 MessageLoop main_message_loop(MessageLoop::TYPE_UI); 96 MessageLoop message_loop(MessageLoop::TYPE_UI);
97 MessageLoopForUI::current()->Run(NULL); 97 MessageLoopForUI::current()->Run(NULL);
98 } 98 }
99 99
100 private: 100 private:
101 MessageLoop main_message_loop;
102
101 DISALLOW_COPY_AND_ASSIGN(WindowTest); 103 DISALLOW_COPY_AND_ASSIGN(WindowTest);
102 }; 104 };
103 105
104 } // namespace 106 } // namespace
105 107
106 TEST_F(WindowTest, HitTest) { 108 TEST_F(WindowTest, HitTest) {
107 Window w1(new TestWindowDelegate(SK_ColorWHITE)); 109 Window w1(new TestWindowDelegate(SK_ColorWHITE));
108 w1.set_id(1); 110 w1.set_id(1);
109 w1.Init(); 111 w1.Init();
110 w1.SetBounds(gfx::Rect(10, 10, 50, 50), 0); 112 w1.SetBounds(gfx::Rect(10, 10, 50, 50), 0);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 EXPECT_EQ(w121.get(), focus_manager->focused_window()); 177 EXPECT_EQ(w121.get(), focus_manager->focused_window());
176 178
177 // The key press should be sent to the focused sub-window. 179 // The key press should be sent to the focused sub-window.
178 desktop->OnKeyEvent(KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_E, 0)); 180 desktop->OnKeyEvent(KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_E, 0));
179 EXPECT_EQ(ui::VKEY_E, w121delegate->last_key_code()); 181 EXPECT_EQ(ui::VKEY_E, w121delegate->last_key_code());
180 } 182 }
181 183
182 } // namespace internal 184 } // namespace internal
183 } // namespace aura 185 } // namespace aura
184 186
OLDNEW
« no previous file with comments | « aura/desktop.cc ('k') | ui/gfx/compositor/compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698