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 #include "content/browser/background_fetch/background_fetch_data_manager.h" | 5 #include "content/browser/background_fetch/background_fetch_data_manager.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "content/browser/background_fetch/background_fetch_context.h" | 8 #include "content/browser/background_fetch/background_fetch_context.h" |
9 #include "content/browser/background_fetch/fetch_request.h" | 9 #include "content/browser/background_fetch/fetch_request.h" |
10 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 10 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 constexpr int64_t kServiceWorkerRegistrationId = 9001; | 21 constexpr int64_t kServiceWorkerRegistrationId = 9001; |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 class BackgroundFetchDataManagerTest : public testing::Test { | 27 class BackgroundFetchDataManagerTest : public testing::Test { |
28 protected: | 28 protected: |
29 BackgroundFetchDataManagerTest() | 29 BackgroundFetchDataManagerTest() |
30 : helper_(base::FilePath()), | 30 : helper_(base::FilePath()), |
31 background_fetch_context_( | 31 background_fetch_context_(new BackgroundFetchContext( |
32 new BackgroundFetchContext(&browser_context_, | 32 &browser_context_, |
33 helper_.context_wrapper())) {} | 33 BrowserContext::GetDefaultStoragePartition(&browser_context_), |
| 34 helper_.context_wrapper())) {} |
34 | 35 |
35 BackgroundFetchDataManager* GetDataManager() const { | 36 BackgroundFetchDataManager* GetDataManager() const { |
36 return background_fetch_context_->GetDataManagerForTesting(); | 37 return background_fetch_context_->GetDataManagerForTesting(); |
37 } | 38 } |
38 | 39 |
39 private: | 40 private: |
40 TestBrowserThreadBundle browser_thread_bundle_; | 41 TestBrowserThreadBundle browser_thread_bundle_; |
41 TestBrowserContext browser_context_; | 42 TestBrowserContext browser_context_; |
42 EmbeddedWorkerTestHelper helper_; | 43 EmbeddedWorkerTestHelper helper_; |
43 | 44 |
44 scoped_refptr<BackgroundFetchContext> background_fetch_context_; | 45 scoped_refptr<BackgroundFetchContext> background_fetch_context_; |
45 }; | 46 }; |
46 | 47 |
47 TEST_F(BackgroundFetchDataManagerTest, AddRequest) { | 48 TEST_F(BackgroundFetchDataManagerTest, AddRequest) { |
48 BackgroundFetchDataManager* data_manager = GetDataManager(); | 49 BackgroundFetchDataManager* data_manager = GetDataManager(); |
49 FetchRequest request(url::Origin(GURL(kOrigin)), GURL(kResource), | 50 FetchRequest request(url::Origin(GURL(kOrigin)), GURL(kResource), |
50 kServiceWorkerRegistrationId, kTag); | 51 kServiceWorkerRegistrationId, kTag); |
51 | 52 |
52 data_manager->CreateRequest(request); | 53 data_manager->CreateRequest(request); |
53 | 54 |
54 // TODO(harkness) There's no output to test yet. Once there is, check that the | 55 // TODO(harkness) There's no output to test yet. Once there is, check that the |
55 // request was actually added. | 56 // request was actually added. |
56 } | 57 } |
57 | 58 |
58 } // namespace content | 59 } // namespace content |
OLD | NEW |