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.TargetApi; | 7 import android.annotation.TargetApi; |
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 View compactView = notification.contentView.apply(context, new LinearLay
out(context)); | 86 View compactView = notification.contentView.apply(context, new LinearLay
out(context)); |
87 View bigView = notification.bigContentView.apply(context, new LinearLayo
ut(context)); | 87 View bigView = notification.bigContentView.apply(context, new LinearLayo
ut(context)); |
88 | 88 |
89 assertEquals("title", getIdenticalText(R.id.title, compactView, bigView)
); | 89 assertEquals("title", getIdenticalText(R.id.title, compactView, bigView)
); |
90 assertEquals("body", getIdenticalText(R.id.body, compactView, bigView)); | 90 assertEquals("body", getIdenticalText(R.id.body, compactView, bigView)); |
91 assertEquals("origin", getIdenticalText(R.id.origin, compactView, bigVie
w)); | 91 assertEquals("origin", getIdenticalText(R.id.origin, compactView, bigVie
w)); |
92 | 92 |
93 assertEquals("title", NotificationTestUtil.getExtraTitle(notification)); | 93 assertEquals("title", NotificationTestUtil.getExtraTitle(notification)); |
94 assertEquals("body", NotificationTestUtil.getExtraText(notification)); | 94 assertEquals("body", NotificationTestUtil.getExtraText(notification)); |
95 assertEquals("origin", NotificationTestUtil.getExtraSubText(notification
)); | 95 assertEquals("origin", NotificationTestUtil.getExtraSubText(notification
)); |
| 96 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) { |
| 97 assertEquals( |
| 98 NotificationConstants.GROUP_WEB_PREFIX + "origin", notificat
ion.getGroup()); |
| 99 } |
96 | 100 |
97 assertEquals("ticker", notification.tickerText.toString()); | 101 assertEquals("ticker", notification.tickerText.toString()); |
98 assertEquals(Notification.DEFAULT_ALL, notification.defaults); | 102 assertEquals(Notification.DEFAULT_ALL, notification.defaults); |
99 assertEquals(1, notification.vibrate.length); | 103 assertEquals(1, notification.vibrate.length); |
100 assertEquals(100L, notification.vibrate[0]); | 104 assertEquals(100L, notification.vibrate[0]); |
101 assertSame(contentIntent, notification.contentIntent); | 105 assertSame(contentIntent, notification.contentIntent); |
102 assertSame(deleteIntent, notification.deleteIntent); | 106 assertSame(deleteIntent, notification.deleteIntent); |
103 | 107 |
104 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | 108 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
105 // Notification.publicVersion was added in Android L. | 109 // Notification.publicVersion was added in Android L. |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 return PendingIntent.getBroadcast( | 384 return PendingIntent.getBroadcast( |
381 context, 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_
CURRENT); | 385 context, 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_
CURRENT); |
382 } | 386 } |
383 | 387 |
384 private static String createString(char character, int length) { | 388 private static String createString(char character, int length) { |
385 char[] chars = new char[length]; | 389 char[] chars = new char[length]; |
386 Arrays.fill(chars, character); | 390 Arrays.fill(chars, character); |
387 return new String(chars); | 391 return new String(chars); |
388 } | 392 } |
389 } | 393 } |
OLD | NEW |