OLD | NEW |
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/test/content_test_suite.h" | 5 #include "content/test/content_test_suite.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "content/public/common/content_client.h" |
| 11 #include "content/public/common/content_paths.h" |
10 #include "content/public/test/test_content_client_initializer.h" | 12 #include "content/public/test/test_content_client_initializer.h" |
11 #include "content/test/test_content_client.h" | |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
14 | 15 |
15 #if defined(OS_MACOSX) | 16 #if defined(OS_MACOSX) |
16 #include "base/mac/scoped_nsautorelease_pool.h" | 17 #include "base/mac/scoped_nsautorelease_pool.h" |
17 #endif | 18 #endif |
18 | 19 |
19 #if !defined(OS_IOS) | 20 #if !defined(OS_IOS) |
20 #include "base/base_switches.h" | 21 #include "base/base_switches.h" |
21 #include "base/command_line.h" | 22 #include "base/command_line.h" |
| 23 #include "media/base/media.h" |
22 #include "ui/gl/gl_surface.h" | 24 #include "ui/gl/gl_surface.h" |
23 #endif | 25 #endif |
24 | 26 |
25 namespace { | 27 namespace { |
26 | 28 |
27 class TestInitializationListener : public testing::EmptyTestEventListener { | 29 class TestInitializationListener : public testing::EmptyTestEventListener { |
28 public: | 30 public: |
29 TestInitializationListener() : test_content_client_initializer_(NULL) { | 31 TestInitializationListener() : test_content_client_initializer_(NULL) { |
30 } | 32 } |
31 | 33 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ui::ResourceBundle::CleanupSharedInstance(); | 65 ui::ResourceBundle::CleanupSharedInstance(); |
64 #endif | 66 #endif |
65 } | 67 } |
66 | 68 |
67 void ContentTestSuite::Initialize() { | 69 void ContentTestSuite::Initialize() { |
68 #if defined(OS_MACOSX) | 70 #if defined(OS_MACOSX) |
69 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 71 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
70 #endif | 72 #endif |
71 | 73 |
72 ContentTestSuiteBase::Initialize(); | 74 ContentTestSuiteBase::Initialize(); |
| 75 { |
| 76 ContentClient client; |
| 77 ContentTestSuiteBase::RegisterContentSchemes(&client); |
| 78 } |
| 79 RegisterPathProvider(); |
73 #if !defined(OS_IOS) | 80 #if !defined(OS_IOS) |
| 81 media::InitializeMediaLibraryForTesting(); |
74 // When running in a child process for Mac sandbox tests, the sandbox exists | 82 // When running in a child process for Mac sandbox tests, the sandbox exists |
75 // to initialize GL, so don't do it here. | 83 // to initialize GL, so don't do it here. |
76 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestChildProcess)) | 84 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestChildProcess)) |
77 gfx::GLSurface::InitializeOneOffForTests(); | 85 gfx::GLSurface::InitializeOneOffForTests(); |
78 #endif | 86 #endif |
79 testing::TestEventListeners& listeners = | 87 testing::TestEventListeners& listeners = |
80 testing::UnitTest::GetInstance()->listeners(); | 88 testing::UnitTest::GetInstance()->listeners(); |
81 listeners.Append(new TestInitializationListener); | 89 listeners.Append(new TestInitializationListener); |
82 } | 90 } |
83 | 91 |
84 ContentClient* ContentTestSuite::CreateClientForInitialization() { | |
85 return new TestContentClient(); | |
86 } | |
87 | |
88 } // namespace content | 92 } // namespace content |
OLD | NEW |