OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/shell/browser/shell_layout_tests_android.h" | 5 #include "content/shell/browser/layout_test/layout_test_android.h" |
6 | 6 |
7 #include "base/android/fifo_utils.h" | 7 #include "base/android/fifo_utils.h" |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "content/public/test/nested_message_pump_android.h" | 13 #include "content/public/test/nested_message_pump_android.h" |
14 #include "content/shell/common/shell_switches.h" | 14 #include "content/shell/common/shell_switches.h" |
15 #include "jni/ShellLayoutTestUtils_jni.h" | 15 #include "jni/ShellLayoutTestUtils_jni.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return false; | 50 return false; |
51 | 51 |
52 std::string test_location(kAndroidLayoutTestBase); | 52 std::string test_location(kAndroidLayoutTestBase); |
53 test_location.append(path_or_url.substr(strlen(kAndroidLayoutTestPath))); | 53 test_location.append(path_or_url.substr(strlen(kAndroidLayoutTestPath))); |
54 | 54 |
55 *url = GURL(test_location); | 55 *url = GURL(test_location); |
56 return true; | 56 return true; |
57 } | 57 } |
58 | 58 |
59 void EnsureInitializeForAndroidLayoutTests() { | 59 void EnsureInitializeForAndroidLayoutTests() { |
60 CHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)); | |
61 | |
62 JNIEnv* env = base::android::AttachCurrentThread(); | 60 JNIEnv* env = base::android::AttachCurrentThread(); |
63 content::NestedMessagePumpAndroid::RegisterJni(env); | 61 content::NestedMessagePumpAndroid::RegisterJni(env); |
64 content::RegisterNativesImpl(env); | 62 content::RegisterNativesImpl(env); |
65 | 63 |
66 bool success = base::MessageLoop::InitMessagePumpForUIFactory( | 64 bool success = base::MessageLoop::InitMessagePumpForUIFactory( |
67 &CreateMessagePumpForUI); | 65 &CreateMessagePumpForUI); |
68 CHECK(success) << "Unable to initialize the message pump for Android."; | 66 CHECK(success) << "Unable to initialize the message pump for Android."; |
69 | 67 |
70 // Android will need three FIFOs to communicate with the Blink test runner, | 68 // Android will need three FIFOs to communicate with the Blink test runner, |
71 // one for each of [stdout, stderr, stdin]. | 69 // one for each of [stdout, stderr, stdin]. |
(...skipping 12 matching lines...) Expand all Loading... |
84 // Redirecting stdout needs to happen before redirecting stdin, which needs | 82 // Redirecting stdout needs to happen before redirecting stdin, which needs |
85 // to happen before redirecting stderr. | 83 // to happen before redirecting stderr. |
86 success = base::android::RedirectStream(stdout, stdout_fifo, "w") && | 84 success = base::android::RedirectStream(stdout, stdout_fifo, "w") && |
87 base::android::RedirectStream(stdin, stdin_fifo, "r") && | 85 base::android::RedirectStream(stdin, stdin_fifo, "r") && |
88 base::android::RedirectStream(stderr, stderr_fifo, "w"); | 86 base::android::RedirectStream(stderr, stderr_fifo, "w"); |
89 | 87 |
90 CHECK(success) << "Unable to initialize the Android FIFOs."; | 88 CHECK(success) << "Unable to initialize the Android FIFOs."; |
91 } | 89 } |
92 | 90 |
93 } // namespace content | 91 } // namespace content |
OLD | NEW |