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

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

Issue 2772343003: Android: Remove GetApplicationContext part 1 (Closed)
Patch Set: rebase Created 3 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
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.support.test.filters.MediumTest; 8 import android.support.test.filters.MediumTest;
9 import android.util.Pair; 9 import android.util.Pair;
10 import android.view.View; 10 import android.view.View;
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 @MediumTest 395 @MediumTest
396 @Feature({"Navigation"}) 396 @Feature({"Navigation"})
397 public void testOMADownloadInterception() throws Exception { 397 public void testOMADownloadInterception() throws Exception {
398 TestWebServer webServer = TestWebServer.start(); 398 TestWebServer webServer = TestWebServer.start();
399 try { 399 try {
400 final DownloadManagerRequestInterceptorForTest interceptor = 400 final DownloadManagerRequestInterceptorForTest interceptor =
401 new DownloadManagerRequestInterceptorForTest(); 401 new DownloadManagerRequestInterceptorForTest();
402 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 402 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
403 @Override 403 @Override
404 public void run() { 404 public void run() {
405 DownloadManagerService 405 DownloadManagerService.getDownloadManagerService()
406 .getDownloadManagerService(getInstrumentation().getC ontext())
407 .setDownloadManagerRequestInterceptor(interceptor); 406 .setDownloadManagerRequestInterceptor(interceptor);
408 } 407 }
409 }); 408 });
410 List<Pair<String, String>> headers = new ArrayList<Pair<String, Stri ng>>(); 409 List<Pair<String, String>> headers = new ArrayList<Pair<String, Stri ng>>();
411 headers.add(Pair.create("Content-Type", "application/vnd.oma.drm.mes sage")); 410 headers.add(Pair.create("Content-Type", "application/vnd.oma.drm.mes sage"));
412 final String url = webServer.setResponse("/test.dm", "testdata", hea ders); 411 final String url = webServer.setResponse("/test.dm", "testdata", hea ders);
413 loadUrl(UrlUtils.encodeHtmlDataUri("<script>" 412 loadUrl(UrlUtils.encodeHtmlDataUri("<script>"
414 + " function download() {" 413 + " function download() {"
415 + " window.open( '" + url + "')" 414 + " window.open( '" + url + "')"
416 + " }" 415 + " }"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 454 }
456 455
457 /** 456 /**
458 * Makes sure there are no files with names identical to the ones this test uses in the 457 * Makes sure there are no files with names identical to the ones this test uses in the
459 * downloads directory 458 * downloads directory
460 */ 459 */
461 private void deleteTestFiles() { 460 private void deleteTestFiles() {
462 deleteFilesInDownloadDirectory(TEST_FILES); 461 deleteFilesInDownloadDirectory(TEST_FILES);
463 } 462 }
464 } 463 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698