Esempio n. 1
0
    def test_pidof_service(self):
        class MockExecute:
            def run_command(self,
                            args,
                            cwd=None,
                            input=None,
                            error_handler=None,
                            return_exit_code=False,
                            return_stderr=True,
                            decode_output=False):
                cmd = string.join(args, " ")

                if return_exit_code:
                    return 0

                if cmd.endswith("adb shell ps"):
                    return """
USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
root      1     0     328    196   c00f7c18 000086cc S /init
root      2     0     0      0     c008fbbc 00000000 S kthreadd
root      3     2     0      0     c007dd74 00000000 S ksoftirqd/0
root      6     2     0      0     c00b08cc 00000000 S migration/0
root      7     2     0      0     c00b08cc 00000000 S migration/1
root      9     2     0      0     c007dd74 00000000 S ksoftirqd/1
root      10    2     0      0     c007dd74 00000000 S org.webkit.dumprendertree
"""
                raise RuntimeError("Unexpected cmd" + cmd)

        port = android.AndroidPort()

        port._executive = MockExecute()
        adb_server = android.AdbServerProcess(port, None, None,
                                              port._executive, 1, 2)
        self.assertEquals(10, adb_server._pid_of_service())
Esempio n. 2
0
    def test_env(self):
        old = os.environ['ANDROID_PRODUCT_OUT']

        os.environ['ANDROID_PRODUCT_OUT'] = '/a/b/c/d'
        port_obj = android.AndroidPort()
        self.assertEquals(port_obj._build_path("build"), "/a/b/c/d/build")

        os.environ['ANDROID_PRODUCT_OUT'] = old
Esempio n. 3
0
    def test_missing_env(self):
        old = os.environ['ANDROID_PRODUCT_OUT']

        del os.environ['ANDROID_PRODUCT_OUT']
        port_obj = android.AndroidPort()
        self.assertEquals(port_obj.check_sys_deps(False), False)

        os.environ['ANDROID_PRODUCT_OUT'] = old
Esempio n. 4
0
    def test_baselines(self):
        port_obj = android.AndroidPort()

        test_filename = port_obj._filesystem.join(
            port_obj.layout_tests_dir(), "fast/encoding/hebrew/8859-8-e.html")
        expected_filename = port_obj.expected_filename(test_filename, ".txt")
        exp = port_obj._filesystem.join(
            port_obj.layout_tests_dir(),
            "fast/encoding/hebrew/8859-8-e-expected.txt")
        self.assertEquals(exp, expected_filename)

        test_filename = port_obj._filesystem.join(
            port_obj.layout_tests_dir(),
            "android/fast/encoding/denormalised-voiced-japanese-chars.html")
        expected_filename = port_obj.expected_filename(test_filename, ".txt")
        exp = port_obj._filesystem.join(
            port_obj.layout_tests_dir(),
            "android/fast/encoding/denormalised-voiced-japanese-chars-expected.txt"
        )
        self.assertEquals(exp, expected_filename)
Esempio n. 5
0
 def make_port(self):
     port_obj = android.AndroidPort()
     return port_obj
Esempio n. 6
0
 def test_build_type(self):
     port_obj = android.AndroidPort()
     # Only release currently supported
     self.assertEquals(port_obj.test_configuration().build_type, "release")
Esempio n. 7
0
 def test_name(self):
     port_obj = android.AndroidPort()
     self.assertEquals(port_obj.name(), "android")