| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 #if defined(USE_AURA) | 110 #if defined(USE_AURA) |
| 111 wm_state_.reset(new views::corewm::WMState); | 111 wm_state_.reset(new views::corewm::WMState); |
| 112 #endif | 112 #endif |
| 113 #if defined(USE_ASH) | 113 #if defined(USE_ASH) |
| 114 ui::ScopedAnimationDurationScaleMode normal_duration_mode( | 114 ui::ScopedAnimationDurationScaleMode normal_duration_mode( |
| 115 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); | 115 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); |
| 116 // The message center is notmally initialized on |g_browser_process| which | 116 // The message center is notmally initialized on |g_browser_process| which |
| 117 // is not created for these tests. | 117 // is not created for these tests. |
| 118 message_center::MessageCenter::Initialize(); | 118 message_center::MessageCenter::Initialize(); |
| 119 // The ContextFactory must exist before any Compositors are created. | 119 // The ContextFactory must exist before any Compositors are created. |
| 120 bool allow_test_contexts = true; | 120 bool enable_pixel_output = false; |
| 121 ui::InitializeContextFactoryForTests(allow_test_contexts); | 121 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| 122 // MockBalloonCollection retrieves information about the screen on creation. | 122 // MockBalloonCollection retrieves information about the screen on creation. |
| 123 // So it is necessary to make sure the desktop gets created first. | 123 // So it is necessary to make sure the desktop gets created first. |
| 124 ash::Shell::CreateInstance(new ash::test::TestShellDelegate); | 124 ash::Shell::CreateInstance(new ash::test::TestShellDelegate); |
| 125 #endif | 125 #endif |
| 126 chrome::RegisterLocalState(local_state_.registry()); | 126 chrome::RegisterLocalState(local_state_.registry()); |
| 127 profile_.reset(new TestingProfile()); | 127 profile_.reset(new TestingProfile()); |
| 128 ui_manager_.reset(new BalloonNotificationUIManager(&local_state_)); | 128 ui_manager_.reset(new BalloonNotificationUIManager(&local_state_)); |
| 129 balloon_collection_ = new MockBalloonCollection(); | 129 balloon_collection_ = new MockBalloonCollection(); |
| 130 ui_manager_->SetBalloonCollection(balloon_collection_); | 130 ui_manager_->SetBalloonCollection(balloon_collection_); |
| 131 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get())); | 131 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get())); |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 } | 575 } |
| 576 | 576 |
| 577 // Now change the position to upper left. Confirm that the X value for the | 577 // Now change the position to upper left. Confirm that the X value for the |
| 578 // balloons gets smaller. | 578 // balloons gets smaller. |
| 579 local_state_.SetInteger(prefs::kDesktopNotificationPosition, | 579 local_state_.SetInteger(prefs::kDesktopNotificationPosition, |
| 580 BalloonCollection::UPPER_LEFT); | 580 BalloonCollection::UPPER_LEFT); |
| 581 | 581 |
| 582 int current_x = (*balloons.begin())->GetPosition().x(); | 582 int current_x = (*balloons.begin())->GetPosition().x(); |
| 583 EXPECT_LT(current_x, last_x); | 583 EXPECT_LT(current_x, last_x); |
| 584 } | 584 } |
| OLD | NEW |