| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; |
| 7 import android.content.pm.ApplicationInfo; | 8 import android.content.pm.ApplicationInfo; |
| 8 import android.content.pm.PackageManager; | 9 import android.content.pm.PackageManager; |
| 9 import android.graphics.Rect; | 10 import android.graphics.Rect; |
| 11 import android.os.Build; |
| 10 import android.os.Bundle; | 12 import android.os.Bundle; |
| 11 import android.os.Handler; | 13 import android.os.Handler; |
| 12 import android.os.HandlerThread; | 14 import android.os.HandlerThread; |
| 13 import android.os.Message; | 15 import android.os.Message; |
| 14 import android.test.suitebuilder.annotation.MediumTest; | 16 import android.test.suitebuilder.annotation.MediumTest; |
| 15 import android.view.View; | 17 import android.view.View; |
| 16 import android.view.ViewGroup; | 18 import android.view.ViewGroup; |
| 17 | 19 |
| 18 import org.chromium.base.ThreadUtils; | 20 import org.chromium.base.ThreadUtils; |
| 19 import org.chromium.base.test.util.Feature; | 21 import org.chromium.base.test.util.Feature; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 93 |
| 92 mSmartClipProviderClass = getSmartClipProviderClass(); | 94 mSmartClipProviderClass = getSmartClipProviderClass(); |
| 93 assertNotNull(mSmartClipProviderClass); | 95 assertNotNull(mSmartClipProviderClass); |
| 94 mSetSmartClipResultHandlerMethod = mSmartClipProviderClass.getDeclaredMe
thod( | 96 mSetSmartClipResultHandlerMethod = mSmartClipProviderClass.getDeclaredMe
thod( |
| 95 "setSmartClipResultHandler", new Class[] { Handler.class }); | 97 "setSmartClipResultHandler", new Class[] { Handler.class }); |
| 96 mExtractSmartClipDataMethod = mSmartClipProviderClass.getDeclaredMethod( | 98 mExtractSmartClipDataMethod = mSmartClipProviderClass.getDeclaredMethod( |
| 97 "extractSmartClipData", | 99 "extractSmartClipData", |
| 98 new Class[] { Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.
TYPE }); | 100 new Class[] { Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.
TYPE }); |
| 99 } | 101 } |
| 100 | 102 |
| 103 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) |
| 101 @Override | 104 @Override |
| 102 public void tearDown() throws Exception { | 105 public void tearDown() throws Exception { |
| 103 try { | 106 try { |
| 104 mHandlerThread.quitSafely(); | 107 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { |
| 108 mHandlerThread.quitSafely(); |
| 109 } |
| 105 } finally { | 110 } finally { |
| 106 super.tearDown(); | 111 super.tearDown(); |
| 107 } | 112 } |
| 108 } | 113 } |
| 109 | 114 |
| 110 // Implements Handler.Callback | 115 // Implements Handler.Callback |
| 111 @Override | 116 @Override |
| 112 public boolean handleMessage(Message msg) { | 117 public boolean handleMessage(Message msg) { |
| 113 Bundle bundle = msg.getData(); | 118 Bundle bundle = msg.getData(); |
| 114 assertNotNull(bundle); | 119 assertNotNull(bundle); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 178 } |
| 174 }); | 179 }); |
| 175 mCallbackHelper.waitForCallback(0, 1); // call count: 0 --> 1 | 180 mCallbackHelper.waitForCallback(0, 1); // call count: 0 --> 1 |
| 176 assertEquals("about:blank", mCallbackHelper.getTitle()); | 181 assertEquals("about:blank", mCallbackHelper.getTitle()); |
| 177 assertEquals("about:blank", mCallbackHelper.getUrl()); | 182 assertEquals("about:blank", mCallbackHelper.getUrl()); |
| 178 assertNotNull(mCallbackHelper.getText()); | 183 assertNotNull(mCallbackHelper.getText()); |
| 179 assertNotNull(mCallbackHelper.getHtml()); | 184 assertNotNull(mCallbackHelper.getHtml()); |
| 180 assertNotNull(mCallbackHelper.getRect()); | 185 assertNotNull(mCallbackHelper.getRect()); |
| 181 } | 186 } |
| 182 } | 187 } |
| OLD | NEW |