Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: adblock-android-tests/src/org/adblockplus/libadblockplus/tests/AppInfoJsObjectTest.java

Issue 29819555: Fix libadblockplus-android tests
Patch Set: Fixed indentation issues. Created Aug. 27, 2018, 8:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 package org.adblockplus.libadblockplus.tests; 18 package org.adblockplus.libadblockplus.tests;
19 19
20 import org.adblockplus.libadblockplus.AppInfo; 20 import org.adblockplus.libadblockplus.AppInfo;
21 import org.adblockplus.libadblockplus.JsEngine;
22 21
22 import org.adblockplus.libadblockplus.BasePlatformTest;
23 import org.junit.Test; 23 import org.junit.Test;
24 24
25 public class AppInfoJsObjectTest extends BasePlatformTest 25 public class AppInfoJsObjectTest extends BasePlatformTest
26 { 26 {
27 @Test 27 @Test
28 public void testAllProperties() 28 public void testAllProperties()
29 { 29 {
30 AppInfo appInfo = AppInfo 30 setAppInfo(AppInfo
31 .builder() 31 .builder()
32 .setVersion("1") 32 .setVersion("1")
33 .setName("3") 33 .setName("3")
34 .setApplication("4") 34 .setApplication("4")
35 .setApplicationVersion("5") 35 .setApplicationVersion("5")
36 .setLocale("2") 36 .setLocale("2")
37 .setDevelopmentBuild(true) 37 .setDevelopmentBuild(true)
38 .build(); 38 .build());
39 39
40 platform.setUpJsEngine(appInfo); 40 setupJsEngine();
41 JsEngine jsEngine = platform.getJsEngine();
42 assertEquals("1", jsEngine.evaluate("_appInfo.version").asString()); 41 assertEquals("1", jsEngine.evaluate("_appInfo.version").asString());
43 assertEquals("3", jsEngine.evaluate("_appInfo.name").asString()); 42 assertEquals("3", jsEngine.evaluate("_appInfo.name").asString());
44 assertEquals("4", jsEngine.evaluate("_appInfo.application").asString()); 43 assertEquals("4", jsEngine.evaluate("_appInfo.application").asString());
45 assertEquals("5", jsEngine.evaluate("_appInfo.applicationVersion").asString( )); 44 assertEquals("5", jsEngine.evaluate("_appInfo.applicationVersion").asString( ));
46 assertEquals("2", jsEngine.evaluate("_appInfo.locale").asString()); 45 assertEquals("2", jsEngine.evaluate("_appInfo.locale").asString());
47 assertTrue(jsEngine.evaluate("_appInfo.developmentBuild").asBoolean()); 46 assertTrue(jsEngine.evaluate("_appInfo.developmentBuild").asBoolean());
48 } 47 }
49 48
50 @Test 49 @Test
51 public void testDefaultPropertyValues() 50 public void testDefaultPropertyValues()
52 { 51 {
53 AppInfo appInfo = AppInfo 52 setAppInfo(AppInfo
54 .builder() 53 .builder()
55 .build(); 54 .build());
56 platform.setUpJsEngine(appInfo); 55 setupJsEngine();
57 JsEngine jsEngine = platform.getJsEngine();
58 assertEquals("1.0", jsEngine.evaluate("_appInfo.version").asString()); 56 assertEquals("1.0", jsEngine.evaluate("_appInfo.version").asString());
59 assertEquals("libadblockplus-android", jsEngine.evaluate("_appInfo.name").as String()); 57 assertEquals("libadblockplus-android", jsEngine.evaluate("_appInfo.name").as String());
60 assertEquals("android", jsEngine.evaluate("_appInfo.application").asString() ); 58 assertEquals("android", jsEngine.evaluate("_appInfo.application").asString() );
61 assertEquals("0", jsEngine.evaluate("_appInfo.applicationVersion").asString( )); 59 assertEquals("0", jsEngine.evaluate("_appInfo.applicationVersion").asString( ));
62 assertEquals("en_US", jsEngine.evaluate("_appInfo.locale").asString()); 60 assertEquals("en_US", jsEngine.evaluate("_appInfo.locale").asString());
63 assertFalse(jsEngine.evaluate("_appInfo.developmentBuild").asBoolean()); 61 assertFalse(jsEngine.evaluate("_appInfo.developmentBuild").asBoolean());
64 } 62 }
65 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld