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_TEST_BASE_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_TEST_BASE_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_TEST_BASE_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_TEST_BASE_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 // the Background Fetch feature. | 25 // the Background Fetch feature. |
26 class BackgroundFetchTestBase : public ::testing::Test { | 26 class BackgroundFetchTestBase : public ::testing::Test { |
27 public: | 27 public: |
28 BackgroundFetchTestBase(); | 28 BackgroundFetchTestBase(); |
29 ~BackgroundFetchTestBase() override; | 29 ~BackgroundFetchTestBase() override; |
30 | 30 |
31 // ::testing::Test overrides. | 31 // ::testing::Test overrides. |
32 void SetUp() override; | 32 void SetUp() override; |
33 void TearDown() override; | 33 void TearDown() override; |
34 | 34 |
35 // Creates a valid Service Worker registration for the testing origin and | 35 // Creates a Background Fetch registration backed by a Service Worker |
36 // stores the data in the |*registration_id|. Returns whether creation was | 36 // registration for the testing origin. The resulting registration will be |
37 // successful, which must be asserted by tests. | 37 // stored in |*registration_id|. Returns whether creation was successful, |
| 38 // which must be asserted by tests. The ServiceWorkerRegistration that |
| 39 // backs the |*registration_id| will be kept alive for the test's lifetime. |
38 bool CreateRegistrationId(const std::string& tag, | 40 bool CreateRegistrationId(const std::string& tag, |
39 BackgroundFetchRegistrationId* registration_id) | 41 BackgroundFetchRegistrationId* registration_id) |
40 WARN_UNUSED_RESULT; | 42 WARN_UNUSED_RESULT; |
41 | 43 |
42 // Returns the embedded worker test helper instance, which can be used to | 44 // Returns the embedded worker test helper instance, which can be used to |
43 // influence the behaviour of the Service Worker events. | 45 // influence the behaviour of the Service Worker events. |
44 BackgroundFetchEmbeddedWorkerTestHelper* embedded_worker_test_helper() { | 46 BackgroundFetchEmbeddedWorkerTestHelper* embedded_worker_test_helper() { |
45 return &embedded_worker_test_helper_; | 47 return &embedded_worker_test_helper_; |
46 } | 48 } |
47 | 49 |
(...skipping 14 matching lines...) Expand all Loading... |
62 | 64 |
63 bool set_up_called_ = false; | 65 bool set_up_called_ = false; |
64 bool tear_down_called_ = false; | 66 bool tear_down_called_ = false; |
65 | 67 |
66 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchTestBase); | 68 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchTestBase); |
67 }; | 69 }; |
68 | 70 |
69 } // namespace content | 71 } // namespace content |
70 | 72 |
71 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_TEST_BASE_H_ | 73 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_TEST_BASE_H_ |
OLD | NEW |