Skip to content

check for dex files #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions data/issues/android-runtime-pr-923/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
In NativeScript, the app.js file is the entry point to your application.
You can use this file to perform app-level initialization, but the primary
purpose of the file is to pass control to the app’s first module.
*/

require("./bundle-config");
var application = require("application");
var extendedClassesSpaces = require("./extended-classes spaces");
var extendedClassesDashes = require("./extended-classes-dashes");
var extendedClassesInDirWithSpaces = require("./dir spaces/extended-classes");

var i1 = extendedClassesSpaces.getExtendedClassInstance();
var i2 = extendedClassesDashes.getExtendedClassInstance();
var i3 = extendedClassesInDirWithSpaces.getExtendedClassInstance();

application.start({ moduleName: "main-page" });

/*
Do not place any code after the application has been started as it will not
be executed on iOS.
*/
23 changes: 23 additions & 0 deletions data/issues/android-runtime-pr-923/dir spaces/extended-classes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function getExtendedClasses() {
var ExtendedClass = java.lang.Object.extend({

});

return {
ExtendedClass
};
}

function getExtendedClassInstance() {
var Clazz = getExtendedClasses().ExtendedClass;
var instance;

instance = new Clazz();

return instance;
}

module.exports = {
getExtendedClasses,
getExtendedClassInstance
}
23 changes: 23 additions & 0 deletions data/issues/android-runtime-pr-923/extended-classes spaces.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function getExtendedClasses() {
var ExtendedClass = java.lang.Object.extend({

});

return {
ExtendedClass
};
}

function getExtendedClassInstance() {
var Clazz = getExtendedClasses().ExtendedClass;
var instance;

instance = new Clazz();

return instance;
}

module.exports = {
getExtendedClasses,
getExtendedClassInstance
}
23 changes: 23 additions & 0 deletions data/issues/android-runtime-pr-923/extended-classes-dashes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function getExtendedClasses() {
var ExtendedClass = android.view.View.MeasureSpec.extend({

});

return {
ExtendedClass
};
}

function getExtendedClassInstance() {
var Clazz = getExtendedClasses().ExtendedClass;
var instance;

instance = new Clazz();

return instance;
}

module.exports = {
getExtendedClasses,
getExtendedClassInstance
}
29 changes: 28 additions & 1 deletion tests/emulator/run_android_ng_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
from core.base_class.BaseClass import BaseClass
from core.device.device import Device
from core.device.emulator import Emulator
from core.osutils.command_log_level import CommandLogLevel
from core.osutils.file import File
from core.osutils.folder import Folder
from core.osutils.os_type import OSType
from core.settings.settings import ANDROID_PACKAGE, EMULATOR_ID, EMULATOR_NAME, CURRENT_OS
from core.settings.settings import ANDROID_PACKAGE, EMULATOR_ID, EMULATOR_NAME, CURRENT_OS, TEST_RUN_HOME
from core.tns.replace_helper import ReplaceHelper
from core.tns.tns import Tns
from core.tns.tns_platform_type import Platform
from core.device.helpers.adb import Adb


class RunAndroidEmulatorTestsNG(BaseClass):
Expand Down Expand Up @@ -210,3 +212,28 @@ def test_280_tns_run_android_console_time(self):
# Verify console.time() works
console_time = ['JS: startup:']
Tns.wait_for_log(log_file=log, string_list=console_time)


def test_420_check_dex_files_on_device(self):
"""
check for files on device - shouldn't have *.dex
"""
Tns.platform_remove(platform=Platform.ANDROID, attributes={"--path": self.app_name},
assert_success=False)
File.remove(self.app_name + "/app/app.js")
Folder.copy(TEST_RUN_HOME + "/data/issues/android-runtime-pr-923/app.js", TEST_RUN_HOME + "/TestApp/app/")
Folder.create(self.app_name + "/app/" + "dir spaces")

Folder.copy(TEST_RUN_HOME + "/data/issues/android-runtime-pr-923/dir spaces/extended-classes.js",
TEST_RUN_HOME + "/TestApp/app/dir spaces")
Folder.copy(TEST_RUN_HOME + "/data/issues/android-runtime-pr-923/extended-classes spaces.js",
TEST_RUN_HOME + "/TestApp/app")
Folder.copy(TEST_RUN_HOME + "/data/issues/android-runtime-pr-923/extended-classes-dashes.js",
TEST_RUN_HOME + "/TestApp/app")

Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID, '--justlaunch': ''})
# command = "shell ls /data/data/org.nativescript.TestApp/code_cache/secondary-dexes | grep '\.dex'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we delete commented code?

command = "shell ls /data/data/org.nativescript.TestApp/code_cache/secondary-dexes"
output = Adb.run(device_id=EMULATOR_ID, command=command, log_level=CommandLogLevel.FULL)
print output
assert "dex" in output