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 "chrome/browser/notifications/desktop_notifications_unittest.h" | 5 #include "chrome/browser/notifications/desktop_notifications_unittest.h" |
6 | 6 |
7 #include "base/prefs/testing_pref_service.h" | 7 #include "base/prefs/testing_pref_service.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" | 10 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" |
11 #include "chrome/browser/notifications/fake_balloon_view.h" | 11 #include "chrome/browser/notifications/fake_balloon_view.h" |
12 #include "chrome/browser/prefs/browser_prefs.h" | 12 #include "chrome/browser/prefs/browser_prefs.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/test/base/chrome_unit_test_suite.h" |
14 #include "chrome/test/base/testing_browser_process.h" | 15 #include "chrome/test/base/testing_browser_process.h" |
15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
16 #include "chrome/test/base/testing_profile_manager.h" | 17 #include "chrome/test/base/testing_profile_manager.h" |
17 #include "content/public/common/show_desktop_notification_params.h" | 18 #include "content/public/common/show_desktop_notification_params.h" |
18 #include "ui/base/ime/input_method_initializer.h" | 19 #include "ui/base/ime/input_method_initializer.h" |
| 20 #include "ui/gl/gl_surface.h" |
19 #include "ui/message_center/message_center.h" | 21 #include "ui/message_center/message_center.h" |
20 | 22 |
21 #if defined(USE_ASH) | 23 #if defined(USE_ASH) |
22 #include "ash/shell.h" | 24 #include "ash/shell.h" |
23 #include "ash/test/test_shell_delegate.h" | 25 #include "ash/test/test_shell_delegate.h" |
24 #include "ui/aura/env.h" | 26 #include "ui/aura/env.h" |
25 #include "ui/aura/window_event_dispatcher.h" | 27 #include "ui/aura/window_event_dispatcher.h" |
26 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 28 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
27 #include "ui/compositor/test/context_factories_for_test.h" | 29 #include "ui/compositor/test/context_factories_for_test.h" |
28 #endif | 30 #endif |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 101 |
100 DesktopNotificationsTest::DesktopNotificationsTest() | 102 DesktopNotificationsTest::DesktopNotificationsTest() |
101 : ui_thread_(BrowserThread::UI, &message_loop_), | 103 : ui_thread_(BrowserThread::UI, &message_loop_), |
102 balloon_collection_(NULL) { | 104 balloon_collection_(NULL) { |
103 } | 105 } |
104 | 106 |
105 DesktopNotificationsTest::~DesktopNotificationsTest() { | 107 DesktopNotificationsTest::~DesktopNotificationsTest() { |
106 } | 108 } |
107 | 109 |
108 void DesktopNotificationsTest::SetUp() { | 110 void DesktopNotificationsTest::SetUp() { |
| 111 ChromeUnitTestSuite::InitializeProviders(); |
| 112 ChromeUnitTestSuite::InitializeResourceBundle(); |
109 ui::InitializeInputMethodForTesting(); | 113 ui::InitializeInputMethodForTesting(); |
110 #if defined(USE_AURA) | 114 #if defined(USE_AURA) |
111 wm_state_.reset(new wm::WMState); | 115 wm_state_.reset(new wm::WMState); |
112 #endif | 116 #endif |
113 #if defined(USE_ASH) | 117 #if defined(USE_ASH) |
114 ui::ScopedAnimationDurationScaleMode normal_duration_mode( | 118 ui::ScopedAnimationDurationScaleMode normal_duration_mode( |
115 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); | 119 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); |
116 // The message center is notmally initialized on |g_browser_process| which | 120 // The message center is notmally initialized on |g_browser_process| which |
117 // is not created for these tests. | 121 // is not created for these tests. |
118 message_center::MessageCenter::Initialize(); | 122 message_center::MessageCenter::Initialize(); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 } | 579 } |
576 | 580 |
577 // Now change the position to upper left. Confirm that the X value for the | 581 // Now change the position to upper left. Confirm that the X value for the |
578 // balloons gets smaller. | 582 // balloons gets smaller. |
579 local_state_.SetInteger(prefs::kDesktopNotificationPosition, | 583 local_state_.SetInteger(prefs::kDesktopNotificationPosition, |
580 BalloonCollection::UPPER_LEFT); | 584 BalloonCollection::UPPER_LEFT); |
581 | 585 |
582 int current_x = (*balloons.begin())->GetPosition().x(); | 586 int current_x = (*balloons.begin())->GetPosition().x(); |
583 EXPECT_LT(current_x, last_x); | 587 EXPECT_LT(current_x, last_x); |
584 } | 588 } |
OLD | NEW |