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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java

Issue 1639163003: Extract NotificationBuilderBase for holding the arguments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address peter's comments. Created 4 years, 11 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/java/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilder.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.notifications; 5 package org.chromium.chrome.browser.notifications;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.app.Notification; 8 import android.app.Notification;
9 import android.app.PendingIntent; 9 import android.app.PendingIntent;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // When there are no buttons the container and divider must not be shown . 103 // When there are no buttons the container and divider must not be shown .
104 assertTrue(buttons.isEmpty()); 104 assertTrue(buttons.isEmpty());
105 assertEquals(View.GONE, bigView.findViewById(R.id.button_divider).getVis ibility()); 105 assertEquals(View.GONE, bigView.findViewById(R.id.button_divider).getVis ibility());
106 assertEquals(View.GONE, bigView.findViewById(R.id.buttons).getVisibility ()); 106 assertEquals(View.GONE, bigView.findViewById(R.id.buttons).getVisibility ());
107 } 107 }
108 108
109 @SmallTest 109 @SmallTest
110 @Feature({"Browser", "Notifications"}) 110 @Feature({"Browser", "Notifications"})
111 public void testMaxActionButtons() { 111 public void testMaxActionButtons() {
112 Context context = getInstrumentation().getTargetContext(); 112 Context context = getInstrumentation().getTargetContext();
113 NotificationBuilder builder = new CustomNotificationBuilder(context) 113 NotificationBuilderBase builder = new CustomNotificationBuilder(context)
114 .addAction(0 /* iconId */, "button ", 114 .addAction(0 /* iconId */, "button ",
115 createIntent(context, "Act ionButtonOne")) 115 createIntent(context, "Act ionButtonOne"))
116 .addAction(0 /* iconId */, "button ", 116 .addAction(0 /* iconId */, "button ",
117 createIntent(context, "Act ionButtonTwo")) 117 createIntent(context, "Act ionButtonTwo"))
118 .addAction(0 /* iconId */, "button ", 118 .addAction(0 /* iconId */, "button ",
119 createIntent(context, "Act ionButtonThree")); 119 createIntent(context, "Act ionButtonThree"));
120 try { 120 try {
121 builder.addAction(0 /* iconId */, "button", createIntent(context, "A ctionButtonFour")); 121 builder.addAction(0 /* iconId */, "button", createIntent(context, "A ctionButtonFour"));
122 fail("This statement should not be reached as the previous statement should throw."); 122 fail("This statement should not be reached as the previous statement should throw.");
123 } catch (IllegalStateException e) { 123 } catch (IllegalStateException e) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return PendingIntent.getBroadcast( 210 return PendingIntent.getBroadcast(
211 context, 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_ CURRENT); 211 context, 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_ CURRENT);
212 } 212 }
213 213
214 private static String createString(char character, int length) { 214 private static String createString(char character, int length) {
215 char[] chars = new char[length]; 215 char[] chars = new char[length];
216 Arrays.fill(chars, character); 216 Arrays.fill(chars, character);
217 return new String(chars); 217 return new String(chars);
218 } 218 }
219 } 219 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilder.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698