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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFakeServer.java

Issue 1354763003: [Contextual Search] Trigger the translation one-box. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated UiUtils to address Ted's comments. Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 org.chromium.base.VisibleForTesting; 7 import org.chromium.base.VisibleForTesting;
8 import org.chromium.chrome.browser.compositor.bottombar.OverlayContentDelegate; 8 import org.chromium.chrome.browser.compositor.bottombar.OverlayContentDelegate;
9 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContent; 9 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContent;
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 mLoadedUrl = url; 52 mLoadedUrl = url;
53 mLoadedUrlCount++; 53 mLoadedUrlCount++;
54 // This will not actually load a URL because no Search Content View will be created 54 // This will not actually load a URL because no Search Content View will be created
55 // when under test -- see comments in createNewSearchContentView. 55 // when under test -- see comments in createNewSearchContentView.
56 super.loadUrl(url); 56 super.loadUrl(url);
57 } 57 }
58 58
59 @Override 59 @Override
60 public void handleSearchTermResolutionResponse(boolean isNetworkUnavailable, int responseCode, 60 public void handleSearchTermResolutionResponse(boolean isNetworkUnavailable, int responseCode,
61 String searchTerm, String displayText, String alternateTerm, boolean doPreventPreload, 61 String searchTerm, String displayText, String alternateTerm, boolean doPreventPreload,
62 int selectionStartAdjust, int selectionEndAdjust) { 62 int selectionStartAdjust, int selectionEndAdjust, String contextLang uage) {
63 mBaseManager.handleSearchTermResolutionResponse(isNetworkUnavailable, re sponseCode, 63 mBaseManager.handleSearchTermResolutionResponse(isNetworkUnavailable, re sponseCode,
64 searchTerm, displayText, alternateTerm, doPreventPreload, select ionStartAdjust, 64 searchTerm, displayText, alternateTerm, doPreventPreload, select ionStartAdjust,
65 selectionEndAdjust); 65 selectionEndAdjust, contextLanguage);
66 } 66 }
67 67
68 @Override 68 @Override
69 @Nullable public URL getBasePageUrl() { 69 @Nullable public URL getBasePageUrl() {
70 URL baseUrl = mBaseManager.getBasePageUrl(); 70 URL baseUrl = mBaseManager.getBasePageUrl();
71 if (mShouldUseHttps && baseUrl != null) { 71 if (mShouldUseHttps && baseUrl != null) {
72 try { 72 try {
73 return new URL(baseUrl.toString().replace("http://", "https://") ); 73 return new URL(baseUrl.toString().replace("http://", "https://") );
74 } catch (MalformedURLException e) { 74 } catch (MalformedURLException e) {
75 // TODO(donnd): Auto-generated catch block 75 // TODO(donnd): Auto-generated catch block
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 */ 144 */
145 @VisibleForTesting 145 @VisibleForTesting
146 void reset() { 146 void reset() {
147 mLoadedUrl = null; 147 mLoadedUrl = null;
148 mSearchTermRequested = null; 148 mSearchTermRequested = null;
149 mShouldUseHttps = false; 149 mShouldUseHttps = false;
150 mLoadedUrlCount = 0; 150 mLoadedUrlCount = 0;
151 mIsSearchContentViewCreated = false; 151 mIsSearchContentViewCreated = false;
152 } 152 }
153 } 153 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698