OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This class sets up the environment for running the content browser tests | 5 // This class sets up the environment for running the content browser tests |
6 // inside an android application. | 6 // inside an android application. |
7 | 7 |
8 #include <android/log.h> | 8 #include <android/log.h> |
9 | 9 |
10 #include "base/android/base_jni_registrar.h" | 10 #include "base/android/base_jni_registrar.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 std::vector<char*> argv; | 70 std::vector<char*> argv; |
71 int argc = ArgsToArgv(args, &argv); | 71 int argc = ArgsToArgv(args, &argv); |
72 | 72 |
73 // Fully initialize command line with arguments. | 73 // Fully initialize command line with arguments. |
74 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 74 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
75 command_line->AppendArguments(CommandLine(argc, &argv[0]), false); | 75 command_line->AppendArguments(CommandLine(argc, &argv[0]), false); |
76 | 76 |
77 // Append required switches. | 77 // Append required switches. |
78 command_line->AppendSwitch(content::kSingleProcessTestsFlag); | 78 command_line->AppendSwitch(content::kSingleProcessTestsFlag); |
79 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 79 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
| 80 // Specify a socket name to not conflict with the default one used |
| 81 // in content_shell. |
| 82 command_line->AppendSwitchASCII(switches::kRemoteDebuggingSocketName, |
| 83 "content_browsertests_devtools_remote"); |
80 | 84 |
81 // Create fifo and redirect stdout and stderr to it. | 85 // Create fifo and redirect stdout and stderr to it. |
82 base::FilePath files_dir( | 86 base::FilePath files_dir( |
83 base::android::ConvertJavaStringToUTF8(env, jfiles_dir)); | 87 base::android::ConvertJavaStringToUTF8(env, jfiles_dir)); |
84 base::FilePath fifo_path(files_dir.Append(base::FilePath("test.fifo"))); | 88 base::FilePath fifo_path(files_dir.Append(base::FilePath("test.fifo"))); |
85 CreateFIFO(fifo_path.value().c_str()); | 89 CreateFIFO(fifo_path.value().c_str()); |
86 RedirectStream(stdout, fifo_path.value().c_str(), "w"); | 90 RedirectStream(stdout, fifo_path.value().c_str(), "w"); |
87 dup2(STDOUT_FILENO, STDERR_FILENO); | 91 dup2(STDOUT_FILENO, STDERR_FILENO); |
88 | 92 |
89 ScopedMainEntryLogger scoped_main_entry_logger; | 93 ScopedMainEntryLogger scoped_main_entry_logger; |
(...skipping 14 matching lines...) Expand all Loading... |
104 | 108 |
105 if (!content::BrowserTestMessagePumpAndroid::RegisterJni(env)) | 109 if (!content::BrowserTestMessagePumpAndroid::RegisterJni(env)) |
106 return -1; | 110 return -1; |
107 | 111 |
108 if (!content::RegisterNativesImpl(env)) | 112 if (!content::RegisterNativesImpl(env)) |
109 return -1; | 113 return -1; |
110 | 114 |
111 content::SetContentMainDelegate(new content::ShellMainDelegate()); | 115 content::SetContentMainDelegate(new content::ShellMainDelegate()); |
112 return JNI_VERSION_1_4; | 116 return JNI_VERSION_1_4; |
113 } | 117 } |
OLD | NEW |