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

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

Issue 2774343002: Hook up BackgroundFetchServiceImpl::Fetch() to start a fetch (Closed)
Patch Set: rebase Created 3 years, 8 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
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_embedded_worker_test _helper.h" 5 #include "content/browser/background_fetch/background_fetch_embedded_worker_test _helper.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "content/common/background_fetch/background_fetch_types.h" 9 #include "content/common/background_fetch/background_fetch_types.h"
10 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" 10 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 void BackgroundFetchEmbeddedWorkerTestHelper::OnBackgroundFetchFailEvent( 52 void BackgroundFetchEmbeddedWorkerTestHelper::OnBackgroundFetchFailEvent(
53 const std::string& tag, 53 const std::string& tag,
54 const std::vector<BackgroundFetchSettledFetch>& fetches, 54 const std::vector<BackgroundFetchSettledFetch>& fetches,
55 const mojom::ServiceWorkerEventDispatcher:: 55 const mojom::ServiceWorkerEventDispatcher::
56 DispatchBackgroundFetchFailEventCallback& callback) { 56 DispatchBackgroundFetchFailEventCallback& callback) {
57 last_tag_ = tag; 57 last_tag_ = tag;
58 last_fetches_ = fetches; 58 last_fetches_ = fetches;
59 59
60 if (fail_fail_event_) { 60 if (fail_fetch_fail_event_) {
61 callback.Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, 61 callback.Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
62 base::Time::Now()); 62 base::Time::Now());
63 } else { 63 } else {
64 callback.Run(SERVICE_WORKER_OK, base::Time::Now()); 64 callback.Run(SERVICE_WORKER_OK, base::Time::Now());
65 } 65 }
66 } 66 }
67 67
68 void BackgroundFetchEmbeddedWorkerTestHelper::OnBackgroundFetchedEvent( 68 void BackgroundFetchEmbeddedWorkerTestHelper::OnBackgroundFetchedEvent(
69 const std::string& tag, 69 const std::string& tag,
70 const std::vector<BackgroundFetchSettledFetch>& fetches, 70 const std::vector<BackgroundFetchSettledFetch>& fetches,
71 const mojom::ServiceWorkerEventDispatcher:: 71 const mojom::ServiceWorkerEventDispatcher::
72 DispatchBackgroundFetchedEventCallback& callback) { 72 DispatchBackgroundFetchedEventCallback& callback) {
73 last_tag_ = tag; 73 last_tag_ = tag;
74 last_fetches_ = fetches; 74 last_fetches_ = fetches;
75 75
76 if (fail_fetched_event_) { 76 if (fail_fetched_event_) {
77 callback.Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, 77 callback.Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
78 base::Time::Now()); 78 base::Time::Now());
79 } else { 79 } else {
80 callback.Run(SERVICE_WORKER_OK, base::Time::Now()); 80 callback.Run(SERVICE_WORKER_OK, base::Time::Now());
81 } 81 }
82 } 82 }
83 83
84 } // namespace content 84 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698