OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/background_fetch/background_fetch_data_manager.h" | |
6 | |
7 #include "base/files/file_path.h" | |
8 #include "content/browser/background_fetch/background_fetch_context.h" | |
9 #include "content/browser/background_fetch/fetch_request.h" | |
10 #include "content/browser/service_worker/embedded_worker_test_helper.h" | |
11 #include "content/browser/service_worker/service_worker_context_wrapper.h" | |
12 #include "content/public/test/test_browser_context.h" | |
13 #include "content/public/test/test_browser_thread_bundle.h" | |
14 #include "testing/gtest/include/gtest/gtest.h" | |
15 | |
16 namespace content { | |
17 | |
18 const char kOrigin[] = "https://example.com/"; | |
19 const char kResource[] = "https://example.com/resource.html"; | |
20 const char kTag[] = "TestRequestTag"; | |
21 const int64_t kServiceWorkerRegistrationId = 9001; | |
Peter Beverloo
2017/02/14 15:05:52
constexpr
harkness
2017/02/15 13:48:44
Done.
| |
22 | |
23 class BackgroundFetchDataManagerTest : public testing::Test { | |
24 protected: | |
25 BackgroundFetchDataManagerTest() | |
26 : helper_(base::FilePath()), | |
27 background_fetch_context_( | |
28 new BackgroundFetchContext(&browser_context_, | |
29 helper_.context_wrapper())) {} | |
30 | |
31 BackgroundFetchDataManager* GetDataManager() const { | |
32 return background_fetch_context_->GetDataManagerForTesting(); | |
33 } | |
34 | |
35 private: | |
36 TestBrowserThreadBundle browser_thread_bundle_; | |
37 TestBrowserContext browser_context_; | |
38 EmbeddedWorkerTestHelper helper_; | |
39 | |
40 scoped_refptr<BackgroundFetchContext> background_fetch_context_; | |
41 }; | |
42 | |
43 TEST_F(BackgroundFetchDataManagerTest, AddRequest) { | |
44 BackgroundFetchDataManager* data_manager = GetDataManager(); | |
45 FetchRequest request(url::Origin(GURL(kOrigin)), GURL(kResource), | |
46 kServiceWorkerRegistrationId, kTag); | |
47 | |
48 data_manager->CreateRequest(request); | |
49 | |
50 // TODO(harkness) There's no output to test yet. Once there is, check that the | |
51 // request was actually added. | |
52 } | |
53 | |
54 } // namespace content | |
OLD | NEW |