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

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

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

Powered by Google App Engine
This is Rietveld 408576698