OLD | NEW |
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/system/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/accessibility_delegate.h" | 9 #include "ash/accessibility_delegate.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
11 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf_layout_manager.h" |
12 #include "ash/shelf/shelf_widget.h" | 12 #include "ash/shelf/shelf_widget.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "ash/system/status_area_widget.h" | 14 #include "ash/system/status_area_widget.h" |
15 #include "ash/system/tray/system_tray_item.h" | 15 #include "ash/system/tray/system_tray_item.h" |
16 #include "ash/system/tray/tray_constants.h" | 16 #include "ash/system/tray/tray_constants.h" |
17 #include "ash/test/ash_test_base.h" | 17 #include "ash/test/ash_test_base.h" |
18 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "ui/aura/test/event_generator.h" | |
22 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
23 #include "ui/base/ui_base_types.h" | 22 #include "ui/base/ui_base_types.h" |
24 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 23 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 24 #include "ui/events/test/event_generator.h" |
25 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
26 #include "ui/views/controls/label.h" | 26 #include "ui/views/controls/label.h" |
27 #include "ui/views/layout/fill_layout.h" | 27 #include "ui/views/layout/fill_layout.h" |
28 #include "ui/views/view.h" | 28 #include "ui/views/view.h" |
29 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
30 #include "ui/views/widget/widget_delegate.h" | 30 #include "ui/views/widget/widget_delegate.h" |
31 | 31 |
32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
33 #include "base/win/windows_version.h" | 33 #include "base/win/windows_version.h" |
34 #endif | 34 #endif |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 // Activating window. | 410 // Activating window. |
411 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 411 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
412 ASSERT_TRUE(tray->HasSystemBubble()); | 412 ASSERT_TRUE(tray->HasSystemBubble()); |
413 wm::ActivateWindow(window.get()); | 413 wm::ActivateWindow(window.get()); |
414 base::RunLoop().RunUntilIdle(); | 414 base::RunLoop().RunUntilIdle(); |
415 ASSERT_FALSE(tray->HasSystemBubble()); | 415 ASSERT_FALSE(tray->HasSystemBubble()); |
416 | 416 |
417 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 417 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
418 ASSERT_TRUE(tray->HasSystemBubble()); | 418 ASSERT_TRUE(tray->HasSystemBubble()); |
419 { | 419 { |
420 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 420 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
421 gfx::Point(5, 5)); | 421 gfx::Point(5, 5)); |
422 generator.ClickLeftButton(); | 422 generator.ClickLeftButton(); |
423 ASSERT_FALSE(tray->HasSystemBubble()); | 423 ASSERT_FALSE(tray->HasSystemBubble()); |
424 } | 424 } |
425 | 425 |
426 // Same tests for persistent default view. | 426 // Same tests for persistent default view. |
427 tray->ShowPersistentDefaultView(); | 427 tray->ShowPersistentDefaultView(); |
428 ASSERT_TRUE(tray->HasSystemBubble()); | 428 ASSERT_TRUE(tray->HasSystemBubble()); |
429 wm::ActivateWindow(window.get()); | 429 wm::ActivateWindow(window.get()); |
430 base::RunLoop().RunUntilIdle(); | 430 base::RunLoop().RunUntilIdle(); |
431 ASSERT_TRUE(tray->HasSystemBubble()); | 431 ASSERT_TRUE(tray->HasSystemBubble()); |
432 | 432 |
433 { | 433 { |
434 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 434 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
435 gfx::Point(5, 5)); | 435 gfx::Point(5, 5)); |
436 generator.ClickLeftButton(); | 436 generator.ClickLeftButton(); |
437 ASSERT_TRUE(tray->HasSystemBubble()); | 437 ASSERT_TRUE(tray->HasSystemBubble()); |
438 } | 438 } |
439 } | 439 } |
440 | 440 |
441 #if defined(OS_CHROMEOS) | 441 #if defined(OS_CHROMEOS) |
442 // Accessibility/Settings tray items are available only on cros. | 442 // Accessibility/Settings tray items are available only on cros. |
443 #define MAYBE_WithSystemModal WithSystemModal | 443 #define MAYBE_WithSystemModal WithSystemModal |
444 #else | 444 #else |
445 #define MAYBE_WithSystemModal DISABLED_WithSystemModal | 445 #define MAYBE_WithSystemModal DISABLED_WithSystemModal |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 500 |
501 tray->SetVisible(true); | 501 tray->SetVisible(true); |
502 animation_duration.reset(); | 502 animation_duration.reset(); |
503 tray->layer()->GetAnimator()->StopAnimating(); | 503 tray->layer()->GetAnimator()->StopAnimating(); |
504 EXPECT_TRUE(tray->visible()); | 504 EXPECT_TRUE(tray->visible()); |
505 EXPECT_EQ(1.0f, tray->layer()->GetTargetOpacity()); | 505 EXPECT_EQ(1.0f, tray->layer()->GetTargetOpacity()); |
506 } | 506 } |
507 | 507 |
508 } // namespace test | 508 } // namespace test |
509 } // namespace ash | 509 } // namespace ash |
OLD | NEW |