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.webapps; | 5 package org.chromium.chrome.browser.webapps; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.SharedPreferences; | 10 import android.content.SharedPreferences; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 Intent intent = new Intent(); | 87 Intent intent = new Intent(); |
88 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 88 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
89 intent.setPackage(getInstrumentation().getTargetContext().getPackageName
()); | 89 intent.setPackage(getInstrumentation().getTargetContext().getPackageName
()); |
90 intent.setAction(WebappLauncherActivity.ACTION_START_WEBAPP); | 90 intent.setAction(WebappLauncherActivity.ACTION_START_WEBAPP); |
91 intent.putExtra(ShortcutHelper.EXTRA_ID, id); | 91 intent.putExtra(ShortcutHelper.EXTRA_ID, id); |
92 intent.putExtra(ShortcutHelper.EXTRA_URL, url); | 92 intent.putExtra(ShortcutHelper.EXTRA_URL, url); |
93 intent.putExtra(ShortcutHelper.EXTRA_TITLE, title); | 93 intent.putExtra(ShortcutHelper.EXTRA_TITLE, title); |
94 intent.putExtra(ShortcutHelper.EXTRA_ICON, icon); | 94 intent.putExtra(ShortcutHelper.EXTRA_ICON, icon); |
95 intent.putExtra(ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValue
s.PORTRAIT); | 95 intent.putExtra(ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValue
s.PORTRAIT); |
96 intent.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.UNKNOWN); | 96 intent.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.UNKNOWN); |
| 97 intent.putExtra(ShortcutHelper.EXTRA_THEME_COLOR, |
| 98 ShortcutHelper.THEME_COLOR_INVALID_OR_MISSING); |
97 if (addMac) { | 99 if (addMac) { |
98 // Needed for security reasons. If the MAC is excluded, the URL of
the webapp is opened | 100 // Needed for security reasons. If the MAC is excluded, the URL of
the webapp is opened |
99 // in a browser window, instead. | 101 // in a browser window, instead. |
100 String mac = ShortcutHelper.getEncodedMac(getInstrumentation().getTa
rgetContext(), url); | 102 String mac = ShortcutHelper.getEncodedMac(getInstrumentation().getTa
rgetContext(), url); |
101 intent.putExtra(ShortcutHelper.EXTRA_MAC, mac); | 103 intent.putExtra(ShortcutHelper.EXTRA_MAC, mac); |
102 } | 104 } |
103 | 105 |
104 getInstrumentation().getTargetContext().startActivity(intent); | 106 getInstrumentation().getTargetContext().startActivity(intent); |
105 getInstrumentation().waitForIdleSync(); | 107 getInstrumentation().waitForIdleSync(); |
106 ApplicationTestUtils.waitUntilChromeInForeground(); | 108 ApplicationTestUtils.waitUntilChromeInForeground(); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 secondActivity.getActivityTab().getWebContents(), "window.close(
)"); | 351 secondActivity.getActivityTab().getWebContents(), "window.close(
)"); |
350 assertTrue(CriteriaHelper.pollForUIThreadCriteria(new Criteria() { | 352 assertTrue(CriteriaHelper.pollForUIThreadCriteria(new Criteria() { |
351 @Override | 353 @Override |
352 public boolean isSatisfied() { | 354 public boolean isSatisfied() { |
353 return webappActivity == ApplicationStatus.getLastTrackedFocused
Activity(); | 355 return webappActivity == ApplicationStatus.getLastTrackedFocused
Activity(); |
354 } | 356 } |
355 })); | 357 })); |
356 ApplicationTestUtils.waitUntilChromeInForeground(); | 358 ApplicationTestUtils.waitUntilChromeInForeground(); |
357 } | 359 } |
358 } | 360 } |
OLD | NEW |