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 "content/shell/renderer/test_runner/mock_web_push_client.h" | 5 #include "content/shell/renderer/test_runner/mock_web_push_client.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "third_party/WebKit/public/platform/WebPushError.h" | 9 #include "third_party/WebKit/public/platform/WebPushError.h" |
10 #include "third_party/WebKit/public/platform/WebPushRegistration.h" | 10 #include "third_party/WebKit/public/platform/WebPushRegistration.h" |
11 #include "third_party/WebKit/public/platform/WebString.h" | 11 #include "third_party/WebKit/public/platform/WebString.h" |
12 | 12 |
13 using blink::WebString; | 13 using blink::WebString; |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 MockWebPushClient::MockWebPushClient() | 17 MockWebPushClient::MockWebPushClient() |
18 // The default state should be be an error with "Registration failed." message | 18 : error_message_( |
19 // because LayoutTests are currently depending on that. | 19 "Registration failed (default mock client error message)") { |
20 : error_message_("Registration failed.") { | |
21 } | 20 } |
22 | 21 |
23 MockWebPushClient::~MockWebPushClient() {} | 22 MockWebPushClient::~MockWebPushClient() {} |
24 | 23 |
25 void MockWebPushClient::SetMockSuccessValues( | 24 void MockWebPushClient::SetMockSuccessValues( |
26 const std::string& end_point, const std::string& registration_id) { | 25 const std::string& end_point, const std::string& registration_id) { |
27 end_point_ = end_point; | 26 end_point_ = end_point; |
28 registration_id_ = registration_id; | 27 registration_id_ = registration_id; |
29 error_message_ = ""; | 28 error_message_ = ""; |
30 } | 29 } |
(...skipping 27 matching lines...) Expand all Loading... |
58 scoped_ptr<blink::WebPushRegistration> registration( | 57 scoped_ptr<blink::WebPushRegistration> registration( |
59 new blink::WebPushRegistration(WebString::fromUTF8(end_point_), | 58 new blink::WebPushRegistration(WebString::fromUTF8(end_point_), |
60 WebString::fromUTF8(registration_id_))); | 59 WebString::fromUTF8(registration_id_))); |
61 callbacks->onSuccess(registration.release()); | 60 callbacks->onSuccess(registration.release()); |
62 } | 61 } |
63 | 62 |
64 delete callbacks; | 63 delete callbacks; |
65 } | 64 } |
66 | 65 |
67 } // namespace content | 66 } // namespace content |
OLD | NEW |