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

Side by Side Diff: ui/aura/window_unittest.cc

Issue 7972023: Implicit animations through Layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More tweaks Created 9 years, 2 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/window.cc ('k') | ui/aura_shell/desktop_layout_manager.cc » ('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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/aura/desktop.h" 9 #include "ui/aura/desktop.h"
10 #include "ui/aura/event.h" 10 #include "ui/aura/event.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 id, bounds, parent); 192 id, bounds, parent);
193 } 193 }
194 194
195 Window* CreateTestWindowWithDelegate(WindowDelegate* delegate, 195 Window* CreateTestWindowWithDelegate(WindowDelegate* delegate,
196 int id, 196 int id,
197 const gfx::Rect& bounds, 197 const gfx::Rect& bounds,
198 Window* parent) { 198 Window* parent) {
199 Window* window = new Window(delegate); 199 Window* window = new Window(delegate);
200 window->set_id(id); 200 window->set_id(id);
201 window->Init(); 201 window->Init();
202 window->SetBounds(bounds, 0); 202 window->SetBounds(bounds);
203 window->SetVisibility(Window::VISIBILITY_SHOWN); 203 window->SetVisibility(Window::VISIBILITY_SHOWN);
204 window->SetParent(parent); 204 window->SetParent(parent);
205 return window; 205 return window;
206 } 206 }
207 207
208 void RunPendingMessages() { 208 void RunPendingMessages() {
209 MessageLoop message_loop(MessageLoop::TYPE_UI); 209 MessageLoop message_loop(MessageLoop::TYPE_UI);
210 MessageLoopForUI::current()->Run(NULL); 210 MessageLoopForUI::current()->Run(NULL);
211 } 211 }
212 212
213 private: 213 private:
214 MessageLoop main_message_loop; 214 MessageLoop main_message_loop;
215 215
216 DISALLOW_COPY_AND_ASSIGN(WindowTest); 216 DISALLOW_COPY_AND_ASSIGN(WindowTest);
217 }; 217 };
218 218
219 } // namespace 219 } // namespace
220 220
221 TEST_F(WindowTest, HitTest) { 221 TEST_F(WindowTest, HitTest) {
222 Window w1(new TestWindowDelegate(SK_ColorWHITE)); 222 Window w1(new TestWindowDelegate(SK_ColorWHITE));
223 w1.set_id(1); 223 w1.set_id(1);
224 w1.Init(); 224 w1.Init();
225 w1.SetBounds(gfx::Rect(10, 10, 50, 50), 0); 225 w1.SetBounds(gfx::Rect(10, 10, 50, 50));
226 w1.SetVisibility(Window::VISIBILITY_SHOWN); 226 w1.SetVisibility(Window::VISIBILITY_SHOWN);
227 w1.SetParent(NULL); 227 w1.SetParent(NULL);
228 228
229 // Points are in the Window's coordinates. 229 // Points are in the Window's coordinates.
230 EXPECT_TRUE(w1.HitTest(gfx::Point(1, 1))); 230 EXPECT_TRUE(w1.HitTest(gfx::Point(1, 1)));
231 EXPECT_FALSE(w1.HitTest(gfx::Point(-1, -1))); 231 EXPECT_FALSE(w1.HitTest(gfx::Point(-1, -1)));
232 232
233 // TODO(beng): clip Window to parent. 233 // TODO(beng): clip Window to parent.
234 } 234 }
235 235
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 EXPECT_EQ(0, d2.activated_count()); 547 EXPECT_EQ(0, d2.activated_count());
548 EXPECT_EQ(0, d2.lost_active_count()); 548 EXPECT_EQ(0, d2.lost_active_count());
549 EXPECT_EQ(w1.get(), desktop->active_window()); 549 EXPECT_EQ(w1.get(), desktop->active_window());
550 EXPECT_EQ(w1.get(), focus_manager->focused_window()); 550 EXPECT_EQ(w1.get(), focus_manager->focused_window());
551 EXPECT_EQ(1, d1.activated_count()); 551 EXPECT_EQ(1, d1.activated_count());
552 EXPECT_EQ(0, d1.lost_active_count()); 552 EXPECT_EQ(0, d1.lost_active_count());
553 } 553 }
554 554
555 } // namespace internal 555 } // namespace internal
556 } // namespace aura 556 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | ui/aura_shell/desktop_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698