| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.contextualsearch; | 5 package org.chromium.chrome.browser.contextualsearch; |
| 6 | 6 |
| 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E
ND_DEVICE; | 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E
ND_DEVICE; |
| 8 | 8 |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.net.Uri; | 10 import android.net.Uri; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 getSelectionController().getBaseContentView().setContextualSearchCli
ent(this); | 88 getSelectionController().getBaseContentView().setContextualSearchCli
ent(this); |
| 89 MockContextualSearchPolicy policy = new MockContextualSearchPolicy(a
ctivity); | 89 MockContextualSearchPolicy policy = new MockContextualSearchPolicy(a
ctivity); |
| 90 setContextualSearchPolicy(policy); | 90 setContextualSearchPolicy(policy); |
| 91 mTranslateController = new MockedCSTranslateController(activity, pol
icy, null); | 91 mTranslateController = new MockedCSTranslateController(activity, pol
icy, null); |
| 92 } | 92 } |
| 93 | 93 |
| 94 @Override | 94 @Override |
| 95 public void startSearchTermResolutionRequest(String selection) { | 95 public void startSearchTermResolutionRequest(String selection) { |
| 96 // Skip native calls and immediately "resolve" the search term. | 96 // Skip native calls and immediately "resolve" the search term. |
| 97 onSearchTermResolutionResponse( | 97 onSearchTermResolutionResponse( |
| 98 true, 200, selection, selection, "", "", false, 0, 10, ""); | 98 true, 200, selection, selection, "", "", false, 0, 10, "", "
"); |
| 99 } | 99 } |
| 100 | 100 |
| 101 @Override | 101 @Override |
| 102 protected ContextualSearchRequest createContextualSearchRequest( | 102 protected ContextualSearchRequest createContextualSearchRequest( |
| 103 String query, String altTerm, String mid, boolean shouldPrefetch
) { | 103 String query, String altTerm, String mid, boolean shouldPrefetch
) { |
| 104 return new MockContextualSearchRequest(query, altTerm, shouldPrefetc
h); | 104 return new MockContextualSearchRequest(query, altTerm, shouldPrefetc
h); |
| 105 } | 105 } |
| 106 | 106 |
| 107 @Override | 107 @Override |
| 108 protected void nativeGatherSurroundingText(long nativeContextualSearchMa
nager, | 108 protected void nativeGatherSurroundingText(long nativeContextualSearchMa
nager, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 .equals("text")); | 249 .equals("text")); |
| 250 | 250 |
| 251 // Fake tap on non-text. | 251 // Fake tap on non-text. |
| 252 mockTapEmptySpace(); | 252 mockTapEmptySpace(); |
| 253 | 253 |
| 254 assertTrue(mPanelManager.getRequestPanelShowCount() == 1); | 254 assertTrue(mPanelManager.getRequestPanelShowCount() == 1); |
| 255 assertTrue(mPanelManager.getPanelHideCount() == 1); | 255 assertTrue(mPanelManager.getPanelHideCount() == 1); |
| 256 assertTrue(mContextualSearchManager.getSelectionController().getSelected
Text() == null); | 256 assertTrue(mContextualSearchManager.getSelectionController().getSelected
Text() == null); |
| 257 } | 257 } |
| 258 } | 258 } |
| OLD | NEW |