OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.android_webview.test; | 5 package org.chromium.android_webview.test; |
6 | 6 |
7 import android.test.suitebuilder.annotation.SmallTest; | 7 import android.test.suitebuilder.annotation.SmallTest; |
8 import android.webkit.ValueCallback; | 8 import android.webkit.ValueCallback; |
9 | 9 |
10 import org.chromium.android_webview.AwContents; | 10 import org.chromium.android_webview.AwContents; |
11 import org.chromium.android_webview.test.TestAwContentsClient.DoUpdateVisitedHis
toryHelper; | 11 import org.chromium.android_webview.test.TestAwContentsClient.DoUpdateVisitedHis
toryHelper; |
12 import org.chromium.base.test.util.CallbackHelper; | 12 import org.chromium.base.test.util.CallbackHelper; |
13 import org.chromium.base.test.util.Feature; | 13 import org.chromium.base.test.util.Feature; |
14 import org.chromium.net.test.util.TestWebServer; | 14 import org.chromium.net.test.util.TestWebServer; |
15 | 15 |
16 /** | 16 /** |
17 * Tests for AwContentsClient.getVisitedHistory and AwContents.doUpdateVisitedHi
story callbacks. | 17 * Tests for AwContentsClient.getVisitedHistory and AwContents.doUpdateVisitedHi
story callbacks. |
18 */ | 18 */ |
19 public class AwContentsClientVisitedHistoryTest extends AwTestBase { | 19 public class AwContentsClientVisitedHistoryTest extends AwTestBase { |
20 private static class GetVisitedHistoryHelper extends CallbackHelper { | 20 private static class GetVisitedHistoryHelper extends CallbackHelper { |
21 private ValueCallback<String[]> mCallback; | 21 private ValueCallback<String[]> mCallback; |
22 private boolean mSaveCallback = false; | 22 private boolean mSaveCallback; |
23 | 23 |
24 public ValueCallback<String[]> getCallback() { | 24 public ValueCallback<String[]> getCallback() { |
25 assert getCallCount() > 0; | 25 assert getCallCount() > 0; |
26 return mCallback; | 26 return mCallback; |
27 } | 27 } |
28 | 28 |
29 public void setSaveCallback(boolean value) { | 29 public void setSaveCallback(boolean value) { |
30 mSaveCallback = value; | 30 mSaveCallback = value; |
31 } | 31 } |
32 | 32 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 AwContents awContents = testView.getAwContents(); | 136 AwContents awContents = testView.getAwContents(); |
137 loadUrlAsync(awContents, "about:blank"); | 137 loadUrlAsync(awContents, "about:blank"); |
138 visitedHistoryHelper.waitForCallback(callCount); | 138 visitedHistoryHelper.waitForCallback(callCount); |
139 assertNotNull(visitedHistoryHelper.getCallback()); | 139 assertNotNull(visitedHistoryHelper.getCallback()); |
140 | 140 |
141 destroyAwContentsOnMainSync(awContents); | 141 destroyAwContentsOnMainSync(awContents); |
142 visitedHistoryHelper.getCallback().onReceiveValue(new String[] {"abc.def
"}); | 142 visitedHistoryHelper.getCallback().onReceiveValue(new String[] {"abc.def
"}); |
143 visitedHistoryHelper.getCallback().onReceiveValue(null); | 143 visitedHistoryHelper.getCallback().onReceiveValue(null); |
144 } | 144 } |
145 } | 145 } |
OLD | NEW |