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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTestUtils.java

Issue 2736493002: Fix two notification update issues on page navigation (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTestUtils.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTestUtils.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTestUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..143d234453c44556b6f02a88cd2b70ece27e5654
--- /dev/null
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTestUtils.java
@@ -0,0 +1,33 @@
+// Copyright 2017 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.media.ui;
+
+import android.app.Instrumentation;
+
+import org.chromium.base.ThreadUtils;
+import org.chromium.chrome.browser.tab.Tab;
+import org.chromium.content_public.browser.LoadUrlParams;
+
+/**
+ * Helper functions used in notification instrumentation tests.
+ */
+public class NotificationTestUtils {
+ /**
+ * Simulates a same page navigation.
+ * @param instrumentation The Instrumentation object for the test.
+ * @param tab The tab to be navigated.
+ * @param url The original URL. The URL to be navigated to is |url| + "#some-anchor".
+ */
+ public static void simulateSamePageNavigation(
+ Instrumentation instrumentation, final Tab tab, final String url) {
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ tab.loadUrl(new LoadUrlParams(url + "#some-anchor"));
+ }
+ });
+ instrumentation.waitForIdleSync();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698