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 "content/public/common/content_client.h" | 9 #include "content/public/common/content_client.h" |
10 #include "content/public/common/content_paths.h" | 10 #include "content/public/common/content_paths.h" |
11 #include "content/public/test/test_content_client_initializer.h" | 11 #include "content/public/test/test_content_client_initializer.h" |
12 #include "gpu/config/gpu_util.h" | 12 #include "gpu/config/gpu_util.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
16 #include "ui/gfx/win/dpi.h" | 16 #include "ui/gfx/win/dpi.h" |
17 #endif | 17 #endif |
18 | 18 |
19 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
20 #include "base/mac/scoped_nsautorelease_pool.h" | 20 #include "base/mac/scoped_nsautorelease_pool.h" |
| 21 #if !defined(OS_IOS) |
| 22 #include "base/test/mock_chrome_application_mac.h" |
| 23 #endif |
21 #endif | 24 #endif |
22 | 25 |
23 #if !defined(OS_IOS) | 26 #if !defined(OS_IOS) |
24 #include "base/base_switches.h" | 27 #include "base/base_switches.h" |
25 #include "base/command_line.h" | 28 #include "base/command_line.h" |
26 #include "media/base/media.h" | 29 #include "media/base/media.h" |
27 #include "ui/gl/gl_surface.h" | 30 #include "ui/gl/gl_surface.h" |
28 #endif | 31 #endif |
29 | 32 |
30 namespace { | 33 namespace { |
(...skipping 25 matching lines...) Expand all Loading... |
56 ContentTestSuite::ContentTestSuite(int argc, char** argv) | 59 ContentTestSuite::ContentTestSuite(int argc, char** argv) |
57 : ContentTestSuiteBase(argc, argv) { | 60 : ContentTestSuiteBase(argc, argv) { |
58 } | 61 } |
59 | 62 |
60 ContentTestSuite::~ContentTestSuite() { | 63 ContentTestSuite::~ContentTestSuite() { |
61 } | 64 } |
62 | 65 |
63 void ContentTestSuite::Initialize() { | 66 void ContentTestSuite::Initialize() { |
64 #if defined(OS_MACOSX) | 67 #if defined(OS_MACOSX) |
65 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 68 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
| 69 #if !defined(OS_IOS) |
| 70 mock_cr_app::RegisterMockCrApp(); |
| 71 #endif |
66 #endif | 72 #endif |
67 | 73 |
68 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
69 gfx::InitDeviceScaleFactor(1.0f); | 75 gfx::InitDeviceScaleFactor(1.0f); |
70 #endif | 76 #endif |
71 | 77 |
72 ContentTestSuiteBase::Initialize(); | 78 ContentTestSuiteBase::Initialize(); |
73 { | 79 { |
74 ContentClient client; | 80 ContentClient client; |
75 ContentTestSuiteBase::RegisterContentSchemes(&client); | 81 ContentTestSuiteBase::RegisterContentSchemes(&client); |
76 } | 82 } |
77 RegisterPathProvider(); | 83 RegisterPathProvider(); |
78 #if !defined(OS_IOS) | 84 #if !defined(OS_IOS) |
79 media::InitializeMediaLibraryForTesting(); | 85 media::InitializeMediaLibraryForTesting(); |
80 // When running in a child process for Mac sandbox tests, the sandbox exists | 86 // When running in a child process for Mac sandbox tests, the sandbox exists |
81 // to initialize GL, so don't do it here. | 87 // to initialize GL, so don't do it here. |
82 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 88 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
83 switches::kTestChildProcess)) { | 89 switches::kTestChildProcess)) { |
84 gfx::GLSurface::InitializeOneOffForTests(); | 90 gfx::GLSurface::InitializeOneOffForTests(); |
85 gpu::ApplyGpuDriverBugWorkarounds(CommandLine::ForCurrentProcess()); | 91 gpu::ApplyGpuDriverBugWorkarounds(CommandLine::ForCurrentProcess()); |
86 } | 92 } |
87 #endif | 93 #endif |
88 testing::TestEventListeners& listeners = | 94 testing::TestEventListeners& listeners = |
89 testing::UnitTest::GetInstance()->listeners(); | 95 testing::UnitTest::GetInstance()->listeners(); |
90 listeners.Append(new TestInitializationListener); | 96 listeners.Append(new TestInitializationListener); |
91 } | 97 } |
92 | 98 |
93 } // namespace content | 99 } // namespace content |
OLD | NEW |