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.TargetApi; | 8 import android.annotation.TargetApi; |
8 import android.app.Notification; | 9 import android.app.Notification; |
9 import android.app.PendingIntent; | 10 import android.app.PendingIntent; |
10 import android.content.Context; | 11 import android.content.Context; |
11 import android.content.Intent; | 12 import android.content.Intent; |
12 import android.graphics.Bitmap; | 13 import android.graphics.Bitmap; |
13 import android.graphics.BitmapFactory; | 14 import android.graphics.BitmapFactory; |
14 import android.graphics.Color; | 15 import android.graphics.Color; |
15 import android.graphics.drawable.BitmapDrawable; | 16 import android.graphics.drawable.BitmapDrawable; |
16 import android.graphics.drawable.Drawable; | 17 import android.graphics.drawable.Drawable; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule() ; | 49 public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule() ; |
49 | 50 |
50 @Before | 51 @Before |
51 public void setUp() throws Exception { | 52 public void setUp() throws Exception { |
52 mActivityTestRule.loadNativeLibraryNoBrowserProcess(); | 53 mActivityTestRule.loadNativeLibraryNoBrowserProcess(); |
53 } | 54 } |
54 | 55 |
55 @Test | 56 @Test |
56 @SmallTest | 57 @SmallTest |
57 @Feature({"Browser", "Notifications"}) | 58 @Feature({"Browser", "Notifications"}) |
59 // TODO(crbug.com/635567): Fix this properly. | |
Ted C
2017/04/27 19:02:48
this method checks api versions already...is there
F
2017/04/28 18:25:15
Done. Overly chatty. Thanks for pointing this out!
| |
60 @SuppressLint("NewApi") | |
58 public void testSetAll() { | 61 public void testSetAll() { |
59 Context context = InstrumentationRegistry.getInstrumentation().getTarget Context(); | 62 Context context = InstrumentationRegistry.getInstrumentation().getTarget Context(); |
60 | 63 |
61 PendingIntent contentIntent = createIntent(context, "Content"); | 64 PendingIntent contentIntent = createIntent(context, "Content"); |
62 PendingIntent deleteIntent = createIntent(context, "Delete"); | 65 PendingIntent deleteIntent = createIntent(context, "Delete"); |
63 | 66 |
64 Bitmap smallIcon = | 67 Bitmap smallIcon = |
65 BitmapFactory.decodeResource(context.getResources(), R.drawable. ic_chrome); | 68 BitmapFactory.decodeResource(context.getResources(), R.drawable. ic_chrome); |
66 | 69 |
67 Bitmap largeIcon = Bitmap.createBitmap( | 70 Bitmap largeIcon = Bitmap.createBitmap( |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 return PendingIntent.getBroadcast( | 412 return PendingIntent.getBroadcast( |
410 context, 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_ CURRENT); | 413 context, 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_ CURRENT); |
411 } | 414 } |
412 | 415 |
413 private static String createString(char character, int length) { | 416 private static String createString(char character, int length) { |
414 char[] chars = new char[length]; | 417 char[] chars = new char[length]; |
415 Arrays.fill(chars, character); | 418 Arrays.fill(chars, character); |
416 return new String(chars); | 419 return new String(chars); |
417 } | 420 } |
418 } | 421 } |
OLD | NEW |