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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadTest.java

Issue 1920303002: [Android] Disable DownloadTest.testDuplicateHttpPostDownload_OpenNewTabAndReplace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.download; 5 package org.chromium.chrome.browser.download;
6 6
7 import android.os.Environment; 7 import android.os.Environment;
8 import android.test.FlakyTest;
9 import android.test.suitebuilder.annotation.MediumTest; 8 import android.test.suitebuilder.annotation.MediumTest;
10 import android.view.View; 9 import android.view.View;
11 10
12 import org.chromium.base.Log; 11 import org.chromium.base.Log;
13 import org.chromium.base.test.util.CommandLineFlags; 12 import org.chromium.base.test.util.CommandLineFlags;
14 import org.chromium.base.test.util.DisabledTest; 13 import org.chromium.base.test.util.DisabledTest;
15 import org.chromium.base.test.util.Feature; 14 import org.chromium.base.test.util.Feature;
15 import org.chromium.base.test.util.FlakyTest;
16 import org.chromium.chrome.R; 16 import org.chromium.chrome.R;
17 import org.chromium.chrome.browser.ChromeSwitches; 17 import org.chromium.chrome.browser.ChromeSwitches;
18 import org.chromium.chrome.browser.compositor.CompositorViewHolder; 18 import org.chromium.chrome.browser.compositor.CompositorViewHolder;
19 import org.chromium.chrome.browser.compositor.layouts.LayoutManager; 19 import org.chromium.chrome.browser.compositor.layouts.LayoutManager;
20 import org.chromium.chrome.browser.compositor.layouts.StaticLayout; 20 import org.chromium.chrome.browser.compositor.layouts.StaticLayout;
21 import org.chromium.chrome.browser.infobar.InfoBarContainer; 21 import org.chromium.chrome.browser.infobar.InfoBarContainer;
22 import org.chromium.chrome.browser.tabmodel.TabModel; 22 import org.chromium.chrome.browser.tabmodel.TabModel;
23 import org.chromium.chrome.browser.tabmodel.TabModelUtils; 23 import org.chromium.chrome.browser.tabmodel.TabModelUtils;
24 import org.chromium.chrome.test.util.InfoBarUtil; 24 import org.chromium.chrome.test.util.InfoBarUtil;
25 import org.chromium.content.browser.test.util.Criteria; 25 import org.chromium.content.browser.test.util.Criteria;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html ")); 97 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html "));
98 waitForFocus(); 98 waitForFocus();
99 View currentView = getActivity().getActivityTab().getView(); 99 View currentView = getActivity().getActivityTab().getView();
100 100
101 int callCount = getChromeDownloadCallCount(); 101 int callCount = getChromeDownloadCallCount();
102 singleClickView(currentView); 102 singleClickView(currentView);
103 assertTrue(waitForChromeDownloadToFinish(callCount)); 103 assertTrue(waitForChromeDownloadToFinish(callCount));
104 assertTrue(hasDownload("superbo.txt", SUPERBO_CONTENTS)); 104 assertTrue(hasDownload("superbo.txt", SUPERBO_CONTENTS));
105 } 105 }
106 106
107 /** 107 @MediumTest
108 * Bug http://crbug/286315 108 @Feature({"Downloads"})
109 * @MediumTest 109 @DisabledTest(message = "crbug.com/286315")
110 * @Feature({"Downloads"})
111 */
112 @DisabledTest
113 public void testCloseEmptyDownloadTab() throws Exception { 110 public void testCloseEmptyDownloadTab() throws Exception {
114 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/get.html" )); 111 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/get.html" ));
115 waitForFocus(); 112 waitForFocus();
116 final int initialTabCount = getActivity().getCurrentTabModel().getCount( ); 113 final int initialTabCount = getActivity().getCurrentTabModel().getCount( );
117 View currentView = getActivity().getActivityTab().getView(); 114 View currentView = getActivity().getActivityTab().getView();
118 TouchCommon.longPressView(currentView); 115 TouchCommon.longPressView(currentView);
119 116
120 EnqueueHttpGetDownloadCallbackHelper callbackHelper = getHttpGetDownload CallbackHelper(); 117 EnqueueHttpGetDownloadCallbackHelper callbackHelper = getHttpGetDownload CallbackHelper();
121 int callCount = callbackHelper.getCallCount(); 118 int callCount = callbackHelper.getCallCount();
122 getInstrumentation().invokeContextMenuAction(getActivity(), 119 getInstrumentation().invokeContextMenuAction(getActivity(),
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 assertTrue("OVERWRITE button wasn't found", 155 assertTrue("OVERWRITE button wasn't found",
159 InfoBarUtil.clickPrimaryButton(getInfoBars().get(0))); 156 InfoBarUtil.clickPrimaryButton(getInfoBars().get(0)));
160 assertTrue("Failed to finish downloading file for the second time.", 157 assertTrue("Failed to finish downloading file for the second time.",
161 waitForChromeDownloadToFinish(callCount)); 158 waitForChromeDownloadToFinish(callCount));
162 159
163 assertTrue("Missing first download", hasDownload("superbo.txt", SUPERBO_ CONTENTS)); 160 assertTrue("Missing first download", hasDownload("superbo.txt", SUPERBO_ CONTENTS));
164 assertFalse("Should not have second download", 161 assertFalse("Should not have second download",
165 hasDownload("superbo (1).txt", SUPERBO_CONTENTS)); 162 hasDownload("superbo (1).txt", SUPERBO_CONTENTS));
166 } 163 }
167 164
168 /** 165 @MediumTest
169 * Bug http://crbug/597230 166 @Feature({"Downloads"})
170 * @MediumTest 167 @DisabledTest(message = "crbug.com/597230")
171 * @Feature({"Downloads"})
172 */
173 @DisabledTest
174 public void testDuplicateHttpPostDownload_CreateNew() throws Exception { 168 public void testDuplicateHttpPostDownload_CreateNew() throws Exception {
175 // Download a file. 169 // Download a file.
176 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html ")); 170 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html "));
177 waitForFocus(); 171 waitForFocus();
178 View currentView = getActivity().getActivityTab().getView(); 172 View currentView = getActivity().getActivityTab().getView();
179 int callCount = getChromeDownloadCallCount(); 173 int callCount = getChromeDownloadCallCount();
180 singleClickView(currentView); 174 singleClickView(currentView);
181 assertTrue("Failed to finish downloading file for the first time.", 175 assertTrue("Failed to finish downloading file for the first time.",
182 waitForChromeDownloadToFinish(callCount)); 176 waitForChromeDownloadToFinish(callCount));
183 177
184 // Download a file with the same name. 178 // Download a file with the same name.
185 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html ")); 179 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html "));
186 waitForFocus(); 180 waitForFocus();
187 currentView = getActivity().getActivityTab().getView(); 181 currentView = getActivity().getActivityTab().getView();
188 callCount = getChromeDownloadCallCount(); 182 callCount = getChromeDownloadCallCount();
189 singleClickView(currentView); 183 singleClickView(currentView);
190 assertPollForInfoBarSize(1); 184 assertPollForInfoBarSize(1);
191 assertTrue("CREATE NEW button wasn't found", 185 assertTrue("CREATE NEW button wasn't found",
192 InfoBarUtil.clickSecondaryButton(getInfoBars().get(0))); 186 InfoBarUtil.clickSecondaryButton(getInfoBars().get(0)));
193 assertTrue("Failed to finish downloading file for the second time.", 187 assertTrue("Failed to finish downloading file for the second time.",
194 waitForChromeDownloadToFinish(callCount)); 188 waitForChromeDownloadToFinish(callCount));
195 189
196 assertTrue("Missing first download", hasDownload("superbo.txt", SUPERBO_ CONTENTS)); 190 assertTrue("Missing first download", hasDownload("superbo.txt", SUPERBO_ CONTENTS));
197 assertTrue("Missing second download", 191 assertTrue("Missing second download",
198 hasDownload("superbo (1).txt", SUPERBO_CONTENTS)); 192 hasDownload("superbo (1).txt", SUPERBO_CONTENTS));
199 } 193 }
200 194
201 /*
202 Bug http://crbug/415711
203 */
204 @MediumTest 195 @MediumTest
205 @Feature({"Downloads"}) 196 @Feature({"Downloads"})
206 @FlakyTest 197 @FlakyTest(message = "crbug.com/415711")
207 public void testDuplicateHttpPostDownload_Dismiss() throws Exception { 198 public void testDuplicateHttpPostDownload_Dismiss() throws Exception {
208 // Download a file. 199 // Download a file.
209 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html ")); 200 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html "));
210 waitForFocus(); 201 waitForFocus();
211 View currentView = getActivity().getActivityTab().getView(); 202 View currentView = getActivity().getActivityTab().getView();
212 int callCount = getChromeDownloadCallCount(); 203 int callCount = getChromeDownloadCallCount();
213 singleClickView(currentView); 204 singleClickView(currentView);
214 assertTrue("Failed to finish downloading file for the first time.", 205 assertTrue("Failed to finish downloading file for the first time.",
215 waitForChromeDownloadToFinish(callCount)); 206 waitForChromeDownloadToFinish(callCount));
216 207
217 // Download a file with the same name. 208 // Download a file with the same name.
218 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html ")); 209 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html "));
219 waitForFocus(); 210 waitForFocus();
220 currentView = getActivity().getActivityTab().getView(); 211 currentView = getActivity().getActivityTab().getView();
221 callCount = getChromeDownloadCallCount(); 212 callCount = getChromeDownloadCallCount();
222 singleClickView(currentView); 213 singleClickView(currentView);
223 assertPollForInfoBarSize(1); 214 assertPollForInfoBarSize(1);
224 assertTrue("Close button wasn't found", 215 assertTrue("Close button wasn't found",
225 InfoBarUtil.clickCloseButton(getInfoBars().get(0))); 216 InfoBarUtil.clickCloseButton(getInfoBars().get(0)));
226 assertFalse("Download should not happen when closing infobar", 217 assertFalse("Download should not happen when closing infobar",
227 waitForChromeDownloadToFinish(callCount)); 218 waitForChromeDownloadToFinish(callCount));
228 219
229 assertTrue("Missing first download", hasDownload("superbo.txt", SUPERBO_ CONTENTS)); 220 assertTrue("Missing first download", hasDownload("superbo.txt", SUPERBO_ CONTENTS));
230 assertFalse("Should not have second download", 221 assertFalse("Should not have second download",
231 hasDownload("superbo (1).txt", SUPERBO_CONTENTS)); 222 hasDownload("superbo (1).txt", SUPERBO_CONTENTS));
232 } 223 }
233 224
234 /** 225 @MediumTest
235 * Bug http://crbug/597230 226 @Feature({"Downloads"})
236 * @MediumTest 227 @DisabledTest(message = "crbug.com/597230")
237 * @Feature({"Downloads"})
238 */
239 @DisabledTest
240 public void testDuplicateHttpPostDownload_AllowMultipleInfoBars() throws Exc eption { 228 public void testDuplicateHttpPostDownload_AllowMultipleInfoBars() throws Exc eption {
241 assertFalse(hasDownload("superbo.txt", SUPERBO_CONTENTS)); 229 assertFalse(hasDownload("superbo.txt", SUPERBO_CONTENTS));
242 // Download a file. 230 // Download a file.
243 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html ")); 231 loadUrl(mTestServer.getURL("/chrome/test/data/android/download/post.html "));
244 waitForFocus(); 232 waitForFocus();
245 View currentView = getActivity().getActivityTab().getView(); 233 View currentView = getActivity().getActivityTab().getView();
246 int callCount = getChromeDownloadCallCount(); 234 int callCount = getChromeDownloadCallCount();
247 singleClickView(currentView); 235 singleClickView(currentView);
248 assertTrue("Failed to finish downloading file for the first time.", 236 assertTrue("Failed to finish downloading file for the first time.",
249 waitForChromeDownloadToFinish(callCount)); 237 waitForChromeDownloadToFinish(callCount));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 (CompositorViewHolder) getActivity().findViewById( 311 (CompositorViewHolder) getActivity().findViewById(
324 R.id.compositor_view_holder); 312 R.id.compositor_view_holder);
325 LayoutManager layoutManager = compositorViewHolder.getLayoutMana ger(); 313 LayoutManager layoutManager = compositorViewHolder.getLayoutMana ger();
326 314
327 return layoutManager.getActiveLayout() instanceof StaticLayout; 315 return layoutManager.getActiveLayout() instanceof StaticLayout;
328 } 316 }
329 }); 317 });
330 } 318 }
331 319
332 @CommandLineFlags.Add(ChromeSwitches.DISABLE_DOCUMENT_MODE) 320 @CommandLineFlags.Add(ChromeSwitches.DISABLE_DOCUMENT_MODE)
321 @DisabledTest(message = "crbug.com/606798")
333 @MediumTest 322 @MediumTest
334 @Feature({"Downloads"}) 323 @Feature({"Downloads"})
335 public void testDuplicateHttpPostDownload_OpenNewTabAndReplace() throws Exce ption { 324 public void testDuplicateHttpPostDownload_OpenNewTabAndReplace() throws Exce ption {
336 final String url = 325 final String url =
337 mTestServer.getURL("/chrome/test/data/android/download/get.html" ); 326 mTestServer.getURL("/chrome/test/data/android/download/get.html" );
338 327
339 // Create the file in advance so that duplicate download infobar can sho w up. 328 // Create the file in advance so that duplicate download infobar can sho w up.
340 File dir = Environment.getExternalStoragePublicDirectory(Environment.DIR ECTORY_DOWNLOADS); 329 File dir = Environment.getExternalStoragePublicDirectory(Environment.DIR ECTORY_DOWNLOADS);
341 assertTrue(dir.isDirectory()); 330 assertTrue(dir.isDirectory());
342 final File file = new File(dir, "test.gzip"); 331 final File file = new File(dir, "test.gzip");
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 CriteriaHelper.pollUiThread(new Criteria() { 391 CriteriaHelper.pollUiThread(new Criteria() {
403 @Override 392 @Override
404 public boolean isSatisfied() { 393 public boolean isSatisfied() {
405 updateFailureReason("There should be " + size + " infobar but th ere are " 394 updateFailureReason("There should be " + size + " infobar but th ere are "
406 + getInfoBars().size() + " infobars."); 395 + getInfoBars().size() + " infobars.");
407 return getInfoBars().size() == size && !container.isAnimating(); 396 return getInfoBars().size() == size && !container.isAnimating();
408 } 397 }
409 }); 398 });
410 } 399 }
411 } 400 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698