OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |