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

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

Issue 8082017: Change Window visibility to a simple boolean for now. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' 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_window.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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 200
201 Window* CreateTestWindowWithDelegate(WindowDelegate* delegate, 201 Window* CreateTestWindowWithDelegate(WindowDelegate* delegate,
202 int id, 202 int id,
203 const gfx::Rect& bounds, 203 const gfx::Rect& bounds,
204 Window* parent) { 204 Window* parent) {
205 Window* window = new Window(delegate); 205 Window* window = new Window(delegate);
206 window->set_id(id); 206 window->set_id(id);
207 window->Init(); 207 window->Init();
208 window->SetBounds(bounds); 208 window->SetBounds(bounds);
209 window->SetVisibility(Window::VISIBILITY_SHOWN); 209 window->Show();
210 window->SetParent(parent); 210 window->SetParent(parent);
211 return window; 211 return window;
212 } 212 }
213 213
214 void RunPendingMessages() { 214 void RunPendingMessages() {
215 MessageLoop message_loop(MessageLoop::TYPE_UI); 215 MessageLoop message_loop(MessageLoop::TYPE_UI);
216 MessageLoopForUI::current()->Run(NULL); 216 MessageLoopForUI::current()->Run(NULL);
217 } 217 }
218 218
219 private: 219 private:
(...skipping 13 matching lines...) Expand all
233 EXPECT_EQ(NULL, w1->GetChildById(57)); 233 EXPECT_EQ(NULL, w1->GetChildById(57));
234 EXPECT_EQ(w12.get(), w1->GetChildById(12)); 234 EXPECT_EQ(w12.get(), w1->GetChildById(12));
235 EXPECT_EQ(w111.get(), w1->GetChildById(111)); 235 EXPECT_EQ(w111.get(), w1->GetChildById(111));
236 } 236 }
237 237
238 TEST_F(WindowTest, HitTest) { 238 TEST_F(WindowTest, HitTest) {
239 Window w1(new TestWindowDelegate(SK_ColorWHITE)); 239 Window w1(new TestWindowDelegate(SK_ColorWHITE));
240 w1.set_id(1); 240 w1.set_id(1);
241 w1.Init(); 241 w1.Init();
242 w1.SetBounds(gfx::Rect(10, 10, 50, 50)); 242 w1.SetBounds(gfx::Rect(10, 10, 50, 50));
243 w1.SetVisibility(Window::VISIBILITY_SHOWN); 243 w1.Show();
244 w1.SetParent(NULL); 244 w1.SetParent(NULL);
245 245
246 // Points are in the Window's coordinates. 246 // Points are in the Window's coordinates.
247 EXPECT_TRUE(w1.HitTest(gfx::Point(1, 1))); 247 EXPECT_TRUE(w1.HitTest(gfx::Point(1, 1)));
248 EXPECT_FALSE(w1.HitTest(gfx::Point(-1, -1))); 248 EXPECT_FALSE(w1.HitTest(gfx::Point(-1, -1)));
249 249
250 // TODO(beng): clip Window to parent. 250 // TODO(beng): clip Window to parent.
251 } 251 }
252 252
253 TEST_F(WindowTest, GetEventHandlerForPoint) { 253 TEST_F(WindowTest, GetEventHandlerForPoint) {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 gfx::Rect(50, 50, 450, 450), w11.get())); 586 gfx::Rect(50, 50, 450, 450), w11.get()));
587 scoped_ptr<Window> w12(CreateTestWindowWithDelegate(NULL, 12, 587 scoped_ptr<Window> w12(CreateTestWindowWithDelegate(NULL, 12,
588 gfx::Rect(0, 0, 500, 500), w1.get())); 588 gfx::Rect(0, 0, 500, 500), w1.get()));
589 589
590 gfx::Point target_point = w111->bounds().CenterPoint(); 590 gfx::Point target_point = w111->bounds().CenterPoint();
591 EXPECT_EQ(w111.get(), w1->GetEventHandlerForPoint(target_point)); 591 EXPECT_EQ(w111.get(), w1->GetEventHandlerForPoint(target_point));
592 } 592 }
593 593
594 } // namespace internal 594 } // namespace internal
595 } // namespace aura 595 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | ui/aura_shell/desktop_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698