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

Unified Diff: content/browser/background_fetch/background_fetch_embedded_worker_test_helper.h

Issue 2786973002: Add a full end-to-end test for Background Fetch (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/background_fetch/background_fetch_embedded_worker_test_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/background_fetch/background_fetch_embedded_worker_test_helper.h
diff --git a/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.h b/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.h
index fc391b96f45fe30ecb999dcc7755e467b7179fb7..531427ea9b5a7550baf571e6c56cbd733cc7ee8f 100644
--- a/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.h
+++ b/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.h
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "base/callback.h"
#include "base/macros.h"
#include "base/optional.h"
#include "content/browser/service_worker/embedded_worker_test_helper.h"
@@ -35,6 +36,20 @@ class BackgroundFetchEmbeddedWorkerTestHelper
void set_fail_fetch_fail_event(bool fail) { fail_fetch_fail_event_ = fail; }
void set_fail_fetched_event(bool fail) { fail_fetched_event_ = fail; }
+ // Sets a base::Callback that should be executed when the named event is ran.
+ void set_abort_event_closure(const base::Closure& closure) {
+ abort_event_closure_ = closure;
+ }
+ void set_click_event_closure(const base::Closure& closure) {
+ click_event_closure_ = closure;
+ }
+ void set_fetch_fail_event_closure(const base::Closure& closure) {
+ fetch_fail_event_closure_ = closure;
+ }
+ void set_fetched_event_closure(const base::Closure& closure) {
+ fetched_event_closure_ = closure;
+ }
+
const base::Optional<std::string>& last_tag() const { return last_tag_; }
const base::Optional<mojom::BackgroundFetchState>& last_state() const {
return last_state_;
@@ -72,6 +87,11 @@ class BackgroundFetchEmbeddedWorkerTestHelper
bool fail_fetch_fail_event_ = false;
bool fail_fetched_event_ = false;
+ base::Closure abort_event_closure_;
+ base::Closure click_event_closure_;
+ base::Closure fetch_fail_event_closure_;
+ base::Closure fetched_event_closure_;
+
base::Optional<std::string> last_tag_;
base::Optional<mojom::BackgroundFetchState> last_state_;
base::Optional<std::vector<BackgroundFetchSettledFetch>> last_fetches_;
« no previous file with comments | « no previous file | content/browser/background_fetch/background_fetch_embedded_worker_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698