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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/TaskExtrasPacker.java

Issue 2030773002: Add unit tests for the Background Scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable flaky test Created 4 years, 6 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
Index: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/TaskExtrasPacker.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/TaskExtrasPacker.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/TaskExtrasPacker.java
new file mode 100644
index 0000000000000000000000000000000000000000..44b7203dc9ad2ebc17f491f36720c1b0c515291d
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/TaskExtrasPacker.java
@@ -0,0 +1,25 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.offlinepages;
+
+import android.os.Bundle;
+
+/**
+ * Class to put our custom task information into the task bundle.
+ */
+public class TaskExtrasPacker {
+ /** Bundle key for the timestamp in milliseconds when the request started. */
+ public static final String SCHEDULED_TIME_TAG = "Date";
+
+ /** Puts current time into the input bundle. */
+ public static void packTimeInBundle(Bundle bundle) {
+ bundle.putLong(SCHEDULED_TIME_TAG, System.currentTimeMillis());
+ }
+
+ /** Extracts the time we put into the bundle. */
+ public static long unpackTimeFromBundle(Bundle bundle) {
+ return bundle.getLong(SCHEDULED_TIME_TAG);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698