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

Side by Side Diff: content/shell/renderer/test_runner/mock_web_push_client.h

Issue 663813002: Clean up deprecated Web Push API code-paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/push-remove-senderId
Patch Set: rebase Created 6 years, 1 month 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 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 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEB_PUSH_CLIENT_H_ 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEB_PUSH_CLIENT_H_
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEB_PUSH_CLIENT_H_ 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEB_PUSH_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "third_party/WebKit/public/platform/WebPushClient.h" 10 #include "third_party/WebKit/public/platform/WebPushClient.h"
11 11
12 namespace blink { 12 namespace blink {
13 class WebServiceWorkerProvider; 13 class WebServiceWorkerProvider;
14 class WebString;
15 } // namespace blink 14 } // namespace blink
16 15
17 namespace content { 16 namespace content {
18 17
19 // MockWebPushClient is a mock implementation of WebPushClient to be able to 18 // MockWebPushClient is a mock implementation of WebPushClient to be able to
20 // test the Push Message API in Blink without depending on the content layer. 19 // test the Push Message API in Blink without depending on the content layer.
21 // The mock, for legacy reasons, automatically fails if it wasn't set to another 20 // The mock, for legacy reasons, automatically fails if it wasn't set to another
22 // state. Consumers can set its success values and error values by calling 21 // state. Consumers can set its success values and error values by calling
23 // respectively SetMockSuccessValues and SetMockErrorValues. When 22 // respectively SetMockSuccessValues and SetMockErrorValues. When
24 // SetMockSuccessValues is called, the mock will always succeed until 23 // SetMockSuccessValues is called, the mock will always succeed until
25 // SetMockErrorValues is called at which point it will always fail. 24 // SetMockErrorValues is called at which point it will always fail.
26 class MockWebPushClient : public blink::WebPushClient { 25 class MockWebPushClient : public blink::WebPushClient {
27 public: 26 public:
28 MockWebPushClient(); 27 MockWebPushClient();
29 virtual ~MockWebPushClient(); 28 virtual ~MockWebPushClient();
30 29
31 void SetMockSuccessValues(const std::string& end_point, 30 void SetMockSuccessValues(const std::string& end_point,
32 const std::string& registration_id); 31 const std::string& registration_id);
33 32
34 void SetMockErrorValues(const std::string& message); 33 void SetMockErrorValues(const std::string& message);
35 34
36 private: 35 private:
37 // WebPushClient implementation. 36 // WebPushClient implementation.
38 virtual void registerPushMessaging( 37 virtual void registerPushMessaging(
39 const blink::WebString& sender_id,
40 blink::WebPushRegistrationCallbacks* callbacks,
41 blink::WebServiceWorkerProvider* service_worker_provider);
42 virtual void registerPushMessaging(
43 blink::WebPushRegistrationCallbacks* callbacks, 38 blink::WebPushRegistrationCallbacks* callbacks,
44 blink::WebServiceWorkerProvider* service_worker_provider); 39 blink::WebServiceWorkerProvider* service_worker_provider);
45 40
46 std::string end_point_; 41 std::string end_point_;
47 std::string registration_id_; 42 std::string registration_id_;
48 std::string error_message_; 43 std::string error_message_;
49 44
50 DISALLOW_COPY_AND_ASSIGN(MockWebPushClient); 45 DISALLOW_COPY_AND_ASSIGN(MockWebPushClient);
51 }; 46 };
52 47
53 } // namespace content 48 } // namespace content
54 49
55 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEB_PUSH_CLIENT_H_ 50 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEB_PUSH_CLIENT_H_
OLDNEW
« no previous file with comments | « content/renderer/push_messaging_dispatcher.cc ('k') | content/shell/renderer/test_runner/mock_web_push_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698