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

Side by Side Diff: ash/wm/window_manager_unittest.cc

Issue 406413004: Cleanups for aura/test/event_generator.h (resolve TODOs) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for added files Created 6 years, 5 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
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 "ash/shell.h" 5 #include "ash/shell.h"
6 #include "ash/shell_window_ids.h" 6 #include "ash/shell_window_ids.h"
7 #include "ash/test/ash_test_base.h" 7 #include "ash/test/ash_test_base.h"
8 #include "ash/test/shell_test_api.h" 8 #include "ash/test/shell_test_api.h"
9 #include "ash/test/test_activation_delegate.h" 9 #include "ash/test/test_activation_delegate.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
11 #include "ui/aura/client/cursor_client_observer.h" 11 #include "ui/aura/client/cursor_client_observer.h"
12 #include "ui/aura/client/focus_client.h" 12 #include "ui/aura/client/focus_client.h"
13 #include "ui/aura/env.h" 13 #include "ui/aura/env.h"
14 #include "ui/aura/test/aura_test_base.h" 14 #include "ui/aura/test/aura_test_base.h"
15 #include "ui/aura/test/event_generator.h"
16 #include "ui/aura/test/test_window_delegate.h" 15 #include "ui/aura/test/test_window_delegate.h"
17 #include "ui/aura/test/test_windows.h" 16 #include "ui/aura/test/test_windows.h"
18 #include "ui/base/cursor/cursor.h" 17 #include "ui/base/cursor/cursor.h"
19 #include "ui/base/hit_test.h" 18 #include "ui/base/hit_test.h"
20 #include "ui/events/event.h" 19 #include "ui/events/event.h"
21 #include "ui/events/event_processor.h" 20 #include "ui/events/event_processor.h"
22 #include "ui/events/event_utils.h" 21 #include "ui/events/event_utils.h"
22 #include "ui/events/test/event_generator.h"
23 #include "ui/events/test/test_event_handler.h" 23 #include "ui/events/test/test_event_handler.h"
24 #include "ui/gfx/screen.h" 24 #include "ui/gfx/screen.h"
25 #include "ui/wm/core/compound_event_filter.h" 25 #include "ui/wm/core/compound_event_filter.h"
26 #include "ui/wm/core/input_method_event_filter.h" 26 #include "ui/wm/core/input_method_event_filter.h"
27 #include "ui/wm/public/activation_client.h" 27 #include "ui/wm/public/activation_client.h"
28 #include "ui/wm/public/activation_delegate.h" 28 #include "ui/wm/public/activation_delegate.h"
29 29
30 namespace { 30 namespace {
31 31
32 class TestingCursorClientObserver : public aura::client::CursorClientObserver { 32 class TestingCursorClientObserver : public aura::client::CursorClientObserver {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 scoped_ptr<aura::Window> w122(aura::test::CreateTestWindowWithDelegate( 167 scoped_ptr<aura::Window> w122(aura::test::CreateTestWindowWithDelegate(
168 w122delegate, -122, gfx::Rect(10, 5, 5, 5), w12.get())); 168 w122delegate, -122, gfx::Rect(10, 5, 5, 5), w12.get()));
169 aura::test::ColorTestWindowDelegate* w123delegate = 169 aura::test::ColorTestWindowDelegate* w123delegate =
170 new aura::test::ColorTestWindowDelegate(SK_ColorRED); 170 new aura::test::ColorTestWindowDelegate(SK_ColorRED);
171 scoped_ptr<aura::Window> w123(aura::test::CreateTestWindowWithDelegate( 171 scoped_ptr<aura::Window> w123(aura::test::CreateTestWindowWithDelegate(
172 w123delegate, -123, gfx::Rect(15, 5, 5, 5), w12.get())); 172 w123delegate, -123, gfx::Rect(15, 5, 5, 5), w12.get()));
173 scoped_ptr<aura::Window> w13(aura::test::CreateTestWindow( 173 scoped_ptr<aura::Window> w13(aura::test::CreateTestWindow(
174 SK_ColorGRAY, -13, gfx::Rect(5, 470, 50, 50), w1.get())); 174 SK_ColorGRAY, -13, gfx::Rect(5, 470, 50, 50), w1.get()));
175 175
176 // Click on a sub-window (w121) to focus it. 176 // Click on a sub-window (w121) to focus it.
177 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), 177 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), w121.get());
178 w121.get());
179 generator.ClickLeftButton(); 178 generator.ClickLeftButton();
180 179
181 aura::client::FocusClient* focus_client = 180 aura::client::FocusClient* focus_client =
182 aura::client::GetFocusClient(w121.get()); 181 aura::client::GetFocusClient(w121.get());
183 EXPECT_EQ(w121.get(), focus_client->GetFocusedWindow()); 182 EXPECT_EQ(w121.get(), focus_client->GetFocusedWindow());
184 183
185 ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor(); 184 ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor();
186 185
187 // The key press should be sent to the focused sub-window. 186 // The key press should be sent to the focused sub-window.
188 ui::KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_E, 0, false); 187 ui::KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_E, 0, false);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // Activate window1. 279 // Activate window1.
281 wm::ActivateWindow(w1.get()); 280 wm::ActivateWindow(w1.get());
282 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); 281 EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
283 EXPECT_EQ(w1.get(), focus_client->GetFocusedWindow()); 282 EXPECT_EQ(w1.get(), focus_client->GetFocusedWindow());
284 EXPECT_EQ(1, d1.activated_count()); 283 EXPECT_EQ(1, d1.activated_count());
285 EXPECT_EQ(0, d1.lost_active_count()); 284 EXPECT_EQ(0, d1.lost_active_count());
286 d1.Clear(); 285 d1.Clear();
287 286
288 { 287 {
289 // Click on window2. 288 // Click on window2.
290 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), 289 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), w2.get());
291 w2.get());
292 generator.ClickLeftButton(); 290 generator.ClickLeftButton();
293 291
294 // Window2 should have become active. 292 // Window2 should have become active.
295 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); 293 EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
296 EXPECT_EQ(w2.get(), focus_client->GetFocusedWindow()); 294 EXPECT_EQ(w2.get(), focus_client->GetFocusedWindow());
297 EXPECT_EQ(0, d1.activated_count()); 295 EXPECT_EQ(0, d1.activated_count());
298 EXPECT_EQ(1, d1.lost_active_count()); 296 EXPECT_EQ(1, d1.lost_active_count());
299 EXPECT_EQ(1, d2.activated_count()); 297 EXPECT_EQ(1, d2.activated_count());
300 EXPECT_EQ(0, d2.lost_active_count()); 298 EXPECT_EQ(0, d2.lost_active_count());
301 d1.Clear(); 299 d1.Clear();
302 d2.Clear(); 300 d2.Clear();
303 } 301 }
304 302
305 { 303 {
306 // Click back on window1, but set it up so w1 doesn't activate on click. 304 // Click back on window1, but set it up so w1 doesn't activate on click.
307 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), 305 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), w1.get());
308 w1.get());
309 d1.set_activate(false); 306 d1.set_activate(false);
310 generator.ClickLeftButton(); 307 generator.ClickLeftButton();
311 308
312 // Window2 should still be active and focused. 309 // Window2 should still be active and focused.
313 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); 310 EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
314 EXPECT_EQ(w2.get(), focus_client->GetFocusedWindow()); 311 EXPECT_EQ(w2.get(), focus_client->GetFocusedWindow());
315 EXPECT_EQ(0, d1.activated_count()); 312 EXPECT_EQ(0, d1.activated_count());
316 EXPECT_EQ(0, d1.lost_active_count()); 313 EXPECT_EQ(0, d1.lost_active_count());
317 EXPECT_EQ(0, d2.activated_count()); 314 EXPECT_EQ(0, d2.activated_count());
318 EXPECT_EQ(0, d2.lost_active_count()); 315 EXPECT_EQ(0, d2.lost_active_count());
319 d1.Clear(); 316 d1.Clear();
320 d2.Clear(); 317 d2.Clear();
321 } 318 }
322 319
323 // Destroy window2, this should make window1 active. 320 // Destroy window2, this should make window1 active.
324 d1.set_activate(true); 321 d1.set_activate(true);
325 w2.reset(); 322 w2.reset();
326 EXPECT_EQ(0, d2.activated_count()); 323 EXPECT_EQ(0, d2.activated_count());
327 EXPECT_EQ(1, d2.lost_active_count()); 324 EXPECT_EQ(1, d2.lost_active_count());
328 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); 325 EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
329 EXPECT_EQ(w1.get(), focus_client->GetFocusedWindow()); 326 EXPECT_EQ(w1.get(), focus_client->GetFocusedWindow());
330 EXPECT_EQ(1, d1.activated_count()); 327 EXPECT_EQ(1, d1.activated_count());
331 EXPECT_EQ(0, d1.lost_active_count()); 328 EXPECT_EQ(0, d1.lost_active_count());
332 329
333 // Clicking an active window with a child shouldn't steal the 330 // Clicking an active window with a child shouldn't steal the
334 // focus from the child. 331 // focus from the child.
335 { 332 {
336 scoped_ptr<aura::Window> w11(CreateTestWindowWithDelegate( 333 scoped_ptr<aura::Window> w11(CreateTestWindowWithDelegate(
337 &wd, -11, gfx::Rect(10, 10, 10, 10), w1.get())); 334 &wd, -11, gfx::Rect(10, 10, 10, 10), w1.get()));
338 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), 335 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
339 w11.get()); 336 w11.get());
340 // First set the focus to the child |w11|. 337 // First set the focus to the child |w11|.
341 generator.ClickLeftButton(); 338 generator.ClickLeftButton();
342 EXPECT_EQ(w11.get(), focus_client->GetFocusedWindow()); 339 EXPECT_EQ(w11.get(), focus_client->GetFocusedWindow());
343 EXPECT_EQ(w1.get(), wm::GetActiveWindow()); 340 EXPECT_EQ(w1.get(), wm::GetActiveWindow());
344 341
345 // Then click the parent active window. The focus shouldn't move. 342 // Then click the parent active window. The focus shouldn't move.
346 gfx::Point left_top = w1->bounds().origin(); 343 gfx::Point left_top = w1->bounds().origin();
347 aura::Window::ConvertPointToTarget(w1->parent(), root_window, &left_top); 344 aura::Window::ConvertPointToTarget(w1->parent(), root_window, &left_top);
348 left_top.Offset(1, 1); 345 left_top.Offset(1, 1);
349 generator.MoveMouseTo(left_top); 346 generator.MoveMouseTo(left_top);
350 generator.ClickLeftButton(); 347 generator.ClickLeftButton();
351 EXPECT_EQ(w11.get(), focus_client->GetFocusedWindow()); 348 EXPECT_EQ(w11.get(), focus_client->GetFocusedWindow());
352 EXPECT_EQ(w1.get(), wm::GetActiveWindow()); 349 EXPECT_EQ(w1.get(), wm::GetActiveWindow());
353 } 350 }
354 351
355 // Clicking on a non-focusable window inside a background window should still 352 // Clicking on a non-focusable window inside a background window should still
356 // give focus to the background window. 353 // give focus to the background window.
357 { 354 {
358 NonFocusableDelegate nfd; 355 NonFocusableDelegate nfd;
359 scoped_ptr<aura::Window> w11(CreateTestWindowWithDelegate( 356 scoped_ptr<aura::Window> w11(CreateTestWindowWithDelegate(
360 &nfd, -1, gfx::Rect(10, 10, 10, 10), w1.get())); 357 &nfd, -1, gfx::Rect(10, 10, 10, 10), w1.get()));
361 // Move focus to |w2| first. 358 // Move focus to |w2| first.
362 scoped_ptr<aura::Window> w2(CreateTestWindowInShellWithDelegate( 359 scoped_ptr<aura::Window> w2(CreateTestWindowInShellWithDelegate(
363 &wd, -1, gfx::Rect(70, 70, 50, 50))); 360 &wd, -1, gfx::Rect(70, 70, 50, 50)));
364 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), 361 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), w2.get());
365 w2.get());
366 generator.ClickLeftButton(); 362 generator.ClickLeftButton();
367 EXPECT_EQ(w2.get(), focus_client->GetFocusedWindow()); 363 EXPECT_EQ(w2.get(), focus_client->GetFocusedWindow());
368 EXPECT_FALSE(w11->CanFocus()); 364 EXPECT_FALSE(w11->CanFocus());
369 365
370 // Click on |w11|. This should focus w1. 366 // Click on |w11|. This should focus w1.
371 generator.MoveMouseToCenterOf(w11.get()); 367 generator.MoveMouseToCenterOf(w11.get());
372 generator.ClickLeftButton(); 368 generator.ClickLeftButton();
373 EXPECT_EQ(w1.get(), focus_client->GetFocusedWindow()); 369 EXPECT_EQ(w1.get(), focus_client->GetFocusedWindow());
374 } 370 }
375 } 371 }
(...skipping 20 matching lines...) Expand all
396 // Activate w1. 392 // Activate w1.
397 wm::ActivateWindow(w1.get()); 393 wm::ActivateWindow(w1.get());
398 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); 394 EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
399 EXPECT_EQ(w1.get(), focus_client->GetFocusedWindow()); 395 EXPECT_EQ(w1.get(), focus_client->GetFocusedWindow());
400 396
401 // Clicking on a non-activatable window should not change the active window. 397 // Clicking on a non-activatable window should not change the active window.
402 { 398 {
403 NonFocusableDelegate nfd; 399 NonFocusableDelegate nfd;
404 scoped_ptr<aura::Window> w3(CreateTestWindowInShellWithDelegate( 400 scoped_ptr<aura::Window> w3(CreateTestWindowInShellWithDelegate(
405 &nfd, -1, gfx::Rect(70, 70, 50, 50))); 401 &nfd, -1, gfx::Rect(70, 70, 50, 50)));
406 aura::test::EventGenerator generator3(Shell::GetPrimaryRootWindow(), 402 ui::test::EventGenerator generator3(Shell::GetPrimaryRootWindow(),
407 w3.get()); 403 w3.get());
408 wm::ActivateWindow(p1.get()); 404 wm::ActivateWindow(p1.get());
409 EXPECT_TRUE(wm::IsActiveWindow(p1.get())); 405 EXPECT_TRUE(wm::IsActiveWindow(p1.get()));
410 generator3.ClickLeftButton(); 406 generator3.ClickLeftButton();
411 EXPECT_TRUE(wm::IsActiveWindow(p1.get())); 407 EXPECT_TRUE(wm::IsActiveWindow(p1.get()));
412 } 408 }
413 } 409 }
414 410
415 // Essentially the same as ActivateOnMouse, but for touch events. 411 // Essentially the same as ActivateOnMouse, but for touch events.
416 TEST_F(WindowManagerTest, ActivateOnTouch) { 412 TEST_F(WindowManagerTest, ActivateOnTouch) {
417 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 413 aura::Window* root_window = Shell::GetPrimaryRootWindow();
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 EXPECT_EQ(0, f1->num_mouse_events()); 720 EXPECT_EQ(0, f1->num_mouse_events());
725 EXPECT_EQ(1, f2->num_key_events()); 721 EXPECT_EQ(1, f2->num_key_events());
726 EXPECT_EQ(1, f2->num_mouse_events()); 722 EXPECT_EQ(1, f2->num_mouse_events());
727 723
728 env_filter->RemoveHandler(f2.get()); 724 env_filter->RemoveHandler(f2.get());
729 } 725 }
730 726
731 #if defined(OS_CHROMEOS) || defined(OS_WIN) 727 #if defined(OS_CHROMEOS) || defined(OS_WIN)
732 // Touch visually hides the cursor on ChromeOS and Windows 728 // Touch visually hides the cursor on ChromeOS and Windows
733 TEST_F(WindowManagerTest, UpdateCursorVisibility) { 729 TEST_F(WindowManagerTest, UpdateCursorVisibility) {
734 aura::test::EventGenerator& generator = GetEventGenerator(); 730 ui::test::EventGenerator& generator = GetEventGenerator();
735 ::wm::CursorManager* cursor_manager = 731 ::wm::CursorManager* cursor_manager =
736 ash::Shell::GetInstance()->cursor_manager(); 732 ash::Shell::GetInstance()->cursor_manager();
737 733
738 generator.MoveMouseTo(gfx::Point(0, 0)); 734 generator.MoveMouseTo(gfx::Point(0, 0));
739 EXPECT_TRUE(cursor_manager->IsCursorVisible()); 735 EXPECT_TRUE(cursor_manager->IsCursorVisible());
740 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled()); 736 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
741 generator.PressTouch(); 737 generator.PressTouch();
742 EXPECT_FALSE(cursor_manager->IsCursorVisible()); 738 EXPECT_FALSE(cursor_manager->IsCursorVisible());
743 EXPECT_FALSE(cursor_manager->IsMouseEventsEnabled()); 739 EXPECT_FALSE(cursor_manager->IsMouseEventsEnabled());
744 generator.MoveMouseTo(gfx::Point(0, 0)); 740 generator.MoveMouseTo(gfx::Point(0, 0));
745 EXPECT_TRUE(cursor_manager->IsCursorVisible()); 741 EXPECT_TRUE(cursor_manager->IsCursorVisible());
746 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled()); 742 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
747 generator.ReleaseTouch(); 743 generator.ReleaseTouch();
748 EXPECT_TRUE(cursor_manager->IsCursorVisible()); 744 EXPECT_TRUE(cursor_manager->IsCursorVisible());
749 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled()); 745 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
750 } 746 }
751 #endif // defined(OS_CHROMEOS) || defined(OS_WIN) 747 #endif // defined(OS_CHROMEOS) || defined(OS_WIN)
752 748
753 #if defined(OS_CHROMEOS) 749 #if defined(OS_CHROMEOS)
754 // ChromeOS is the only platform for which the cursor is hidden on keypress 750 // ChromeOS is the only platform for which the cursor is hidden on keypress
755 // (crbug.com/304296). 751 // (crbug.com/304296).
756 TEST_F(WindowManagerTest, UpdateCursorVisibilityOnKeyEvent) { 752 TEST_F(WindowManagerTest, UpdateCursorVisibilityOnKeyEvent) {
757 aura::test::EventGenerator& generator = GetEventGenerator(); 753 ui::test::EventGenerator& generator = GetEventGenerator();
758 ::wm::CursorManager* cursor_manager = 754 ::wm::CursorManager* cursor_manager =
759 ash::Shell::GetInstance()->cursor_manager(); 755 ash::Shell::GetInstance()->cursor_manager();
760 756
761 // Pressing a key hides the cursor but does not disable mouse events. 757 // Pressing a key hides the cursor but does not disable mouse events.
762 generator.PressKey(ui::VKEY_A, ui::EF_NONE); 758 generator.PressKey(ui::VKEY_A, ui::EF_NONE);
763 EXPECT_FALSE(cursor_manager->IsCursorVisible()); 759 EXPECT_FALSE(cursor_manager->IsCursorVisible());
764 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled()); 760 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
765 // Moving mouse shows the cursor. 761 // Moving mouse shows the cursor.
766 generator.MoveMouseTo(gfx::Point(0, 0)); 762 generator.MoveMouseTo(gfx::Point(0, 0));
767 EXPECT_TRUE(cursor_manager->IsCursorVisible()); 763 EXPECT_TRUE(cursor_manager->IsCursorVisible());
768 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled()); 764 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
769 // Releasing a key also hides the cursor but does not disable mouse events. 765 // Releasing a key also hides the cursor but does not disable mouse events.
770 generator.ReleaseKey(ui::VKEY_A, ui::EF_NONE); 766 generator.ReleaseKey(ui::VKEY_A, ui::EF_NONE);
771 EXPECT_FALSE(cursor_manager->IsCursorVisible()); 767 EXPECT_FALSE(cursor_manager->IsCursorVisible());
772 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled()); 768 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
773 // Moving mouse shows the cursor again. 769 // Moving mouse shows the cursor again.
774 generator.MoveMouseTo(gfx::Point(0, 0)); 770 generator.MoveMouseTo(gfx::Point(0, 0));
775 EXPECT_TRUE(cursor_manager->IsCursorVisible()); 771 EXPECT_TRUE(cursor_manager->IsCursorVisible());
776 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled()); 772 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
777 } 773 }
778 774
779 TEST_F(WindowManagerTest, TestCursorClientObserver) { 775 TEST_F(WindowManagerTest, TestCursorClientObserver) {
780 aura::test::EventGenerator& generator = GetEventGenerator(); 776 ui::test::EventGenerator& generator = GetEventGenerator();
781 ::wm::CursorManager* cursor_manager = 777 ::wm::CursorManager* cursor_manager =
782 ash::Shell::GetInstance()->cursor_manager(); 778 ash::Shell::GetInstance()->cursor_manager();
783 779
784 scoped_ptr<aura::Window> w1(CreateTestWindowInShell( 780 scoped_ptr<aura::Window> w1(CreateTestWindowInShell(
785 SK_ColorWHITE, -1, gfx::Rect(0, 0, 100, 100))); 781 SK_ColorWHITE, -1, gfx::Rect(0, 0, 100, 100)));
786 wm::ActivateWindow(w1.get()); 782 wm::ActivateWindow(w1.get());
787 783
788 // Add two observers. Both should have OnCursorVisibilityChanged() 784 // Add two observers. Both should have OnCursorVisibilityChanged()
789 // invoked when an event changes the visibility of the cursor. 785 // invoked when an event changes the visibility of the cursor.
790 TestingCursorClientObserver observer_a; 786 TestingCursorClientObserver observer_a;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 observer_a.reset(); 828 observer_a.reset();
833 observer_b.reset(); 829 observer_b.reset();
834 generator.MoveMouseTo(50, 50); 830 generator.MoveMouseTo(50, 50);
835 EXPECT_TRUE(observer_a.did_visibility_change()); 831 EXPECT_TRUE(observer_a.did_visibility_change());
836 EXPECT_FALSE(observer_b.did_visibility_change()); 832 EXPECT_FALSE(observer_b.did_visibility_change());
837 EXPECT_TRUE(observer_a.is_cursor_visible()); 833 EXPECT_TRUE(observer_a.is_cursor_visible());
838 } 834 }
839 #endif // defined(OS_CHROMEOS) 835 #endif // defined(OS_CHROMEOS)
840 836
841 } // namespace ash 837 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698