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" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 DesktopNotificationsTest::DesktopNotificationsTest() | 100 DesktopNotificationsTest::DesktopNotificationsTest() |
101 : ui_thread_(BrowserThread::UI, &message_loop_), | 101 : ui_thread_(BrowserThread::UI, &message_loop_), |
102 balloon_collection_(NULL) { | 102 balloon_collection_(NULL) { |
103 } | 103 } |
104 | 104 |
105 DesktopNotificationsTest::~DesktopNotificationsTest() { | 105 DesktopNotificationsTest::~DesktopNotificationsTest() { |
106 } | 106 } |
107 | 107 |
108 void DesktopNotificationsTest::SetUp() { | 108 void DesktopNotificationsTest::SetUp() { |
109 ui::InitializeInputMethodForTesting(); | 109 ui::InitializeInputMethodForTesting(); |
110 #if defined(OS_WIN) | |
dewittj
2014/03/03 22:48:55
same here
| |
111 com_initializer_.reset(new base::win::ScopedCOMInitializer()); | |
dewittj
2014/03/03 22:48:55
Please add a comment referencing the code that req
| |
112 #endif | |
110 #if defined(USE_AURA) | 113 #if defined(USE_AURA) |
111 wm_state_.reset(new views::corewm::WMState); | 114 wm_state_.reset(new views::corewm::WMState); |
112 #endif | 115 #endif |
113 #if defined(USE_ASH) | 116 #if defined(USE_ASH) |
114 ui::ScopedAnimationDurationScaleMode normal_duration_mode( | 117 ui::ScopedAnimationDurationScaleMode normal_duration_mode( |
115 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); | 118 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); |
116 // The message center is notmally initialized on |g_browser_process| which | 119 // The message center is notmally initialized on |g_browser_process| which |
117 // is not created for these tests. | 120 // is not created for these tests. |
118 message_center::MessageCenter::Initialize(); | 121 message_center::MessageCenter::Initialize(); |
119 // The ContextFactory must exist before any Compositors are created. | 122 // The ContextFactory must exist before any Compositors are created. |
(...skipping 20 matching lines...) Expand all Loading... | |
140 ash::Shell::DeleteInstance(); | 143 ash::Shell::DeleteInstance(); |
141 // The message center is notmally shutdown on |g_browser_process| which | 144 // The message center is notmally shutdown on |g_browser_process| which |
142 // is not created for these tests. | 145 // is not created for these tests. |
143 message_center::MessageCenter::Shutdown(); | 146 message_center::MessageCenter::Shutdown(); |
144 aura::Env::DeleteInstance(); | 147 aura::Env::DeleteInstance(); |
145 ui::TerminateContextFactoryForTests(); | 148 ui::TerminateContextFactoryForTests(); |
146 #endif | 149 #endif |
147 #if defined(USE_AURA) | 150 #if defined(USE_AURA) |
148 wm_state_.reset(); | 151 wm_state_.reset(); |
149 #endif | 152 #endif |
153 #if defined(OS_WIN) | |
dewittj
2014/03/03 22:48:55
Same #define comment here.
| |
154 com_initializer_.reset(); | |
155 #endif | |
150 ui::ShutdownInputMethodForTesting(); | 156 ui::ShutdownInputMethodForTesting(); |
151 } | 157 } |
152 | 158 |
153 content::ShowDesktopNotificationHostMsgParams | 159 content::ShowDesktopNotificationHostMsgParams |
154 DesktopNotificationsTest::StandardTestNotification() { | 160 DesktopNotificationsTest::StandardTestNotification() { |
155 content::ShowDesktopNotificationHostMsgParams params; | 161 content::ShowDesktopNotificationHostMsgParams params; |
156 params.notification_id = 0; | 162 params.notification_id = 0; |
157 params.origin = GURL("http://www.google.com"); | 163 params.origin = GURL("http://www.google.com"); |
158 params.icon_url = GURL("/icon.png"); | 164 params.icon_url = GURL("/icon.png"); |
159 params.title = base::ASCIIToUTF16("Title"); | 165 params.title = base::ASCIIToUTF16("Title"); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
575 } | 581 } |
576 | 582 |
577 // Now change the position to upper left. Confirm that the X value for the | 583 // Now change the position to upper left. Confirm that the X value for the |
578 // balloons gets smaller. | 584 // balloons gets smaller. |
579 local_state_.SetInteger(prefs::kDesktopNotificationPosition, | 585 local_state_.SetInteger(prefs::kDesktopNotificationPosition, |
580 BalloonCollection::UPPER_LEFT); | 586 BalloonCollection::UPPER_LEFT); |
581 | 587 |
582 int current_x = (*balloons.begin())->GetPosition().x(); | 588 int current_x = (*balloons.begin())->GetPosition().x(); |
583 EXPECT_LT(current_x, last_x); | 589 EXPECT_LT(current_x, last_x); |
584 } | 590 } |
OLD | NEW |