OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/test/base/chrome_unit_test_suite.h" | 5 #include "chrome/test/base/chrome_unit_test_suite.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/process/process_handle.h" | 8 #include "base/process/process_handle.h" |
9 #include "base/metrics/stats_table.h" | 9 #include "base/metrics/stats_table.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 ChromeUnitTestSuiteInitializer() {} | 42 ChromeUnitTestSuiteInitializer() {} |
43 virtual ~ChromeUnitTestSuiteInitializer() {} | 43 virtual ~ChromeUnitTestSuiteInitializer() {} |
44 | 44 |
45 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { | 45 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { |
46 content_client_.reset(new ChromeContentClient); | 46 content_client_.reset(new ChromeContentClient); |
47 content::SetContentClient(content_client_.get()); | 47 content::SetContentClient(content_client_.get()); |
48 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. | 48 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. |
49 #if !defined(OS_IOS) | 49 #if !defined(OS_IOS) |
50 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); | 50 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); |
51 content::SetBrowserClientForTesting(browser_content_client_.get()); | 51 content::SetBrowserClientForTesting(browser_content_client_.get()); |
52 utility_content_client_.reset(new chrome::ChromeContentUtilityClient()); | 52 utility_content_client_.reset(new ChromeContentUtilityClient()); |
53 content::SetUtilityClientForTesting(utility_content_client_.get()); | 53 content::SetUtilityClientForTesting(utility_content_client_.get()); |
54 #endif | 54 #endif |
55 | 55 |
56 TestingBrowserProcess::CreateInstance(); | 56 TestingBrowserProcess::CreateInstance(); |
57 } | 57 } |
58 | 58 |
59 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { | 59 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { |
60 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. | 60 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. |
61 #if !defined(OS_IOS) | 61 #if !defined(OS_IOS) |
62 browser_content_client_.reset(); | 62 browser_content_client_.reset(); |
63 utility_content_client_.reset(); | 63 utility_content_client_.reset(); |
64 #endif | 64 #endif |
65 content_client_.reset(); | 65 content_client_.reset(); |
66 content::SetContentClient(NULL); | 66 content::SetContentClient(NULL); |
67 | 67 |
68 TestingBrowserProcess::DeleteInstance(); | 68 TestingBrowserProcess::DeleteInstance(); |
69 } | 69 } |
70 | 70 |
71 private: | 71 private: |
72 // Client implementations for the content module. | 72 // Client implementations for the content module. |
73 scoped_ptr<ChromeContentClient> content_client_; | 73 scoped_ptr<ChromeContentClient> content_client_; |
74 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. | 74 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. |
75 #if !defined(OS_IOS) | 75 #if !defined(OS_IOS) |
76 scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_; | 76 scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_; |
77 scoped_ptr<chrome::ChromeContentUtilityClient> utility_content_client_; | 77 scoped_ptr<ChromeContentUtilityClient> utility_content_client_; |
78 #endif | 78 #endif |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(ChromeUnitTestSuiteInitializer); | 80 DISALLOW_COPY_AND_ASSIGN(ChromeUnitTestSuiteInitializer); |
81 }; | 81 }; |
82 | 82 |
83 } // namespace | 83 } // namespace |
84 | 84 |
85 ChromeUnitTestSuite::ChromeUnitTestSuite(int argc, char** argv) | 85 ChromeUnitTestSuite::ChromeUnitTestSuite(int argc, char** argv) |
86 : ChromeTestSuite(argc, argv) {} | 86 : ChromeTestSuite(argc, argv) {} |
87 | 87 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 #if defined(OS_MACOSX) && !defined(OS_IOS) | 155 #if defined(OS_MACOSX) && !defined(OS_IOS) |
156 PathService::Get(base::DIR_MODULE, &resources_pack_path); | 156 PathService::Get(base::DIR_MODULE, &resources_pack_path); |
157 resources_pack_path = | 157 resources_pack_path = |
158 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); | 158 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); |
159 #else | 159 #else |
160 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 160 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
161 #endif | 161 #endif |
162 ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 162 ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
163 resources_pack_path, ui::SCALE_FACTOR_NONE); | 163 resources_pack_path, ui::SCALE_FACTOR_NONE); |
164 } | 164 } |
OLD | NEW |