Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / xwalk / app / tools / android / make_apk_test.py
index d01ba4f..80254cf 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# coding: UTF-8
 
 # Copyright (c) 2013, 2014 Intel Corporation. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
@@ -12,8 +13,6 @@ import sys
 import unittest
 import warnings
 
-from customize import ReplaceSpaceWithUnderscore
-
 
 def Clean(name, app_version):
   if os.path.exists(name):
@@ -132,7 +131,7 @@ class TestMakeApk(unittest.TestCase):
     # replace the original native library with an empty library.
     # Because it doesn't affect the result of test.
     if options.mode == 'embedded':
-      native_library_dir = 'native_libs'
+      native_library_dir = os.path.join('xwalk_core_library', 'libs')
       native_library_temp_dir = 'temp'
       shutil.copytree(native_library_dir, native_library_temp_dir)
       for root, _, files in os.walk(native_library_dir):
@@ -147,17 +146,17 @@ class TestMakeApk(unittest.TestCase):
   def restoreNativeLibrary():
     # Restore the original native library for embedded mode.
     if options.mode == 'embedded':
-      native_library_dir = 'native_libs'
+      native_library_dir = os.path.join('xwalk_core_library', 'libs')
       native_library_temp_dir = 'temp'
-      if os.path.exists(native_library_dir):
+      if os.path.isdir(native_library_dir):
         shutil.rmtree(native_library_dir)
       shutil.move(native_library_temp_dir, native_library_dir)
 
   @staticmethod
   def archs():
-    x86_native_lib_path = os.path.join('native_libs', 'x86', 'libs',
+    x86_native_lib_path = os.path.join('xwalk_core_library', 'libs',
                                        'x86', 'libxwalkcore.so')
-    arm_native_lib_path = os.path.join('native_libs', 'armeabi-v7a', 'libs',
+    arm_native_lib_path = os.path.join('xwalk_core_library', 'libs',
                                        'armeabi-v7a', 'libxwalkcore.so')
     arch_list = []
     if os.path.isfile(x86_native_lib_path):
@@ -202,26 +201,18 @@ class TestMakeApk(unittest.TestCase):
 
   def testName(self):
     cmd = ['python', 'make_apk.py', '--app-version=1.0.0',
+           '--app-url=http://www.intel.com',
            '--package=org.xwalk.example', self._mode]
     out = RunCommand(cmd)
     Clean('Example', '1.0.0')
-    self.assertTrue(out.find('The APK name is required!') != -1)
+    self.assertIn('An APK name is required', out)
 
     cmd = ['python', 'make_apk.py', '--name=Test_Example',
            '--app-version=1.0.0', '--app-url=http://www.intel.com',
            '--package=org.xwalk.example', self._mode]
     out = RunCommand(cmd)
-    self.assertTrue(out.find('The APK name is required!') == -1)
-    Clean('Test_Example', '1.0.0')
-
-    invalid_chars = '\/:.*?"<>|-'
-    for c in invalid_chars:
-      invalid_name = '--name=Example' + c
-      cmd = ['python', 'make_apk.py', invalid_name,
-             '--app-version=1.0.0', '--package=org.xwalk.example',
-             '--app-url=http://www.intel.com', self._mode]
-      out = RunCommand(cmd)
-      self.assertTrue(out.find('invalid characters') != -1)
+    self.assertNotIn('An APK name is required', out)
+    Clean('Example', '1.0.0')
 
   def testToolVersion(self):
     cmd = ['python', 'make_apk.py', '--version']
@@ -332,15 +323,38 @@ class TestMakeApk(unittest.TestCase):
 
   def testPackage(self):
     cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
-           self._mode]
+           '--app-url=http://www.intel.com', self._mode]
     out = RunCommand(cmd)
-    self.addCleanup(Clean, 'Example', '1.0.0')
-    self.assertTrue(out.find('The package name is required!') != -1)
+    self.assertIn('A package name is required', out)
+
+    cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
+           '--package=org.xwalk.example',
+           '--app-url=http://www.intel.com', self._mode]
+    out = RunCommand(cmd)
+    self.assertNotIn('A package name is required', out)
     Clean('Example', '1.0.0')
+
+  def testPackageWithInvalidCharacter(self):
+    package_name_error = 'package name should be started with letters'
+
     cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
-           '--package=org.xwalk.example', self._mode]
+           '--package=org.xwalk._example',
+           '--app-url=http://www.intel.com', self._mode]
     out = RunCommand(cmd)
-    self.assertTrue(out.find('The package name is required!') == -1)
+    self.assertIn(package_name_error, out)
+
+    cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
+           '--package=org.xwalk.123example',
+           '--app-url=http://www.intel.com', self._mode]
+    out = RunCommand(cmd)
+    self.assertIn(package_name_error, out)
+
+    cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
+           '--package=org.xwalk.example_',
+           '--app-url=http://www.intel.com', self._mode]
+    out = RunCommand(cmd)
+    self.assertNotIn(package_name_error, out)
+    Clean('Example', '1.0.0')
 
   def testEntry(self):
     cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
@@ -405,8 +419,8 @@ class TestMakeApk(unittest.TestCase):
 
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_app_launch_local_path.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
-           self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, self._mode]
     out = RunCommand(cmd)
     self.assertTrue(
         out.find('Please make sure that the local path file') != -1)
@@ -444,7 +458,7 @@ class TestMakeApk(unittest.TestCase):
            '-f', self._mode]
     RunCommand(cmd)
     self.addCleanup(Clean, 'Example', '1.0.0')
-    theme = 'Example/res/values/theme.xml'
+    theme = 'Example/res/values-v14/theme.xml'
     with open(theme, 'r') as content_file:
       content = content_file.read()
     self.assertTrue(os.path.exists(theme))
@@ -468,6 +482,7 @@ class TestMakeApk(unittest.TestCase):
     Clean('Example', '1.0.0')
     manifest_path = os.path.join('test_data', 'manifest', 'manifest.json')
     cmd = ['python', 'make_apk.py', '--enable-remote-debugging',
+           '--package=org.xwalk.example',
            '--manifest=%s' % manifest_path, self._mode]
     RunCommand(cmd)
     activity = 'Example/src/org/xwalk/example/ExampleActivity.java'
@@ -483,7 +498,8 @@ class TestMakeApk(unittest.TestCase):
     cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
            '--package=org.xwalk.example', '--app-url=http://www.intel.com',
            '--keystore-path=%s' % keystore_path, '--keystore-alias=xwalk-test',
-           '--keystore-passcode=xwalk-test', self._mode]
+           '--keystore-passcode=xwalk-test',
+           '--keystore-alias-passcode=xwalk-test', self._mode]
     RunCommand(cmd)
     self.addCleanup(Clean, 'Example', '1.0.0')
     self.assertTrue(os.path.exists('Example'))
@@ -498,8 +514,8 @@ class TestMakeApk(unittest.TestCase):
 
   def testManifest(self):
     manifest_path = os.path.join('test_data', 'manifest', 'manifest.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
-           self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, self._mode]
     RunCommand(cmd)
     self.addCleanup(Clean, 'Example', '1.0.0')
     manifest = 'Example/AndroidManifest.xml'
@@ -515,7 +531,7 @@ class TestMakeApk(unittest.TestCase):
     self.assertTrue(content.find('android.permission.SEND_SMS') != -1)
     self.assertTrue(content.find('android.permission.WRITE_SMS') != -1)
     self.assertTrue(content.find('landscape') != -1)
-    theme = 'Example/res/values/theme.xml'
+    theme = 'Example/res/values-v14/theme.xml'
     with open(theme, 'r') as content_file:
       content = content_file.read()
     self.assertTrue(os.path.exists(theme))
@@ -528,8 +544,8 @@ class TestMakeApk(unittest.TestCase):
   def testManifestWithSpecificValue(self):
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_app_launch_local_path.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
-           self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, self._mode]
     out = RunCommand(cmd)
     self.addCleanup(Clean, 'Example', '1.0.0')
     self.assertTrue(out.find('no app launch path') == -1)
@@ -538,68 +554,83 @@ class TestMakeApk(unittest.TestCase):
   def testManifestWithDeprecatedField(self):
     manifest_path = os.path.join('test_data', 'manifest', 'deprecated',
                                  'manifest_app_local_path.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path, self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, self._mode]
     out = RunCommand(cmd)
     self.addCleanup(Clean, 'Example', '1.0.0')
-    self.assertTrue(out.find(
-        'WARNING: app.launch.local_path is deprecated for Crosswalk') != -1)
+    self.assertIn('WARNING: app.launch.local_path is deprecated for Crosswalk',
+                  out)
     Clean('Example', '1.0.0')
+
     manifest_path = os.path.join('test_data', 'manifest', 'deprecated',
                                  'manifest_launch_path.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path, self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, self._mode]
     out = RunCommand(cmd)
-    self.assertTrue(
-        out.find('WARNING: launch_path is deprecated for Crosswalk') != -1)
+    self.assertIn('WARNING: launch_path is deprecated for Crosswalk', out)
     Clean('Example', '1.0.0')
+
     manifest_path = os.path.join('test_data', 'manifest', 'deprecated',
                                  'manifest_permissions.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path, self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, self._mode]
     out = RunCommand(cmd)
-    self.assertTrue(
-        out.find('WARNING: permissions is deprecated for Crosswalk') != -1)
+    self.assertIn('WARNING: permissions is deprecated for Crosswalk', out)
     Clean('Example', '1.0.0')
+
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_deprecated_icon.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path, self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, self._mode]
+    out = RunCommand(cmd)
+    self.assertIn('WARNING: icons defined as dictionary form is deprecated',
+                  out)
+    Clean('Example', '1.0.0')
+
+    manifest_path = os.path.join('test_data', 'manifest', 'deprecated',
+                                 'manifest_description.json')
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, self._mode]
+    out = RunCommand(cmd)
+    self.assertIn('WARNING: description is deprecated for Crosswalk', out)
+    Clean('Example', '1.0.0')
+
+    manifest_path = os.path.join('test_data', 'manifest', 'deprecated',
+                                 'manifest_deprecated_version.json')
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, self._mode]
     out = RunCommand(cmd)
-    self.assertTrue(out.find(
-        'WARNING: icons defined as dictionary form is deprecated') != -1)
+    self.assertIn('WARNING: version is deprecated for Crosswalk', out)
 
   def testManifestWithError(self):
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_no_app_launch_path.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
-           '--verbose', self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, '--verbose', self._mode]
     out = RunCommand(cmd)
     self.assertTrue(out.find('no app launch path') != -1)
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_no_name.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
-           '--verbose', self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, '--verbose', self._mode]
     out = RunCommand(cmd)
     self.assertTrue(out.find('no \'name\' field') != -1)
     manifest_path = os.path.join('test_data', 'manifest',
-                                 'manifest_no_version.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
-           '--verbose', self._mode]
-    out = RunCommand(cmd)
-    self.assertTrue(out.find('no \'version\' field') != -1)
-    manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_permissions_format_error.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
-           '--verbose', self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, '--verbose', self._mode]
     out = RunCommand(cmd)
     self.assertTrue(out.find('\'Permissions\' field error') != -1)
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_permissions_field_error.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
-           '--verbose', self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, '--verbose', self._mode]
     out = RunCommand(cmd)
     self.assertTrue(out.find('\'Permissions\' field error') != -1)
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_not_supported_permission.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
-           '--verbose', self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, '--verbose', self._mode]
     out = RunCommand(cmd)
     self.assertTrue(
         out.find('\'Telephony\' related API is not supported') != -1)
@@ -658,7 +689,8 @@ class TestMakeApk(unittest.TestCase):
 
   def testXPK(self):
     xpk_file = os.path.join('test_data', 'xpk', 'example.xpk')
-    cmd = ['python', 'make_apk.py', '--xpk=%s' % xpk_file, self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--xpk=%s' % xpk_file, self._mode]
     RunCommand(cmd)
     self.addCleanup(Clean, 'Example', '1.0.0')
     self.assertTrue(os.path.exists('Example'))
@@ -666,7 +698,8 @@ class TestMakeApk(unittest.TestCase):
 
   def testXPKWithError(self):
     xpk_file = os.path.join('test_data', 'xpk', 'error.xpk')
-    cmd = ['python', 'make_apk.py', '--xpk=%s' % xpk_file, self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--xpk=%s' % xpk_file, self._mode]
     out = RunCommand(cmd)
     error_msg = 'XPK doesn\'t contain manifest file'
     self.assertTrue(out.find(error_msg) != -1)
@@ -749,7 +782,7 @@ class TestMakeApk(unittest.TestCase):
 
   def executeCommandAndVerifyResult(self, exec_file):
     # Test all of supported options with empty 'mode' option.
-    icon_path = './app_src/res/drawable-xhdpi/crosswalk.png'
+    icon_path = './template/res/drawable-xhdpi/crosswalk.png'
     extension_path = 'test_data/extensions/myextension'
     arch = ''
     icon = ''
@@ -794,7 +827,7 @@ class TestMakeApk(unittest.TestCase):
     # Test orientation option.
     self.assertTrue(content.find('landscape') != -1)
     # Test fullscreen option
-    theme = 'Example/res/values/theme.xml'
+    theme = 'Example/res/values-v14/theme.xml'
     with open(theme, 'r') as content_file:
       content = content_file.read()
     self.assertTrue(os.path.exists(theme))
@@ -849,16 +882,18 @@ class TestMakeApk(unittest.TestCase):
     # Run Test.
     manifest_path = os.path.join('test_data', 'launchScreen',
                                  'manifest_deprecated_launch_screen.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path, self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, self._mode]
     out = RunCommand(cmd)
     self.assertTrue(
         out.find('WARNING: launch_screen is deprecated for Crosswalk') != -1)
     Clean('Example', '1.0.0')
     manifest_path = os.path.join('test_data', 'launchScreen', 'manifest.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path, self._mode]
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path, self._mode]
     RunCommand(cmd)
     # Check theme.xml.
-    theme_path = os.path.join('Example', 'res', 'values', 'theme.xml')
+    theme_path = os.path.join('Example', 'res', 'values-v14', 'theme.xml')
     self.assertTrue(os.path.exists(theme_path))
     with open(theme_path, 'r') as content_file:
       content = content_file.read()
@@ -935,6 +970,7 @@ class TestMakeApk(unittest.TestCase):
 
     cmd = ['python', 'customize.py',
            '--name=%s' % name,
+           '--package=org.xwalk.example',
            '--compressor',
            '--app-root=%s' % app_root]
     RunCommand(cmd)
@@ -943,6 +979,7 @@ class TestMakeApk(unittest.TestCase):
 
     cmd = ['python', 'customize.py',
            '--name=%s' % name,
+           '--package=org.xwalk.example',
            '--app-root=%s' % app_root,
            '--compressor']
     RunCommand(cmd)
@@ -951,6 +988,7 @@ class TestMakeApk(unittest.TestCase):
 
     cmd = ['python', 'customize.py',
            '--name=%s' % name,
+           '--package=org.xwalk.example',
            '--compressor=js',
            '--app-root=%s' % app_root]
     RunCommand(cmd)
@@ -958,6 +996,7 @@ class TestMakeApk(unittest.TestCase):
 
     cmd = ['python', 'customize.py',
            '--name=%s' % name,
+           '--package=org.xwalk.example',
            '--compressor=css',
            '--app-root=%s' % app_root]
     RunCommand(cmd)
@@ -965,6 +1004,7 @@ class TestMakeApk(unittest.TestCase):
 
     cmd = ['python', 'customize.py',
            '--name=%s' % name,
+           '--package=org.xwalk.example',
            '--app-root=%s' % app_root]
     RunCommand(cmd)
     CompareSizeForCompressor(None, css_file, 'css', name, fun)
@@ -972,6 +1012,7 @@ class TestMakeApk(unittest.TestCase):
 
     cmd = ['python', 'customize.py',
            '--name=%s' % name,
+           '--package=org.xwalk.example',
            '--app-root=%s' % app_root,
            '--compressor=other']
     RunCommand(cmd)
@@ -980,90 +1021,48 @@ class TestMakeApk(unittest.TestCase):
 
     Clean(name, '1.0.0')
 
-  def testInvalidCharacter(self):
-    version = '1.0.0'
-    start_with_letters = ' should be started with letters'
-    app_name_error = 'app name' + start_with_letters
-    package_name_error = 'package name' + start_with_letters
-    parse_error = 'parser error in manifest.json file'
-    directory = os.path.join('test_data', 'manifest', 'invalidchars')
-
-    manifest_path = os.path.join(directory, 'manifest_with_space_name.json')
-    result = GetResultWithOption(self._mode, manifest_path)
-    self.assertTrue(result.find(app_name_error) != -1)
-
-    manifest_path = os.path.join(directory, 'manifest_with_chinese_name.json')
-    result = GetResultWithOption(self._mode, manifest_path)
-    self.assertTrue(result.find(app_name_error) != -1)
-
-    manifest_path = os.path.join(directory, 'manifest_parse_error.json')
-    result = GetResultWithOption(self._mode, manifest_path)
-    self.assertTrue(result.find(parse_error) != -1)
-
-    manifest_path = os.path.join(directory, 'manifest_with_invalid_name.json')
-    result = GetResultWithOption(self._mode, manifest_path)
-    self.assertTrue(result.find(app_name_error) != -1)
-
-    manifest_path = os.path.join(directory, 'manifest_contain_space_name.json')
-    result = GetResultWithOption(self._mode, manifest_path)
-    self.assertTrue(result.find(app_name_error) == -1)
-
-    package = 'org.xwalk.example'
-    name = '_hello'
-    result = GetResultWithOption(self._mode, name=name, package=package)
-    self.assertTrue(result.find(app_name_error) != -1)
-
-    name = '123hello'
-    result = GetResultWithOption(self._mode, name=name, package=package)
-    self.assertTrue(result.find(app_name_error) != -1)
-
-    name = 'hello_'
-    result = GetResultWithOption(self._mode, name=name, package=package)
-    self.assertTrue(result.find(app_name_error) == -1)
-    Clean(name, version)
-
-    name = 'xwalk'
-    package = 'org.xwalk._example'
-    result = GetResultWithOption(self._mode, name=name, package=package)
-    self.assertTrue(result.find(package_name_error) != -1)
-
-    package = 'org.xwalk.123example'
-    result = GetResultWithOption(self._mode, name=name, package=package)
-    self.assertTrue(result.find(package_name_error) != -1)
-
-    package = 'org.xwalk.example_'
-    result = GetResultWithOption(self._mode, name=name, package=package)
-    self.assertTrue(result.find(package_name_error) == -1)
-    Clean(name, version)
-
-
-  def VerifyResultForAppNameWithSpace(self, manifest=None, name=None,
-                                      package=None):
-    version = '1.0.0'
-    GetResultWithOption(manifest=manifest, name=name, package=package)
-    if name is None:
-      name = 'app name '
-    replaced_name = ReplaceSpaceWithUnderscore(name)
-    manifest = replaced_name + '/AndroidManifest.xml'
-    with open(manifest, 'r') as content_file:
+
+  def VerifyResultInXMLFile(self, xml_path, piece_content):
+    self.assertTrue(os.path.exists(xml_path))
+    with open(xml_path, 'r') as content_file:
       content = content_file.read()
-    self.assertTrue(os.path.exists(manifest))
-    self.assertTrue(name in content)
-    Clean(replaced_name, version)
 
+    self.assertIn(piece_content, content)
+    Clean('Example', '1.0.0')
+
+
+  def testAppNameWithNonASCII(self):
+    xml_path = 'Example/AndroidManifest.xml'
+    piece_content = 'android:label="%s"' % '你好'
+    cmd = ['python', 'make_apk.py', '--name=你好', '--app-version=1.0.0',
+           '--package=org.xwalk.example', '--app-url=http://www.intel.com']
+    RunCommand(cmd)
+    self.VerifyResultInXMLFile(xml_path, piece_content)
 
-  def testAppNameWithSpace(self):
-    name = 'app name'
-    package = 'org.xwalk.app_name'
+    manifest_path = os.path.join('test_data', 'manifest', 'invalidchars',
+                                 'manifest_with_chinese_name.json')
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path]
+    RunCommand(cmd)
+    self.VerifyResultInXMLFile(xml_path, piece_content)
 
-    self.VerifyResultForAppNameWithSpace(name=name, package=package)
 
-    name = 'app name '
-    self.VerifyResultForAppNameWithSpace(name=name, package=package)
+  def testDescriptionWithDBCS(self):
+    xml_path = 'Example/res/values/strings.xml'
+    piece_content = '<string name="description">%s</string>' % '你好'
+    cmd = ['python', 'make_apk.py', '--name=hello', '--app-version=1.0.0',
+           '--package=org.xwalk.example', '--app-url=http://www.intel.com',
+           '--description=你好']
+    RunCommand(cmd)
+    self.VerifyResultInXMLFile(xml_path, piece_content)
 
-    directory = os.path.join('test_data', 'manifest', 'invalidchars')
-    manifest_path = os.path.join(directory, 'manifest_contain_space_name.json')
-    self.VerifyResultForAppNameWithSpace(manifest=manifest_path)
+    manifest_path = os.path.join('test_data', 'manifest',
+                                 'manifest_description_dbcs.json')
+    cmd = ['python', 'make_apk.py', '--package=org.xwalk.example',
+           '--manifest=%s' % manifest_path]
+    RunCommand(cmd)
+    piece_content = '"description">%s</string>' % '你好 a sample description'
+    self.VerifyResultInXMLFile(xml_path, piece_content)
 
 
 def SuiteWithModeOption():
@@ -1083,7 +1082,6 @@ def SuiteWithModeOption():
   test_suite.addTest(TestMakeApk('testFullscreen'))
   test_suite.addTest(TestMakeApk('testIconByOption'))
   test_suite.addTest(TestMakeApk('testIconByManifest'))
-  test_suite.addTest(TestMakeApk('testInvalidCharacter'))
   test_suite.addTest(TestMakeApk('testKeystore'))
   test_suite.addTest(TestMakeApk('testManifest'))
   test_suite.addTest(TestMakeApk('testManifestWithDeprecatedField'))
@@ -1091,6 +1089,7 @@ def SuiteWithModeOption():
   test_suite.addTest(TestMakeApk('testName'))
   test_suite.addTest(TestMakeApk('testOrientation'))
   test_suite.addTest(TestMakeApk('testPackage'))
+  test_suite.addTest(TestMakeApk('testPackageWithInvalidCharacter'))
   test_suite.addTest(TestMakeApk('testPermissions'))
   test_suite.addTest(TestMakeApk('testPermissionsWithError'))
   test_suite.addTest(TestMakeApk('testXPK'))
@@ -1103,9 +1102,10 @@ def SuiteWithModeOption():
 def SuiteWithEmptyModeOption():
   # Gather all the tests for empty mode option.
   test_suite = unittest.TestSuite()
-  test_suite.addTest(TestMakeApk('testAppNameWithSpace'))
+  test_suite.addTest(TestMakeApk('testAppNameWithNonASCII'))
   test_suite.addTest(TestMakeApk('testCompressor'))
   test_suite.addTest(TestMakeApk('testCustomizeFile'))
+  test_suite.addTest(TestMakeApk('testDescriptionWithDBCS'))
   test_suite.addTest(TestMakeApk('testEmptyMode'))
   test_suite.addTest(TestMakeApk('testToolVersion'))
   test_suite.addTest(TestMakeApk('testVerbose'))