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

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: Remove BackgroundFetchDownloadObserver until it's used. 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 "content/browser/background_fetch/background_fetch_context.h"
8 #include "content/browser/background_fetch/fetch_request.h"
9 #include "content/browser/service_worker/service_worker_context_wrapper.h"
10 #include "content/public/test/test_browser_context.h"
11 #include "content/public/test/test_browser_thread_bundle.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace content {
15
16 const char kOrigin[] = "https://example.com/";
17 const char kResource[] = "https://example.com/resource.html";
18 const char kTag[] = "TestRequestTag";
19
20 class BackgroundFetchDataManagerTest : public testing::Test {
21 protected:
22 BackgroundFetchDataManagerTest()
23 : browser_context_(new TestBrowserContext),
24 background_fetch_data_manager_(
25 new BackgroundFetchDataManager(new BackgroundFetchContext(
26 browser_context_.get(),
27 new ServiceWorkerContextWrapper(browser_context_.get())))) {}
Peter Beverloo 2017/02/13 18:35:06 I don't think this is OK. See EmbeddedWorkerTestHe
harkness 2017/02/14 13:52:46 Ah, that's a nifty helper class. Updated.
28
29 BackgroundFetchDataManager* GetDataManager() const {
30 return background_fetch_data_manager_.get();
31 }
32
33 private:
34 TestBrowserThreadBundle browser_thread_bundle_;
35
36 std::unique_ptr<TestBrowserContext> browser_context_;
Peter Beverloo 2017/02/13 18:35:06 nit: no need to use an std::unique_ptr<>, just hav
harkness 2017/02/14 13:52:46 Done.
37 std::unique_ptr<BackgroundFetchDataManager> background_fetch_data_manager_;
38 };
39
40 TEST_F(BackgroundFetchDataManagerTest, AddRequest) {
41 BackgroundFetchDataManager* data_manager = GetDataManager();
42 FetchRequest request(url::Origin(GURL(kOrigin)), url::Origin(GURL(kResource)),
43 kTag, nullptr);
44
45 data_manager->CreateRequest(request);
46
47 // TODO(harkness) There's no output to test yet. Once there is, check that the
48 // request was actually added.
49 }
50
51 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698