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

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: 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 #include <stdio.h>
8 #include <unistd.h>
scherkus (not reviewing) 2012/07/19 20:38:53 this doesn't exist on windows (compile failure)
glotov 2012/07/19 21:45:33 Done.
9
7 #include "base/basictypes.h" 10 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/eintr_wrapper.h"
scherkus (not reviewing) 2012/07/19 20:38:53 this isn't used anymore
glotov 2012/07/19 21:45:33 Done.
9 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
10 #include "base/test/test_suite.h" 14 #include "base/test/test_suite.h"
11 #include "content/common/url_schemes.h" 15 #include "content/common/url_schemes.h"
12 #include "content/public/common/content_client.h" 16 #include "content/public/common/content_client.h"
13 #include "content/public/common/content_paths.h" 17 #include "content/public/common/content_paths.h"
14 #include "media/base/media.h" 18 #include "media/base/media.h"
15 #include "ui/base/ui_base_paths.h" 19 #include "ui/base/ui_base_paths.h"
16 #include "ui/compositor/compositor_setup.h" 20 #include "ui/compositor/compositor_setup.h"
17 21
18 namespace content { 22 namespace content {
19 23
20 ContentTestSuiteBase::ContentTestSuiteBase(int argc, char** argv) 24 ContentTestSuiteBase::ContentTestSuiteBase(int argc, char** argv)
21 : base::TestSuite(argc, argv) { 25 : base::TestSuite(argc, argv) {
22 } 26 }
23 27
28 static bool IsPythonProcess() {
29 #if defined(OS_CHROMEOS)
30 char buf[80];
31 int num_read = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
32 if (num_read == -1)
33 return false;
34 buf[num_read] = 0;
35 const char kPythonPrefix[] = "/python";
36 return !strncmp(strrchr(buf, '/'), kPythonPrefix, sizeof(kPythonPrefix) - 1);
37 #endif // defined(OS_CHROMEOS)
38 return false;
39 }
40
24 void ContentTestSuiteBase::Initialize() { 41 void ContentTestSuiteBase::Initialize() {
25 base::TestSuite::Initialize(); 42 base::TestSuite::Initialize();
26 media::InitializeMediaLibraryForTesting(); 43
44 // Initialize media library for unit tests. If we are auto test
45 // (python process), media library will be loaded to chrome directly
46 // so don't load it here.
47 if (!IsPythonProcess())
48 media::InitializeMediaLibraryForTesting();
27 49
28 scoped_ptr<ContentClient> client_for_init(CreateClientForInitialization()); 50 scoped_ptr<ContentClient> client_for_init(CreateClientForInitialization());
29 SetContentClient(client_for_init.get()); 51 SetContentClient(client_for_init.get());
30 RegisterContentSchemes(false); 52 RegisterContentSchemes(false);
31 SetContentClient(NULL); 53 SetContentClient(NULL);
32 54
33 RegisterPathProvider(); 55 RegisterPathProvider();
34 ui::RegisterPathProvider(); 56 ui::RegisterPathProvider();
35 57
36 // Mock out the compositor on platforms that use it. 58 // Mock out the compositor on platforms that use it.
37 ui::SetupTestCompositor(); 59 ui::SetupTestCompositor();
38 } 60 }
39 61
40 } // namespace content 62 } // 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