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

Unified Diff: base/test/android/java/src/org/chromium/base/TestSystemMessageHandler.java

Issue 2169553002: Properly throw java exceptions from shouldOverrideUrlLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused file. Created 4 years, 4 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: base/test/android/java/src/org/chromium/base/TestSystemMessageHandler.java
diff --git a/base/test/android/java/src/org/chromium/base/TestSystemMessageHandler.java b/base/test/android/java/src/org/chromium/base/TestSystemMessageHandler.java
new file mode 100644
index 0000000000000000000000000000000000000000..aabe43e9bbdb7fb98f5457cc090d80b91b72121b
--- /dev/null
+++ b/base/test/android/java/src/org/chromium/base/TestSystemMessageHandler.java
@@ -0,0 +1,49 @@
+// 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.base;
+
+import android.os.Message;
+
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+import org.chromium.base.annotations.MainDex;
+
+@MainDex
+@JNINamespace("base::android")
+class TestSystemMessageHandler extends SystemMessageHandler {
+ private static final String TAG = "cr.TestSysMessageHandler";
+ private long mWaitableTestEvent;
+
+ private TestSystemMessageHandler(
+ long messagePumpDelegateNative, long messagePumpNative, long waitableTestEvent) {
+ super(messagePumpDelegateNative, messagePumpNative);
+ mWaitableTestEvent = waitableTestEvent;
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ try {
+ super.handleMessage(msg);
+ } catch (TestException e) {
+ nativeNotifyTestDone(mWaitableTestEvent);
+ return;
+ }
+ }
+
+ private static class TestException extends RuntimeException {
+ TestException(String message) {
+ super(message);
+ }
+ }
+
+ @CalledByNative
+ private static TestSystemMessageHandler create(
+ long messagePumpDelegateNative, long messagePumpNative, long waitableTestEvent) {
+ return new TestSystemMessageHandler(
+ messagePumpDelegateNative, messagePumpNative, waitableTestEvent);
+ }
+
+ private static native void nativeNotifyTestDone(long messagePumpNative);
+}

Powered by Google App Engine
This is Rietveld 408576698