| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/prefs/browser_prefs.h" | 9 #include "chrome/browser/prefs/browser_prefs.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| 11 #include "chrome/test/base/testing_pref_service.h" | 11 #include "chrome/test/base/testing_pref_service.h" |
| 12 #include "content/public/common/show_desktop_notification_params.h" | 12 #include "content/public/common/show_desktop_notification_params.h" |
| 13 | 13 |
| 14 #if defined(USE_AURA) | 14 #if defined(USE_AURA) |
| 15 #include "ui/aura/desktop.h" | 15 #include "ui/aura/root_window.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 using content::BrowserThread; | 18 using content::BrowserThread; |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 const int MockBalloonCollection::kMockBalloonSpace = 5; | 21 const int MockBalloonCollection::kMockBalloonSpace = 5; |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 std::string DesktopNotificationsTest::log_output_; | 24 std::string DesktopNotificationsTest::log_output_; |
| 25 | 25 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 : ui_thread_(BrowserThread::UI, &message_loop_) { | 84 : ui_thread_(BrowserThread::UI, &message_loop_) { |
| 85 } | 85 } |
| 86 | 86 |
| 87 DesktopNotificationsTest::~DesktopNotificationsTest() { | 87 DesktopNotificationsTest::~DesktopNotificationsTest() { |
| 88 } | 88 } |
| 89 | 89 |
| 90 void DesktopNotificationsTest::SetUp() { | 90 void DesktopNotificationsTest::SetUp() { |
| 91 #if defined(USE_AURA) | 91 #if defined(USE_AURA) |
| 92 // MockBalloonCollection retrieves information about the screen on creation. | 92 // MockBalloonCollection retrieves information about the screen on creation. |
| 93 // So it is necessary to make sure the desktop gets created first. | 93 // So it is necessary to make sure the desktop gets created first. |
| 94 aura::Desktop::GetInstance(); | 94 aura::RootWindow::GetInstance(); |
| 95 #endif | 95 #endif |
| 96 | 96 |
| 97 browser::RegisterLocalState(&local_state_); | 97 browser::RegisterLocalState(&local_state_); |
| 98 profile_.reset(new TestingProfile()); | 98 profile_.reset(new TestingProfile()); |
| 99 balloon_collection_ = new MockBalloonCollection(); | 99 balloon_collection_ = new MockBalloonCollection(); |
| 100 ui_manager_.reset(NotificationUIManager::Create(&local_state_, | 100 ui_manager_.reset(NotificationUIManager::Create(&local_state_, |
| 101 balloon_collection_)); | 101 balloon_collection_)); |
| 102 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get())); | 102 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get())); |
| 103 log_output_.clear(); | 103 log_output_.clear(); |
| 104 } | 104 } |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 456 } |
| 457 | 457 |
| 458 // Now change the position to upper left. Confirm that the X value for the | 458 // Now change the position to upper left. Confirm that the X value for the |
| 459 // balloons gets smaller. | 459 // balloons gets smaller. |
| 460 local_state_.SetInteger(prefs::kDesktopNotificationPosition, | 460 local_state_.SetInteger(prefs::kDesktopNotificationPosition, |
| 461 BalloonCollection::UPPER_LEFT); | 461 BalloonCollection::UPPER_LEFT); |
| 462 | 462 |
| 463 int current_x = (*balloons.begin())->GetPosition().x(); | 463 int current_x = (*balloons.begin())->GetPosition().x(); |
| 464 EXPECT_LT(current_x, last_x); | 464 EXPECT_LT(current_x, last_x); |
| 465 } | 465 } |
| OLD | NEW |