| OLD | NEW |
| 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 #ifndef CONTENT_PUBLIC_TEST_MOCK_SERVICE_WORKER_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_SERVICE_WORKER_CONTEXT_H_ |
| 6 #define CONTENT_PUBLIC_TEST_MOCK_SERVICE_WORKER_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_TEST_MOCK_SERVICE_WORKER_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "content/public/browser/service_worker_context.h" | 9 #include "content/public/browser/service_worker_context.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| 11 | 11 |
| 12 class GURL; | 12 class GURL; |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 class ServiceWorkerContextObserver; | 16 class ServiceWorkerContextObserver; |
| 17 | 17 |
| 18 // Mock implementation of ServiceWorkerContext. | 18 // Mock implementation of ServiceWorkerContext. |
| 19 class MockServiceWorkerContext : public ServiceWorkerContext { | 19 class MockServiceWorkerContext : public ServiceWorkerContext { |
| 20 public: | 20 public: |
| 21 MockServiceWorkerContext(); | 21 MockServiceWorkerContext(); |
| 22 virtual ~MockServiceWorkerContext(); | 22 virtual ~MockServiceWorkerContext(); |
| 23 | 23 |
| 24 MOCK_METHOD1(AddObserver, void(ServiceWorkerContextObserver*)); | 24 MOCK_METHOD1(AddObserver, void(ServiceWorkerContextObserver*)); |
| 25 MOCK_METHOD1(RemoveObserver, void(ServiceWorkerContextObserver*)); | 25 MOCK_METHOD1(RemoveObserver, void(ServiceWorkerContextObserver*)); |
| 26 MOCK_METHOD3(RegisterServiceWorker, | 26 MOCK_METHOD4(RegisterServiceWorker, |
| 27 void(const ServiceWorkerContext::Scope&, | 27 void(const ServiceWorkerContext::Scope&, |
| 28 const GURL&, | 28 const GURL&, |
| 29 const blink::WebServiceWorkerUpdateViaCache, |
| 29 const ServiceWorkerContext::ResultCallback&)); | 30 const ServiceWorkerContext::ResultCallback&)); |
| 30 MOCK_METHOD2(StartingExternalRequest, bool(int64_t, const std::string&)); | 31 MOCK_METHOD2(StartingExternalRequest, bool(int64_t, const std::string&)); |
| 31 MOCK_METHOD2(FinishedExternalRequest, bool(int64_t, const std::string&)); | 32 MOCK_METHOD2(FinishedExternalRequest, bool(int64_t, const std::string&)); |
| 32 | 33 |
| 33 // StartActiveWorkerForPattern cannot be mocked because OnceClosure is not | 34 // StartActiveWorkerForPattern cannot be mocked because OnceClosure is not |
| 34 // copyable. | 35 // copyable. |
| 35 void StartActiveWorkerForPattern( | 36 void StartActiveWorkerForPattern( |
| 36 const GURL& pattern, | 37 const GURL& pattern, |
| 37 ServiceWorkerContext::StartActiveWorkerCallback info_callback, | 38 ServiceWorkerContext::StartActiveWorkerCallback info_callback, |
| 38 base::OnceClosure failure_callback) override; | 39 base::OnceClosure failure_callback) override; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 59 void(const GURL&, | 60 void(const GURL&, |
| 60 const StartServiceWorkerForNavigationHintCallback&)); | 61 const StartServiceWorkerForNavigationHintCallback&)); |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(MockServiceWorkerContext); | 64 DISALLOW_COPY_AND_ASSIGN(MockServiceWorkerContext); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 } // namespace content | 67 } // namespace content |
| 67 | 68 |
| 68 #endif // CONTENT_PUBLIC_TEST_MOCK_SERVICE_WORKER_CONTEXT_H_ | 69 #endif // CONTENT_PUBLIC_TEST_MOCK_SERVICE_WORKER_CONTEXT_H_ |
| OLD | NEW |