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/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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #if defined(USE_ASH) | 23 #if defined(USE_ASH) |
24 #include "ash/shell.h" | 24 #include "ash/shell.h" |
25 #include "ash/test/test_shell_delegate.h" | 25 #include "ash/test/test_shell_delegate.h" |
26 #include "chrome/browser/ui/aura/active_desktop_monitor.h" | 26 #include "chrome/browser/ui/aura/active_desktop_monitor.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
28 #include "ui/aura/env.h" | 28 #include "ui/aura/env.h" |
29 #include "ui/aura/root_window.h" | 29 #include "ui/aura/root_window.h" |
30 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 30 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
31 #endif | 31 #endif |
32 | 32 |
| 33 #if defined(OS_WIN) |
| 34 #include "base/win/metro.h" |
| 35 #include "ui/base/ime/win/tsf_bridge.h" |
| 36 #endif |
| 37 |
33 using content::BrowserThread; | 38 using content::BrowserThread; |
34 | 39 |
35 // static | 40 // static |
36 const int MockBalloonCollection::kMockBalloonSpace = 5; | 41 const int MockBalloonCollection::kMockBalloonSpace = 5; |
37 | 42 |
38 // static | 43 // static |
39 std::string DesktopNotificationsTest::log_output_; | 44 std::string DesktopNotificationsTest::log_output_; |
40 | 45 |
41 MockBalloonCollection::MockBalloonCollection() {} | 46 MockBalloonCollection::MockBalloonCollection() {} |
42 | 47 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 101 } |
97 | 102 |
98 DesktopNotificationsTest::DesktopNotificationsTest() | 103 DesktopNotificationsTest::DesktopNotificationsTest() |
99 : ui_thread_(BrowserThread::UI, &message_loop_) { | 104 : ui_thread_(BrowserThread::UI, &message_loop_) { |
100 } | 105 } |
101 | 106 |
102 DesktopNotificationsTest::~DesktopNotificationsTest() { | 107 DesktopNotificationsTest::~DesktopNotificationsTest() { |
103 } | 108 } |
104 | 109 |
105 void DesktopNotificationsTest::SetUp() { | 110 void DesktopNotificationsTest::SetUp() { |
| 111 #if defined(OS_WIN) |
| 112 if (base::win::IsTSFAwareRequired()) |
| 113 ui::TSFBridge::Initialize(); |
| 114 #endif |
106 #if defined(USE_ASH) | 115 #if defined(USE_ASH) |
107 WebKit::initialize(webkit_platform_support_.Get()); | 116 WebKit::initialize(webkit_platform_support_.Get()); |
108 ui::ScopedAnimationDurationScaleMode normal_duration_mode( | 117 ui::ScopedAnimationDurationScaleMode normal_duration_mode( |
109 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); | 118 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); |
110 #if defined(ENABLE_MESSAGE_CENTER) | 119 #if defined(ENABLE_MESSAGE_CENTER) |
111 // The message center is notmally initialized on |g_browser_process| which | 120 // The message center is notmally initialized on |g_browser_process| which |
112 // is not created for these tests. | 121 // is not created for these tests. |
113 message_center::MessageCenter::Initialize(); | 122 message_center::MessageCenter::Initialize(); |
114 #endif | 123 #endif |
115 // MockBalloonCollection retrieves information about the screen on creation. | 124 // MockBalloonCollection retrieves information about the screen on creation. |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 } | 580 } |
572 | 581 |
573 // Now change the position to upper left. Confirm that the X value for the | 582 // Now change the position to upper left. Confirm that the X value for the |
574 // balloons gets smaller. | 583 // balloons gets smaller. |
575 local_state_.SetInteger(prefs::kDesktopNotificationPosition, | 584 local_state_.SetInteger(prefs::kDesktopNotificationPosition, |
576 BalloonCollection::UPPER_LEFT); | 585 BalloonCollection::UPPER_LEFT); |
577 | 586 |
578 int current_x = (*balloons.begin())->GetPosition().x(); | 587 int current_x = (*balloons.begin())->GetPosition().x(); |
579 EXPECT_LT(current_x, last_x); | 588 EXPECT_LT(current_x, last_x); |
580 } | 589 } |
OLD | NEW |