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

Side by Side Diff: content/test/content_test_suite_base.cc

Issue 10786038: Prevent loading libffmpegsumo.so to python (autotests) process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync + name change 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "content/public/test/content_test_suite_base.h" 5 #include "content/public/test/content_test_suite_base.h"
6 6
7 #if defined(OS_CHROMEOS)
8 #include <stdio.h>
9 #include <unistd.h>
10 #endif // defined(OS_CHROMEOS)
11
7 #include "base/basictypes.h" 12 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
10 #include "base/test/test_suite.h" 15 #include "base/test/test_suite.h"
11 #include "content/common/url_schemes.h" 16 #include "content/common/url_schemes.h"
12 #include "content/public/common/content_client.h" 17 #include "content/public/common/content_client.h"
13 #include "content/public/common/content_paths.h" 18 #include "content/public/common/content_paths.h"
14 #include "media/base/media.h" 19 #include "media/base/media.h"
15 #include "ui/base/ui_base_paths.h" 20 #include "ui/base/ui_base_paths.h"
16 #include "ui/compositor/compositor_setup.h" 21 #include "ui/compositor/compositor_setup.h"
17 22
18 namespace content { 23 namespace content {
19 24
20 ContentTestSuiteBase::ContentTestSuiteBase(int argc, char** argv) 25 ContentTestSuiteBase::ContentTestSuiteBase(int argc, char** argv)
21 : base::TestSuite(argc, argv) { 26 : base::TestSuite(argc, argv) {
22 } 27 }
23 28
29 static bool IsCrosPythonProcess() {
30 #if defined(OS_CHROMEOS)
31 char buf[80];
32 int num_read = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
jam 2012/07/20 21:46:16 this is a layering violation, since content should
glotov 2012/07/20 23:47:29 Adding a parameter to the Initialize() function wi
33 if (num_read == -1)
34 return false;
35 buf[num_read] = 0;
36 const char kPythonPrefix[] = "/python";
37 return !strncmp(strrchr(buf, '/'), kPythonPrefix, sizeof(kPythonPrefix) - 1);
38 #endif // defined(OS_CHROMEOS)
39 return false;
40 }
41
24 void ContentTestSuiteBase::Initialize() { 42 void ContentTestSuiteBase::Initialize() {
25 base::TestSuite::Initialize(); 43 base::TestSuite::Initialize();
26 media::InitializeMediaLibraryForTesting(); 44
45 // Initialize media library for unit tests. If we are auto test
46 // (python process under chrome os), media library will be loaded to
47 // chrome directly so don't load it here.
48 if (!IsCrosPythonProcess())
49 media::InitializeMediaLibraryForTesting();
27 50
28 scoped_ptr<ContentClient> client_for_init(CreateClientForInitialization()); 51 scoped_ptr<ContentClient> client_for_init(CreateClientForInitialization());
29 SetContentClient(client_for_init.get()); 52 SetContentClient(client_for_init.get());
30 RegisterContentSchemes(false); 53 RegisterContentSchemes(false);
31 SetContentClient(NULL); 54 SetContentClient(NULL);
32 55
33 RegisterPathProvider(); 56 RegisterPathProvider();
34 ui::RegisterPathProvider(); 57 ui::RegisterPathProvider();
35 58
36 // Mock out the compositor on platforms that use it. 59 // Mock out the compositor on platforms that use it.
37 ui::SetupTestCompositor(); 60 ui::SetupTestCompositor();
38 } 61 }
39 62
40 } // namespace content 63 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698