Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: content/browser/background_fetch/background_fetch_data_manager_unittest.cc

Issue 2678273003: Initial framework setup and skeleton for BackgroundFetchContext (Closed)
Patch Set: Removed unused browser_context_ stored member. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 {
17
18 const char kOrigin[] = "https://example.com/";
19 const char kResource[] = "https://example.com/resource.html";
20 const char kTag[] = "TestRequestTag";
21 constexpr int64_t kServiceWorkerRegistrationId = 9001;
22
23 } // namespace
24
25 namespace content {
26
27 class BackgroundFetchDataManagerTest : public testing::Test {
28 protected:
29 BackgroundFetchDataManagerTest()
30 : helper_(base::FilePath()),
31 background_fetch_context_(
32 new BackgroundFetchContext(&browser_context_,
33 helper_.context_wrapper())) {}
34
35 BackgroundFetchDataManager* GetDataManager() const {
36 return background_fetch_context_->GetDataManagerForTesting();
37 }
38
39 private:
40 TestBrowserThreadBundle browser_thread_bundle_;
41 TestBrowserContext browser_context_;
42 EmbeddedWorkerTestHelper helper_;
43
44 scoped_refptr<BackgroundFetchContext> background_fetch_context_;
45 };
46
47 TEST_F(BackgroundFetchDataManagerTest, AddRequest) {
48 BackgroundFetchDataManager* data_manager = GetDataManager();
49 FetchRequest request(url::Origin(GURL(kOrigin)), GURL(kResource),
50 kServiceWorkerRegistrationId, kTag);
51
52 data_manager->CreateRequest(request);
53
54 // TODO(harkness) There's no output to test yet. Once there is, check that the
55 // request was actually added.
56 }
57
58 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/background_fetch/background_fetch_data_manager.cc ('k') | content/browser/background_fetch/fetch_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698