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/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" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 | 85 |
86 DesktopNotificationsTest::DesktopNotificationsTest() | 86 DesktopNotificationsTest::DesktopNotificationsTest() |
87 : ui_thread_(BrowserThread::UI, &message_loop_) { | 87 : ui_thread_(BrowserThread::UI, &message_loop_) { |
88 } | 88 } |
89 | 89 |
90 DesktopNotificationsTest::~DesktopNotificationsTest() { | 90 DesktopNotificationsTest::~DesktopNotificationsTest() { |
91 } | 91 } |
92 | 92 |
93 void DesktopNotificationsTest::SetUp() { | 93 void DesktopNotificationsTest::SetUp() { |
94 #if defined(USE_AURA) | 94 #if defined(USE_ASH) |
95 WebKit::initialize(&webkit_platform_support_); | 95 WebKit::initialize(&webkit_platform_support_); |
96 // MockBalloonCollection retrieves information about the screen on creation. | 96 // MockBalloonCollection retrieves information about the screen on creation. |
97 // So it is necessary to make sure the desktop gets created first. | 97 // So it is necessary to make sure the desktop gets created first. |
98 ash::Shell::GetRootWindow(); | 98 ash::Shell::CreateInstance(NULL); |
99 #endif | 99 #endif |
100 | 100 |
101 browser::RegisterLocalState(&local_state_); | 101 browser::RegisterLocalState(&local_state_); |
102 profile_.reset(new TestingProfile()); | 102 profile_.reset(new TestingProfile()); |
103 balloon_collection_ = new MockBalloonCollection(); | 103 balloon_collection_ = new MockBalloonCollection(); |
104 ui_manager_.reset(NotificationUIManager::Create(&local_state_, | 104 ui_manager_.reset(NotificationUIManager::Create(&local_state_, |
105 balloon_collection_)); | 105 balloon_collection_)); |
106 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get())); | 106 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get())); |
107 log_output_.clear(); | 107 log_output_.clear(); |
108 } | 108 } |
109 | 109 |
110 void DesktopNotificationsTest::TearDown() { | 110 void DesktopNotificationsTest::TearDown() { |
111 service_.reset(NULL); | 111 service_.reset(NULL); |
112 ui_manager_.reset(NULL); | 112 ui_manager_.reset(NULL); |
113 profile_.reset(NULL); | 113 profile_.reset(NULL); |
114 #if defined(USE_AURA) | 114 #if defined(USE_ASH) |
115 aura::RootWindow::DeleteInstance(); | 115 ash::Shell::DeleteInstance(); |
116 aura::Env::DeleteInstance(); | 116 aura::Env::DeleteInstance(); |
117 WebKit::shutdown(); | 117 WebKit::shutdown(); |
118 #endif | 118 #endif |
119 } | 119 } |
120 | 120 |
121 content::ShowDesktopNotificationHostMsgParams | 121 content::ShowDesktopNotificationHostMsgParams |
122 DesktopNotificationsTest::StandardTestNotification() { | 122 DesktopNotificationsTest::StandardTestNotification() { |
123 content::ShowDesktopNotificationHostMsgParams params; | 123 content::ShowDesktopNotificationHostMsgParams params; |
124 params.notification_id = 0; | 124 params.notification_id = 0; |
125 params.origin = GURL("http://www.google.com"); | 125 params.origin = GURL("http://www.google.com"); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 } | 465 } |
466 | 466 |
467 // Now change the position to upper left. Confirm that the X value for the | 467 // Now change the position to upper left. Confirm that the X value for the |
468 // balloons gets smaller. | 468 // balloons gets smaller. |
469 local_state_.SetInteger(prefs::kDesktopNotificationPosition, | 469 local_state_.SetInteger(prefs::kDesktopNotificationPosition, |
470 BalloonCollection::UPPER_LEFT); | 470 BalloonCollection::UPPER_LEFT); |
471 | 471 |
472 int current_x = (*balloons.begin())->GetPosition().x(); | 472 int current_x = (*balloons.begin())->GetPosition().x(); |
473 EXPECT_LT(current_x, last_x); | 473 EXPECT_LT(current_x, last_x); |
474 } | 474 } |
OLD | NEW |