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