| 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 @SuppressLint("NewApi") |
| 58 public void testSetAll() { | 60 public void testSetAll() { |
| 59 Context context = InstrumentationRegistry.getInstrumentation().getTarget
Context(); | 61 Context context = InstrumentationRegistry.getInstrumentation().getTarget
Context(); |
| 60 | 62 |
| 61 PendingIntent contentIntent = createIntent(context, "Content"); | 63 PendingIntent contentIntent = createIntent(context, "Content"); |
| 62 PendingIntent deleteIntent = createIntent(context, "Delete"); | 64 PendingIntent deleteIntent = createIntent(context, "Delete"); |
| 63 | 65 |
| 64 Bitmap smallIcon = | 66 Bitmap smallIcon = |
| 65 BitmapFactory.decodeResource(context.getResources(), R.drawable.
ic_chrome); | 67 BitmapFactory.decodeResource(context.getResources(), R.drawable.
ic_chrome); |
| 66 | 68 |
| 67 Bitmap largeIcon = Bitmap.createBitmap( | 69 Bitmap largeIcon = Bitmap.createBitmap( |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 return PendingIntent.getBroadcast( | 411 return PendingIntent.getBroadcast( |
| 410 context, 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_
CURRENT); | 412 context, 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_
CURRENT); |
| 411 } | 413 } |
| 412 | 414 |
| 413 private static String createString(char character, int length) { | 415 private static String createString(char character, int length) { |
| 414 char[] chars = new char[length]; | 416 char[] chars = new char[length]; |
| 415 Arrays.fill(chars, character); | 417 Arrays.fill(chars, character); |
| 416 return new String(chars); | 418 return new String(chars); |
| 417 } | 419 } |
| 418 } | 420 } |
| OLD | NEW |