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

Side by Side Diff: trunk/src/chrome/browser/notifications/desktop_notifications_unittest.cc

Issue 14631021: Revert 199625 "Remove ENABLE_MESSAGE_CENTER" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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 "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/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/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/testing_browser_process.h" 14 #include "chrome/test/base/testing_browser_process.h"
15 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
16 #include "chrome/test/base/testing_profile_manager.h" 16 #include "chrome/test/base/testing_profile_manager.h"
17 #include "content/public/common/show_desktop_notification_params.h" 17 #include "content/public/common/show_desktop_notification_params.h"
18
19 #if defined(ENABLE_MESSAGE_CENTER)
18 #include "ui/message_center/message_center.h" 20 #include "ui/message_center/message_center.h"
21 #endif
19 22
20 #if defined(USE_ASH) 23 #if defined(USE_ASH)
21 #include "ash/shell.h" 24 #include "ash/shell.h"
22 #include "ash/test/test_shell_delegate.h" 25 #include "ash/test/test_shell_delegate.h"
23 #include "chrome/browser/ui/aura/active_desktop_monitor.h" 26 #include "chrome/browser/ui/aura/active_desktop_monitor.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
25 #include "ui/aura/env.h" 28 #include "ui/aura/env.h"
26 #include "ui/aura/root_window.h" 29 #include "ui/aura/root_window.h"
27 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 30 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
28 #endif 31 #endif
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 109
107 void DesktopNotificationsTest::SetUp() { 110 void DesktopNotificationsTest::SetUp() {
108 #if defined(OS_WIN) 111 #if defined(OS_WIN)
109 if (base::win::IsTSFAwareRequired()) 112 if (base::win::IsTSFAwareRequired())
110 ui::TSFBridge::Initialize(); 113 ui::TSFBridge::Initialize();
111 #endif 114 #endif
112 #if defined(USE_ASH) 115 #if defined(USE_ASH)
113 WebKit::initialize(webkit_platform_support_.Get()); 116 WebKit::initialize(webkit_platform_support_.Get());
114 ui::ScopedAnimationDurationScaleMode normal_duration_mode( 117 ui::ScopedAnimationDurationScaleMode normal_duration_mode(
115 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); 118 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION);
119 #if defined(ENABLE_MESSAGE_CENTER)
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();
123 #endif
119 // MockBalloonCollection retrieves information about the screen on creation. 124 // MockBalloonCollection retrieves information about the screen on creation.
120 // So it is necessary to make sure the desktop gets created first. 125 // So it is necessary to make sure the desktop gets created first.
121 ash::Shell::CreateInstance(new ash::test::TestShellDelegate); 126 ash::Shell::CreateInstance(new ash::test::TestShellDelegate);
122 active_desktop_monitor_.reset(new ActiveDesktopMonitor); 127 active_desktop_monitor_.reset(new ActiveDesktopMonitor);
123 #endif 128 #endif
124 129
125 chrome::RegisterLocalState(local_state_.registry()); 130 chrome::RegisterLocalState(local_state_.registry());
126 profile_.reset(new TestingProfile()); 131 profile_.reset(new TestingProfile());
127 ui_manager_.reset(new BalloonNotificationUIManager(&local_state_)); 132 ui_manager_.reset(new BalloonNotificationUIManager(&local_state_));
128 balloon_collection_ = new MockBalloonCollection(); 133 balloon_collection_ = new MockBalloonCollection();
129 ui_manager_->SetBalloonCollection(balloon_collection_); 134 ui_manager_->SetBalloonCollection(balloon_collection_);
130 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get())); 135 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get()));
131 log_output_.clear(); 136 log_output_.clear();
132 } 137 }
133 138
134 void DesktopNotificationsTest::TearDown() { 139 void DesktopNotificationsTest::TearDown() {
135 service_.reset(NULL); 140 service_.reset(NULL);
136 ui_manager_.reset(NULL); 141 ui_manager_.reset(NULL);
137 profile_.reset(NULL); 142 profile_.reset(NULL);
138 #if defined(USE_ASH) 143 #if defined(USE_ASH)
139 active_desktop_monitor_.reset(); 144 active_desktop_monitor_.reset();
140 ash::Shell::DeleteInstance(); 145 ash::Shell::DeleteInstance();
146 #if defined(ENABLE_MESSAGE_CENTER)
141 // The message center is notmally shutdown on |g_browser_process| which 147 // The message center is notmally shutdown on |g_browser_process| which
142 // is not created for these tests. 148 // is not created for these tests.
143 message_center::MessageCenter::Shutdown(); 149 message_center::MessageCenter::Shutdown();
150 #endif
144 aura::Env::DeleteInstance(); 151 aura::Env::DeleteInstance();
145 WebKit::shutdown(); 152 WebKit::shutdown();
146 #endif 153 #endif
147 } 154 }
148 155
149 content::ShowDesktopNotificationHostMsgParams 156 content::ShowDesktopNotificationHostMsgParams
150 DesktopNotificationsTest::StandardTestNotification() { 157 DesktopNotificationsTest::StandardTestNotification() {
151 content::ShowDesktopNotificationHostMsgParams params; 158 content::ShowDesktopNotificationHostMsgParams params;
152 params.notification_id = 0; 159 params.notification_id = 0;
153 params.origin = GURL("http://www.google.com"); 160 params.origin = GURL("http://www.google.com");
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 } 580 }
574 581
575 // Now change the position to upper left. Confirm that the X value for the 582 // Now change the position to upper left. Confirm that the X value for the
576 // balloons gets smaller. 583 // balloons gets smaller.
577 local_state_.SetInteger(prefs::kDesktopNotificationPosition, 584 local_state_.SetInteger(prefs::kDesktopNotificationPosition,
578 BalloonCollection::UPPER_LEFT); 585 BalloonCollection::UPPER_LEFT);
579 586
580 int current_x = (*balloons.begin())->GetPosition().x(); 587 int current_x = (*balloons.begin())->GetPosition().x();
581 EXPECT_LT(current_x, last_x); 588 EXPECT_LT(current_x, last_x);
582 } 589 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698