Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3109)

Unified Diff: content/shell/browser/layout_test/layout_test_android.cc

Issue 2540603004: [Android] Redirect std{in,out,err} to sockets for layout tests. (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/browser/layout_test/layout_test_android.cc
diff --git a/content/shell/browser/layout_test/layout_test_android.cc b/content/shell/browser/layout_test/layout_test_android.cc
deleted file mode 100644
index 45bc77f5eab784a93162c617a5a896b9cc0dad22..0000000000000000000000000000000000000000
--- a/content/shell/browser/layout_test/layout_test_android.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/shell/browser/layout_test/layout_test_android.h"
-
-#include <memory>
-
-#include "base/android/context_utils.h"
-#include "base/android/fifo_utils.h"
-#include "base/android/jni_android.h"
-#include "base/android/jni_string.h"
-#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "base/message_loop/message_loop.h"
-#include "content/public/test/nested_message_pump_android.h"
-#include "content/shell/common/shell_switches.h"
-#include "jni/ShellLayoutTestUtils_jni.h"
-#include "url/gurl.h"
-
-using base::android::ScopedJavaLocalRef;
-
-namespace {
-
-base::FilePath GetTestFilesDirectory(JNIEnv* env) {
- ScopedJavaLocalRef<jstring> directory =
- content::Java_ShellLayoutTestUtils_getApplicationFilesDirectory(
- env, base::android::GetApplicationContext());
- return base::FilePath(ConvertJavaStringToUTF8(directory));
-}
-
-void EnsureCreateFIFO(const base::FilePath& path) {
- unlink(path.value().c_str());
- CHECK(base::android::CreateFIFO(path, 0666))
- << "Unable to create the Android's FIFO: " << path.value().c_str();
-}
-
-std::unique_ptr<base::MessagePump> CreateMessagePumpForUI() {
- return std::unique_ptr<base::MessagePump>(
- new content::NestedMessagePumpAndroid());
-}
-
-} // namespace
-
-namespace content {
-
-void EnsureInitializeForAndroidLayoutTests() {
- JNIEnv* env = base::android::AttachCurrentThread();
-
- bool success = base::MessageLoop::InitMessagePumpForUIFactory(
- &CreateMessagePumpForUI);
- CHECK(success) << "Unable to initialize the message pump for Android.";
-
- // Android will need three FIFOs to communicate with the Blink test runner,
- // one for each of [stdout, stderr, stdin].
- base::FilePath files_dir(GetTestFilesDirectory(env));
-
- base::FilePath stdout_fifo(files_dir.Append(FILE_PATH_LITERAL("test.fifo")));
- EnsureCreateFIFO(stdout_fifo);
-
- base::FilePath stderr_fifo(
- files_dir.Append(FILE_PATH_LITERAL("stderr.fifo")));
- EnsureCreateFIFO(stderr_fifo);
-
- base::FilePath stdin_fifo(files_dir.Append(FILE_PATH_LITERAL("stdin.fifo")));
- EnsureCreateFIFO(stdin_fifo);
-
- // Redirecting stdout needs to happen before redirecting stdin, which needs
- // to happen before redirecting stderr.
- success = base::android::RedirectStream(stdout, stdout_fifo, "w") &&
- base::android::RedirectStream(stdin, stdin_fifo, "r") &&
- base::android::RedirectStream(stderr, stderr_fifo, "w");
-
- CHECK(success) << "Unable to initialize the Android FIFOs.";
-}
-
-} // namespace content
« no previous file with comments | « content/shell/browser/layout_test/layout_test_android.h ('k') | content/shell/browser/layout_test/layout_test_browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698