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

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

Issue 2713433002: remove unnecessary thread hopping when updating Download notifications (Closed)
Patch Set: Created 3 years, 10 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 | « chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java ('k') | 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.content.Context; 7 import android.content.Context;
8 import android.support.test.filters.SmallTest; 8 import android.support.test.filters.SmallTest;
9 import android.test.InstrumentationTestCase; 9 import android.test.InstrumentationTestCase;
10 10
(...skipping 28 matching lines...) Expand all
39 @Override 39 @Override
40 void stopService() { 40 void stopService() {
41 mStarted = false; 41 mStarted = false;
42 } 42 }
43 43
44 @Override 44 @Override
45 void onSuccessNotificationShown( 45 void onSuccessNotificationShown(
46 final SystemDownloadNotifier.PendingNotificationInfo notificatio nInfo, 46 final SystemDownloadNotifier.PendingNotificationInfo notificatio nInfo,
47 final int notificationId) { 47 final int notificationId) {
48 } 48 }
49
50 @Override
51 void updateDownloadNotification(final PendingNotificationInfo notificati onInfo) {
52 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
53 @Override
54 public void run() {
55 MockSystemDownloadNotifier.super.updateDownloadNotification( notificationInfo);
56 }
57 });
58 }
49 } 59 }
50 60
51 @Override 61 @Override
52 public void setUp() throws Exception { 62 public void setUp() throws Exception {
53 super.setUp(); 63 super.setUp();
54 mDownloadNotifier = new MockSystemDownloadNotifier(getInstrumentation(). getTargetContext()); 64 mDownloadNotifier = new MockSystemDownloadNotifier(getInstrumentation(). getTargetContext());
55 } 65 }
56 66
57 /** 67 /**
58 * Helper method to simulate that the DownloadNotificationService is connect ed. 68 * Helper method to simulate that the DownloadNotificationService is connect ed.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 mDownloadNotifier.notifyDownloadFailed(info); 125 mDownloadNotifier.notifyDownloadFailed(info);
116 mDownloadNotifier.notifyDownloadSuccessful(info2, 100L, true, false); 126 mDownloadNotifier.notifyDownloadSuccessful(info2, 100L, true, false);
117 CriteriaHelper.pollUiThread(new Criteria() { 127 CriteriaHelper.pollUiThread(new Criteria() {
118 @Override 128 @Override
119 public boolean isSatisfied() { 129 public boolean isSatisfied() {
120 return !mDownloadNotifier.mStarted; 130 return !mDownloadNotifier.mStarted;
121 } 131 }
122 }); 132 });
123 } 133 }
124 } 134 }
OLDNEW
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698