| 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_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_EMBEDDED_WORKER_TEST_H
ELPER_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_EMBEDDED_WORKER_TEST_H
ELPER_H_ |
| 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_EMBEDDED_WORKER_TEST_H
ELPER_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_EMBEDDED_WORKER_TEST_H
ELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // always be kept in memory, as data persistence is tested elsewhere. | 25 // always be kept in memory, as data persistence is tested elsewhere. |
| 26 class BackgroundFetchEmbeddedWorkerTestHelper | 26 class BackgroundFetchEmbeddedWorkerTestHelper |
| 27 : public EmbeddedWorkerTestHelper { | 27 : public EmbeddedWorkerTestHelper { |
| 28 public: | 28 public: |
| 29 BackgroundFetchEmbeddedWorkerTestHelper(); | 29 BackgroundFetchEmbeddedWorkerTestHelper(); |
| 30 ~BackgroundFetchEmbeddedWorkerTestHelper() override; | 30 ~BackgroundFetchEmbeddedWorkerTestHelper() override; |
| 31 | 31 |
| 32 // Toggles whether the named Service Worker event should fail. | 32 // Toggles whether the named Service Worker event should fail. |
| 33 void set_fail_abort_event(bool fail) { fail_abort_event_ = fail; } | 33 void set_fail_abort_event(bool fail) { fail_abort_event_ = fail; } |
| 34 void set_fail_click_event(bool fail) { fail_click_event_ = fail; } | 34 void set_fail_click_event(bool fail) { fail_click_event_ = fail; } |
| 35 void set_fail_fail_event(bool fail) { fail_fail_event_ = fail; } | 35 void set_fail_fetch_fail_event(bool fail) { fail_fetch_fail_event_ = fail; } |
| 36 void set_fail_fetched_event(bool fail) { fail_fetched_event_ = fail; } | 36 void set_fail_fetched_event(bool fail) { fail_fetched_event_ = fail; } |
| 37 | 37 |
| 38 const base::Optional<std::string>& last_tag() const { return last_tag_; } | 38 const base::Optional<std::string>& last_tag() const { return last_tag_; } |
| 39 const base::Optional<mojom::BackgroundFetchState>& last_state() const { | 39 const base::Optional<mojom::BackgroundFetchState>& last_state() const { |
| 40 return last_state_; | 40 return last_state_; |
| 41 } | 41 } |
| 42 const base::Optional<std::vector<BackgroundFetchSettledFetch>> last_fetches() | 42 const base::Optional<std::vector<BackgroundFetchSettledFetch>> last_fetches() |
| 43 const { | 43 const { |
| 44 return last_fetches_; | 44 return last_fetches_; |
| 45 } | 45 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 62 DispatchBackgroundFetchFailEventCallback& callback) override; | 62 DispatchBackgroundFetchFailEventCallback& callback) override; |
| 63 void OnBackgroundFetchedEvent( | 63 void OnBackgroundFetchedEvent( |
| 64 const std::string& tag, | 64 const std::string& tag, |
| 65 const std::vector<BackgroundFetchSettledFetch>& fetches, | 65 const std::vector<BackgroundFetchSettledFetch>& fetches, |
| 66 const mojom::ServiceWorkerEventDispatcher:: | 66 const mojom::ServiceWorkerEventDispatcher:: |
| 67 DispatchBackgroundFetchedEventCallback& callback) override; | 67 DispatchBackgroundFetchedEventCallback& callback) override; |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 bool fail_abort_event_ = false; | 70 bool fail_abort_event_ = false; |
| 71 bool fail_click_event_ = false; | 71 bool fail_click_event_ = false; |
| 72 bool fail_fail_event_ = false; | 72 bool fail_fetch_fail_event_ = false; |
| 73 bool fail_fetched_event_ = false; | 73 bool fail_fetched_event_ = false; |
| 74 | 74 |
| 75 base::Optional<std::string> last_tag_; | 75 base::Optional<std::string> last_tag_; |
| 76 base::Optional<mojom::BackgroundFetchState> last_state_; | 76 base::Optional<mojom::BackgroundFetchState> last_state_; |
| 77 base::Optional<std::vector<BackgroundFetchSettledFetch>> last_fetches_; | 77 base::Optional<std::vector<BackgroundFetchSettledFetch>> last_fetches_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchEmbeddedWorkerTestHelper); | 79 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchEmbeddedWorkerTestHelper); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace content | 82 } // namespace content |
| 83 | 83 |
| 84 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_EMBEDDED_WORKER_TES
T_HELPER_H_ | 84 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_EMBEDDED_WORKER_TES
T_HELPER_H_ |
| OLD | NEW |