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

Unified Diff: chrome/test/base/chrome_test_suite.cc

Issue 10786038: Prevent loading libffmpegsumo.so to python (autotests) process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iteration Created 8 years, 5 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: chrome/test/base/chrome_test_suite.cc
diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc
index 5ef78020845b05c91a954479e3fb12e0e82f3c41..8926e002f1e18fe2192aa55c7dcfe84f5eb7a6c6 100644
--- a/chrome/test/base/chrome_test_suite.cc
+++ b/chrome/test/base/chrome_test_suite.cc
@@ -4,6 +4,11 @@
#include "chrome/test/base/chrome_test_suite.h"
+#if defined(OS_CHROMEOS)
+#include <stdio.h>
+#include <unistd.h>
+#endif
+
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/memory/ref_counted.h"
@@ -159,6 +164,19 @@ ChromeTestSuite::ChromeTestSuite(int argc, char** argv)
ChromeTestSuite::~ChromeTestSuite() {
}
+static bool IsCrosPythonProcess() {
jam 2012/07/24 15:32:19 nit: put static method in the annonymous namespace
glotov 2012/07/24 16:23:41 I'd leave it here: locality is more important for
jam 2012/07/24 16:27:55 it's chrome style to put static functions that are
glotov 2012/07/24 17:05:05 Done.
+#if defined(OS_CHROMEOS)
+ char buf[80];
+ int num_read = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
+ if (num_read == -1)
+ return false;
+ buf[num_read] = 0;
+ const char kPythonPrefix[] = "/python";
+ return !strncmp(strrchr(buf, '/'), kPythonPrefix, sizeof(kPythonPrefix) - 1);
+#endif // defined(OS_CHROMEOS)
+ return false;
+}
+
void ChromeTestSuite::Initialize() {
#if defined(OS_MACOSX)
base::mac::ScopedNSAutoreleasePool autorelease_pool;
@@ -171,6 +189,12 @@ void ChromeTestSuite::Initialize() {
PathService::Override(base::DIR_MODULE, browser_dir_);
}
+ // Disable external libraries load if we are under python process in
+ // ChromeOS. That means we are autotest and, if ASAN is used,
+ // external libraries load crashes.
+ if (!IsCrosPythonProcess())
+ content::ContentTestSuiteBase::DisableLoadingExternalLibraries();
+
// Initialize after overriding paths as some content paths depend on correct
// values for DIR_EXE and DIR_MODULE.
content::ContentTestSuiteBase::Initialize();
« no previous file with comments | « no previous file | content/public/test/content_test_suite_base.h » ('j') | content/public/test/content_test_suite_base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698