| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_test_suite.h" | 5 #include "chrome/test/base/chrome_test_suite.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/metrics/stats_table.h" | 10 #include "base/metrics/stats_table.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/test/base/testing_browser_process.h" | 21 #include "chrome/test/base/testing_browser_process.h" |
| 22 #include "content/public/common/content_paths.h" | 22 #include "content/public/common/content_paths.h" |
| 23 #include "net/base/mock_host_resolver.h" | 23 #include "net/base/mock_host_resolver.h" |
| 24 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
| 25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/base/ui_base_paths.h" | 28 #include "ui/base/ui_base_paths.h" |
| 29 | 29 |
| 30 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
| 31 #include "base/mac/bundle_locations.h" |
| 31 #include "base/mac/mac_util.h" | 32 #include "base/mac/mac_util.h" |
| 32 #include "base/mac/scoped_nsautorelease_pool.h" | 33 #include "base/mac/scoped_nsautorelease_pool.h" |
| 33 #include "chrome/browser/chrome_browser_application_mac.h" | 34 #include "chrome/browser/chrome_browser_application_mac.h" |
| 34 #endif | 35 #endif |
| 35 | 36 |
| 36 #if defined(OS_POSIX) | 37 #if defined(OS_POSIX) |
| 37 #include "base/shared_memory.h" | 38 #include "base/shared_memory.h" |
| 38 #endif | 39 #endif |
| 39 | 40 |
| 40 #if defined(USE_WEBKIT_COMPOSITOR) | 41 #if defined(USE_WEBKIT_COMPOSITOR) |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 if (!browser_dir_.empty()) { | 179 if (!browser_dir_.empty()) { |
| 179 PathService::Override(base::DIR_EXE, browser_dir_); | 180 PathService::Override(base::DIR_EXE, browser_dir_); |
| 180 PathService::Override(base::DIR_MODULE, browser_dir_); | 181 PathService::Override(base::DIR_MODULE, browser_dir_); |
| 181 } | 182 } |
| 182 | 183 |
| 183 #if defined(OS_MACOSX) | 184 #if defined(OS_MACOSX) |
| 184 // Look in the framework bundle for resources. | 185 // Look in the framework bundle for resources. |
| 185 FilePath path; | 186 FilePath path; |
| 186 PathService::Get(base::DIR_EXE, &path); | 187 PathService::Get(base::DIR_EXE, &path); |
| 187 path = path.Append(chrome::kFrameworkName); | 188 path = path.Append(chrome::kFrameworkName); |
| 188 base::mac::SetOverrideAppBundlePath(path); | 189 base::mac::SetOverrideFrameworkBundlePath(path); |
| 189 #endif | 190 #endif |
| 190 | 191 |
| 191 // Force unittests to run using en-US so if we test against string | 192 // Force unittests to run using en-US so if we test against string |
| 192 // output, it'll pass regardless of the system language. | 193 // output, it'll pass regardless of the system language. |
| 193 ResourceBundle::InitSharedInstance("en-US"); | 194 ResourceBundle::InitSharedInstance("en-US"); |
| 194 FilePath resources_pack_path; | 195 FilePath resources_pack_path; |
| 195 PathService::Get(base::DIR_MODULE, &resources_pack_path); | 196 PathService::Get(base::DIR_MODULE, &resources_pack_path); |
| 196 resources_pack_path = | 197 resources_pack_path = |
| 197 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); | 198 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); |
| 198 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); | 199 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 212 | 213 |
| 213 testing::TestEventListeners& listeners = | 214 testing::TestEventListeners& listeners = |
| 214 testing::UnitTest::GetInstance()->listeners(); | 215 testing::UnitTest::GetInstance()->listeners(); |
| 215 listeners.Append(new ChromeTestSuiteInitializer); | 216 listeners.Append(new ChromeTestSuiteInitializer); |
| 216 } | 217 } |
| 217 | 218 |
| 218 void ChromeTestSuite::Shutdown() { | 219 void ChromeTestSuite::Shutdown() { |
| 219 ResourceBundle::CleanupSharedInstance(); | 220 ResourceBundle::CleanupSharedInstance(); |
| 220 | 221 |
| 221 #if defined(OS_MACOSX) | 222 #if defined(OS_MACOSX) |
| 222 base::mac::SetOverrideAppBundle(NULL); | 223 base::mac::SetOverrideFrameworkBundle(NULL); |
| 223 #endif | 224 #endif |
| 224 | 225 |
| 225 base::StatsTable::set_current(NULL); | 226 base::StatsTable::set_current(NULL); |
| 226 stats_table_.reset(); | 227 stats_table_.reset(); |
| 227 RemoveSharedMemoryFile(stats_filename_); | 228 RemoveSharedMemoryFile(stats_filename_); |
| 228 | 229 |
| 229 base::TestSuite::Shutdown(); | 230 base::TestSuite::Shutdown(); |
| 230 } | 231 } |
| OLD | NEW |