Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc

Issue 2891823002: Linux native notifications: Remove spec_version check (Closed)
Patch Set: Remove kMethodGetServerInformation Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/notification_platform_bridge_linux.h" 5 #include "chrome/browser/notifications/notification_platform_bridge_linux.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 ACTION_P(OnGetCapabilities, capabilities) { 170 ACTION_P(OnGetCapabilities, capabilities) {
171 // MockObjectProxy::CallMethodAndBlock will wrap the return value in 171 // MockObjectProxy::CallMethodAndBlock will wrap the return value in
172 // a unique_ptr. 172 // a unique_ptr.
173 dbus::Response* response = dbus::Response::CreateEmpty().release(); 173 dbus::Response* response = dbus::Response::CreateEmpty().release();
174 dbus::MessageWriter writer(response); 174 dbus::MessageWriter writer(response);
175 writer.AppendArrayOfStrings(capabilities); 175 writer.AppendArrayOfStrings(capabilities);
176 return response; 176 return response;
177 } 177 }
178 178
179 ACTION_P(OnGetServerInformation, spec_version) {
180 dbus::Response* response = dbus::Response::CreateEmpty().release();
181 dbus::MessageWriter writer(response);
182 writer.AppendString(""); // name
183 writer.AppendString(""); // vendor
184 writer.AppendString(""); // version
185 writer.AppendString(spec_version);
186 return response;
187 }
188
189 ACTION_P2(OnNotify, verifier, id) { 179 ACTION_P2(OnNotify, verifier, id) {
190 verifier(ParseRequest(arg0)); 180 verifier(ParseRequest(arg0));
191 return GetIdResponse(id); 181 return GetIdResponse(id);
192 } 182 }
193 183
194 ACTION(OnCloseNotification) { 184 ACTION(OnCloseNotification) {
195 // The "CloseNotification" message must have type (u). 185 // The "CloseNotification" message must have type (u).
196 // https://developer.gnome.org/notification-spec/#command-close-notification 186 // https://developer.gnome.org/notification-spec/#command-close-notification
197 dbus::MethodCall* method_call = arg0; 187 dbus::MethodCall* method_call = arg0;
198 dbus::MessageReader reader(method_call); 188 dbus::MessageReader reader(method_call);
(...skipping 25 matching lines...) Expand all
224 EXPECT_CALL(*mock_bus_.get(), 214 EXPECT_CALL(*mock_bus_.get(),
225 GetObjectProxy(kFreedesktopNotificationsName, 215 GetObjectProxy(kFreedesktopNotificationsName,
226 dbus::ObjectPath(kFreedesktopNotificationsPath))) 216 dbus::ObjectPath(kFreedesktopNotificationsPath)))
227 .WillOnce(Return(mock_notification_proxy_.get())); 217 .WillOnce(Return(mock_notification_proxy_.get()));
228 218
229 EXPECT_CALL(*mock_notification_proxy_.get(), 219 EXPECT_CALL(*mock_notification_proxy_.get(),
230 MockCallMethodAndBlock(Calls("GetCapabilities"), _)) 220 MockCallMethodAndBlock(Calls("GetCapabilities"), _))
231 .WillOnce(OnGetCapabilities(std::vector<std::string>{ 221 .WillOnce(OnGetCapabilities(std::vector<std::string>{
232 "body", "body-hyperlinks", "body-images", "body-markup"})); 222 "body", "body-hyperlinks", "body-images", "body-markup"}));
233 223
234 EXPECT_CALL(*mock_notification_proxy_.get(),
235 MockCallMethodAndBlock(Calls("GetServerInformation"), _))
236 .WillOnce(OnGetServerInformation("1.2"));
237
238 EXPECT_CALL( 224 EXPECT_CALL(
239 *mock_notification_proxy_.get(), 225 *mock_notification_proxy_.get(),
240 ConnectToSignal(kFreedesktopNotificationsName, "ActionInvoked", _, _)) 226 ConnectToSignal(kFreedesktopNotificationsName, "ActionInvoked", _, _))
241 .WillOnce(RegisterSignalCallback(&action_invoked_callback_)); 227 .WillOnce(RegisterSignalCallback(&action_invoked_callback_));
242 228
243 EXPECT_CALL(*mock_notification_proxy_.get(), 229 EXPECT_CALL(*mock_notification_proxy_.get(),
244 ConnectToSignal(kFreedesktopNotificationsName, 230 ConnectToSignal(kFreedesktopNotificationsName,
245 "NotificationClosed", _, _)) 231 "NotificationClosed", _, _))
246 .WillOnce(RegisterSignalCallback(&notification_closed_callback_)); 232 .WillOnce(RegisterSignalCallback(&notification_closed_callback_));
247 } 233 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 1)); 400 1));
415 401
416 CreateNotificationBridgeLinux(); 402 CreateNotificationBridgeLinux();
417 notification_bridge_linux_->Display( 403 notification_bridge_linux_->Display(
418 NotificationCommon::PERSISTENT, "", "", false, 404 NotificationCommon::PERSISTENT, "", "", false,
419 NotificationBuilder("") 405 NotificationBuilder("")
420 .SetMessage(base::ASCIIToUTF16("Body text")) 406 .SetMessage(base::ASCIIToUTF16("Body text"))
421 .SetOriginUrl(GURL("https://google.com/search?q=test&ie=UTF8")) 407 .SetOriginUrl(GURL("https://google.com/search?q=test&ie=UTF8"))
422 .GetResult()); 408 .GetResult());
423 } 409 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification_platform_bridge_linux.cc ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698