Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappInfoTest.java

Issue 2815103004: Android: convert kEnumName to ENUM_NAME in java_cpp_enum.py. (Closed)
Patch Set: Address agrieve@ comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.content.Intent; 7 import android.content.Intent;
8 import android.support.test.filters.SmallTest; 8 import android.support.test.filters.SmallTest;
9 9
10 import org.junit.Assert; 10 import org.junit.Assert;
(...skipping 15 matching lines...) Expand all
26 @Test 26 @Test
27 @SmallTest 27 @SmallTest
28 @Feature({"Webapps"}) 28 @Feature({"Webapps"})
29 public void testAbout() { 29 public void testAbout() {
30 String id = "webapp id"; 30 String id = "webapp id";
31 String name = "longName"; 31 String name = "longName";
32 String shortName = "name"; 32 String shortName = "name";
33 String url = "about:blank"; 33 String url = "about:blank";
34 34
35 WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName , 35 WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName ,
36 WebDisplayMode.kStandalone, ScreenOrientationValues.DEFAULT, Sho rtcutSource.UNKNOWN, 36 WebDisplayMode.STANDALONE, ScreenOrientationValues.DEFAULT, Shor tcutSource.UNKNOWN,
37 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, 37 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING,
38 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false); 38 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false);
39 Assert.assertNotNull(info); 39 Assert.assertNotNull(info);
40 } 40 }
41 41
42 @Test 42 @Test
43 @SmallTest 43 @SmallTest
44 @Feature({"Webapps"}) 44 @Feature({"Webapps"})
45 public void testRandomUrl() { 45 public void testRandomUrl() {
46 String id = "webapp id"; 46 String id = "webapp id";
47 String name = "longName"; 47 String name = "longName";
48 String shortName = "name"; 48 String shortName = "name";
49 String url = "http://google.com"; 49 String url = "http://google.com";
50 50
51 WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName , 51 WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName ,
52 WebDisplayMode.kStandalone, ScreenOrientationValues.DEFAULT, Sho rtcutSource.UNKNOWN, 52 WebDisplayMode.STANDALONE, ScreenOrientationValues.DEFAULT, Shor tcutSource.UNKNOWN,
53 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, 53 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING,
54 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false); 54 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false);
55 Assert.assertNotNull(info); 55 Assert.assertNotNull(info);
56 } 56 }
57 57
58 @Test 58 @Test
59 @SmallTest 59 @SmallTest
60 @Feature({"Webapps"}) 60 @Feature({"Webapps"})
61 public void testSpacesInUrl() { 61 public void testSpacesInUrl() {
62 String id = "webapp id"; 62 String id = "webapp id";
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 @Test 137 @Test
138 @SmallTest 138 @SmallTest
139 @Feature({"Webapps"}) 139 @Feature({"Webapps"})
140 public void testDisplayModeAndOrientationAndSource() { 140 public void testDisplayModeAndOrientationAndSource() {
141 String id = "webapp id"; 141 String id = "webapp id";
142 String name = "longName"; 142 String name = "longName";
143 String shortName = "name"; 143 String shortName = "name";
144 String url = "http://money.cnn.com"; 144 String url = "http://money.cnn.com";
145 145
146 WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName , 146 WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName ,
147 WebDisplayMode.kFullscreen, ScreenOrientationValues.DEFAULT, Sho rtcutSource.UNKNOWN, 147 WebDisplayMode.FULLSCREEN, ScreenOrientationValues.DEFAULT, Shor tcutSource.UNKNOWN,
148 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, 148 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING,
149 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false); 149 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false);
150 Assert.assertEquals(WebDisplayMode.kFullscreen, info.displayMode()); 150 Assert.assertEquals(WebDisplayMode.FULLSCREEN, info.displayMode());
151 Assert.assertEquals(ScreenOrientationValues.DEFAULT, info.orientation()) ; 151 Assert.assertEquals(ScreenOrientationValues.DEFAULT, info.orientation()) ;
152 Assert.assertEquals(ShortcutSource.UNKNOWN, info.source()); 152 Assert.assertEquals(ShortcutSource.UNKNOWN, info.source());
153 } 153 }
154 154
155 @Test 155 @Test
156 @SmallTest 156 @SmallTest
157 @Feature({"Webapps"}) 157 @Feature({"Webapps"})
158 public void testNormalColors() { 158 public void testNormalColors() {
159 String id = "webapp id"; 159 String id = "webapp id";
160 String name = "longName"; 160 String name = "longName";
161 String shortName = "name"; 161 String shortName = "name";
162 String url = "http://money.cnn.com"; 162 String url = "http://money.cnn.com";
163 long themeColor = 0xFF00FF00L; 163 long themeColor = 0xFF00FF00L;
164 long backgroundColor = 0xFF0000FFL; 164 long backgroundColor = 0xFF0000FFL;
165 165
166 WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName , 166 WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName ,
167 WebDisplayMode.kStandalone, ScreenOrientationValues.DEFAULT, Sho rtcutSource.UNKNOWN, 167 WebDisplayMode.STANDALONE, ScreenOrientationValues.DEFAULT, Shor tcutSource.UNKNOWN,
168 themeColor, backgroundColor, false); 168 themeColor, backgroundColor, false);
169 Assert.assertEquals(themeColor, info.themeColor()); 169 Assert.assertEquals(themeColor, info.themeColor());
170 Assert.assertEquals(backgroundColor, info.backgroundColor()); 170 Assert.assertEquals(backgroundColor, info.backgroundColor());
171 } 171 }
172 172
173 @Test 173 @Test
174 @SmallTest 174 @SmallTest
175 @Feature({"Webapps"}) 175 @Feature({"Webapps"})
176 public void testInvalidOrMissingColors() { 176 public void testInvalidOrMissingColors() {
177 String id = "webapp id"; 177 String id = "webapp id";
178 String name = "longName"; 178 String name = "longName";
179 String shortName = "name"; 179 String shortName = "name";
180 String url = "http://money.cnn.com"; 180 String url = "http://money.cnn.com";
181 181
182 WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName , 182 WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName ,
183 WebDisplayMode.kStandalone, ScreenOrientationValues.DEFAULT, Sho rtcutSource.UNKNOWN, 183 WebDisplayMode.STANDALONE, ScreenOrientationValues.DEFAULT, Shor tcutSource.UNKNOWN,
184 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, 184 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING,
185 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false); 185 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false);
186 Assert.assertEquals(ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, in fo.themeColor()); 186 Assert.assertEquals(ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, in fo.themeColor());
187 Assert.assertEquals( 187 Assert.assertEquals(
188 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, info.backgroun dColor()); 188 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, info.backgroun dColor());
189 } 189 }
190 190
191 @Test 191 @Test
192 @SmallTest 192 @SmallTest
193 @Feature({"Webapps"}) 193 @Feature({"Webapps"})
(...skipping 30 matching lines...) Expand all
224 intent.putExtra(ShortcutHelper.EXTRA_URL, url); 224 intent.putExtra(ShortcutHelper.EXTRA_URL, url);
225 WebappInfo info = WebappInfo.create(intent); 225 WebappInfo info = WebappInfo.create(intent);
226 Assert.assertEquals(ShortcutHelper.getScopeFromUrl(url), info.scopeUri() .toString()); 226 Assert.assertEquals(ShortcutHelper.getScopeFromUrl(url), info.scopeUri() .toString());
227 } 227 }
228 228
229 @Test 229 @Test
230 @SmallTest 230 @SmallTest
231 @Feature({"Webapps"}) 231 @Feature({"Webapps"})
232 public void testIntentDisplayMode() { 232 public void testIntentDisplayMode() {
233 Intent intent = createIntentWithUrlAndId(); 233 Intent intent = createIntentWithUrlAndId();
234 intent.putExtra(ShortcutHelper.EXTRA_DISPLAY_MODE, WebDisplayMode.kMinim alUi); 234 intent.putExtra(ShortcutHelper.EXTRA_DISPLAY_MODE, WebDisplayMode.MINIMA L_UI);
235 WebappInfo info = WebappInfo.create(intent); 235 WebappInfo info = WebappInfo.create(intent);
236 Assert.assertEquals(WebDisplayMode.kMinimalUi, info.displayMode()); 236 Assert.assertEquals(WebDisplayMode.MINIMAL_UI, info.displayMode());
237 } 237 }
238 238
239 @Test 239 @Test
240 @SmallTest 240 @SmallTest
241 @Feature({"Webapps"}) 241 @Feature({"Webapps"})
242 public void testIntentOrientation() { 242 public void testIntentOrientation() {
243 Intent intent = createIntentWithUrlAndId(); 243 Intent intent = createIntentWithUrlAndId();
244 intent.putExtra(ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValue s.LANDSCAPE); 244 intent.putExtra(ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValue s.LANDSCAPE);
245 WebappInfo info = WebappInfo.create(intent); 245 WebappInfo info = WebappInfo.create(intent);
246 Assert.assertEquals(ScreenOrientationValues.LANDSCAPE, info.orientation( )); 246 Assert.assertEquals(ScreenOrientationValues.LANDSCAPE, info.orientation( ));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 * Creates intent with url and id. If the url or id are not set WebappInfo#c reate() returns 307 * Creates intent with url and id. If the url or id are not set WebappInfo#c reate() returns
308 * null. 308 * null.
309 */ 309 */
310 private Intent createIntentWithUrlAndId() { 310 private Intent createIntentWithUrlAndId() {
311 Intent intent = new Intent(); 311 Intent intent = new Intent();
312 intent.putExtra(ShortcutHelper.EXTRA_ID, "web app id"); 312 intent.putExtra(ShortcutHelper.EXTRA_ID, "web app id");
313 intent.putExtra(ShortcutHelper.EXTRA_URL, "about:blank"); 313 intent.putExtra(ShortcutHelper.EXTRA_URL, "about:blank");
314 return intent; 314 return intent;
315 } 315 }
316 } 316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698