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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // -------------------------------------------------------------------------
------------------- | 218 // -------------------------------------------------------------------------
------------------- |
219 | 219 |
220 public ContextualSearchTapEventTest() { | 220 public ContextualSearchTapEventTest() { |
221 super(ChromeActivity.class); | 221 super(ChromeActivity.class); |
222 } | 222 } |
223 | 223 |
224 @Override | 224 @Override |
225 protected void setUp() throws Exception { | 225 protected void setUp() throws Exception { |
226 super.setUp(); | 226 super.setUp(); |
227 | 227 |
228 mPanelManager = new OverlayPanelManagerWrapper(); | 228 final ChromeActivity activity = getActivity(); |
229 mPanelManager.setContainerView(new LinearLayout(getActivity())); | |
230 mPanelManager.setDynamicResourceLoader(new DynamicResourceLoader(0, null
)); | |
231 | 229 |
232 mContextualSearchManager = | 230 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
233 new ContextualSearchManagerWrapper(getActivity(), getActivity().
getWindowAndroid()); | 231 @Override |
234 mPanel = new ContextualSearchPanelWrapper(getActivity(), null, mPanelMan
ager); | 232 public void run() { |
235 mPanel.setManagementDelegate(mContextualSearchManager); | 233 mPanelManager = new OverlayPanelManagerWrapper(); |
236 mContextualSearchManager.setContextualSearchPanel(mPanel); | 234 mPanelManager.setContainerView(new LinearLayout(activity)); |
| 235 mPanelManager.setDynamicResourceLoader(new DynamicResourceLoader
(0, null)); |
237 | 236 |
238 mContextualSearchClient = mContextualSearchManager; | 237 mContextualSearchManager = |
| 238 new ContextualSearchManagerWrapper(activity, activity.ge
tWindowAndroid()); |
| 239 mPanel = new ContextualSearchPanelWrapper(activity, null, mPanel
Manager); |
| 240 mPanel.setManagementDelegate(mContextualSearchManager); |
| 241 mContextualSearchManager.setContextualSearchPanel(mPanel); |
| 242 |
| 243 mContextualSearchClient = mContextualSearchManager; |
| 244 } |
| 245 }); |
239 } | 246 } |
240 | 247 |
241 @Override | 248 @Override |
242 public void startMainActivity() throws InterruptedException { | 249 public void startMainActivity() throws InterruptedException { |
243 startMainActivityWithURL("about:blank"); | 250 startMainActivityWithURL("about:blank"); |
244 } | 251 } |
245 | 252 |
246 /** | 253 /** |
247 * Tests that a Tap gesture followed by tapping empty space closes the panel
. | 254 * Tests that a Tap gesture followed by tapping empty space closes the panel
. |
248 */ | 255 */ |
(...skipping 13 matching lines...) Expand all Loading... |
262 .equals("text")); | 269 .equals("text")); |
263 | 270 |
264 // Fake tap on non-text. | 271 // Fake tap on non-text. |
265 mockTapEmptySpace(); | 272 mockTapEmptySpace(); |
266 | 273 |
267 assertTrue(mPanelManager.getRequestPanelShowCount() == 1); | 274 assertTrue(mPanelManager.getRequestPanelShowCount() == 1); |
268 assertTrue(mPanelManager.getPanelHideCount() == 1); | 275 assertTrue(mPanelManager.getPanelHideCount() == 1); |
269 assertTrue(mContextualSearchManager.getSelectionController().getSelected
Text() == null); | 276 assertTrue(mContextualSearchManager.getSelectionController().getSelected
Text() == null); |
270 } | 277 } |
271 } | 278 } |
OLD | NEW |