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/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" | 9 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" |
10 #include "chrome/browser/notifications/fake_balloon_view.h" | 10 #include "chrome/browser/notifications/fake_balloon_view.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 void DesktopNotificationsTest::SetUp() { | 97 void DesktopNotificationsTest::SetUp() { |
98 #if defined(USE_ASH) | 98 #if defined(USE_ASH) |
99 WebKit::initialize(webkit_platform_support_.Get()); | 99 WebKit::initialize(webkit_platform_support_.Get()); |
100 // MockBalloonCollection retrieves information about the screen on creation. | 100 // MockBalloonCollection retrieves information about the screen on creation. |
101 // So it is necessary to make sure the desktop gets created first. | 101 // So it is necessary to make sure the desktop gets created first. |
102 ash::Shell::CreateInstance(new ash::test::TestShellDelegate); | 102 ash::Shell::CreateInstance(new ash::test::TestShellDelegate); |
103 active_desktop_monitor_.reset(new ActiveDesktopMonitor); | 103 active_desktop_monitor_.reset(new ActiveDesktopMonitor); |
104 #endif | 104 #endif |
105 | 105 |
106 chrome::RegisterLocalState(&local_state_); | 106 chrome::RegisterLocalState(local_state_.registry(), &local_state_); |
107 profile_.reset(new TestingProfile()); | 107 profile_.reset(new TestingProfile()); |
108 ui_manager_.reset(new BalloonNotificationUIManager(&local_state_)); | 108 ui_manager_.reset(new BalloonNotificationUIManager(&local_state_)); |
109 balloon_collection_ = new MockBalloonCollection(); | 109 balloon_collection_ = new MockBalloonCollection(); |
110 ui_manager_->SetBalloonCollection(balloon_collection_); | 110 ui_manager_->SetBalloonCollection(balloon_collection_); |
111 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get())); | 111 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get())); |
112 log_output_.clear(); | 112 log_output_.clear(); |
113 } | 113 } |
114 | 114 |
115 void DesktopNotificationsTest::TearDown() { | 115 void DesktopNotificationsTest::TearDown() { |
116 service_.reset(NULL); | 116 service_.reset(NULL); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 } | 471 } |
472 | 472 |
473 // Now change the position to upper left. Confirm that the X value for the | 473 // Now change the position to upper left. Confirm that the X value for the |
474 // balloons gets smaller. | 474 // balloons gets smaller. |
475 local_state_.SetInteger(prefs::kDesktopNotificationPosition, | 475 local_state_.SetInteger(prefs::kDesktopNotificationPosition, |
476 BalloonCollection::UPPER_LEFT); | 476 BalloonCollection::UPPER_LEFT); |
477 | 477 |
478 int current_x = (*balloons.begin())->GetPosition().x(); | 478 int current_x = (*balloons.begin())->GetPosition().x(); |
479 EXPECT_LT(current_x, last_x); | 479 EXPECT_LT(current_x, last_x); |
480 } | 480 } |
OLD | NEW |