OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/prefs/testing_pref_service.h" | 6 #include "base/prefs/testing_pref_service.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 return (MessageCenterNotificationManager*) | 93 return (MessageCenterNotificationManager*) |
94 g_browser_process->notification_ui_manager(); | 94 g_browser_process->notification_ui_manager(); |
95 } | 95 } |
96 | 96 |
97 FakeMessageCenterTrayDelegate* delegate() { return delegate_; } | 97 FakeMessageCenterTrayDelegate* delegate() { return delegate_; } |
98 | 98 |
99 MessageCenter* message_center() { return message_center_; } | 99 MessageCenter* message_center() { return message_center_; } |
100 | 100 |
101 const ::Notification GetANotification(const std::string& id) { | 101 const ::Notification GetANotification(const std::string& id) { |
102 return ::Notification( | 102 return ::Notification( |
| 103 message_center::NOTIFICATION_TYPE_SIMPLE, |
103 GURL("chrome-extension://adflkjsdflkdsfdsflkjdsflkdjfs"), | 104 GURL("chrome-extension://adflkjsdflkdsfdsflkjdsflkdjfs"), |
104 gfx::Image(), | |
105 base::string16(), | 105 base::string16(), |
106 base::string16(), | 106 base::string16(), |
| 107 gfx::Image(), |
107 blink::WebTextDirectionDefault, | 108 blink::WebTextDirectionDefault, |
| 109 message_center::NotifierId(), |
108 base::string16(), | 110 base::string16(), |
109 base::UTF8ToUTF16(id), | 111 base::UTF8ToUTF16(id), |
| 112 message_center::RichNotificationData(), |
110 new MockNotificationDelegate(id)); | 113 new MockNotificationDelegate(id)); |
111 } | 114 } |
112 | 115 |
113 base::RunLoop* run_loop() { return run_loop_.get(); } | 116 base::RunLoop* run_loop() { return run_loop_.get(); } |
114 PrefService* local_state() { | 117 PrefService* local_state() { |
115 return TestingBrowserProcess::GetGlobal()->local_state(); | 118 return TestingBrowserProcess::GetGlobal()->local_state(); |
116 } | 119 } |
117 bool DidFirstRunPref() { return first_run_pref_->GetValue(); } | 120 bool DidFirstRunPref() { return first_run_pref_->GetValue(); } |
118 | 121 |
119 private: | 122 private: |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 TestingProfile profile; | 200 TestingProfile profile; |
198 notification_manager()->Add(GetANotification("test"), &profile); | 201 notification_manager()->Add(GetANotification("test"), &profile); |
199 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); | 202 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); |
200 run_loop()->RunUntilIdle(); | 203 run_loop()->RunUntilIdle(); |
201 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); | 204 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); |
202 EXPECT_FALSE(DidFirstRunPref()); | 205 EXPECT_FALSE(DidFirstRunPref()); |
203 } | 206 } |
204 | 207 |
205 #endif | 208 #endif |
206 } // namespace message_center | 209 } // namespace message_center |
OLD | NEW |