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/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/chrome_content_browser_client.h" | 10 #include "chrome/browser/chrome_content_browser_client.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #endif | 37 #endif |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 // Creates a TestingBrowserProcess for each test. | 41 // Creates a TestingBrowserProcess for each test. |
42 class ChromeUnitTestSuiteInitializer : public testing::EmptyTestEventListener { | 42 class ChromeUnitTestSuiteInitializer : public testing::EmptyTestEventListener { |
43 public: | 43 public: |
44 ChromeUnitTestSuiteInitializer() {} | 44 ChromeUnitTestSuiteInitializer() {} |
45 virtual ~ChromeUnitTestSuiteInitializer() {} | 45 virtual ~ChromeUnitTestSuiteInitializer() {} |
46 | 46 |
47 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { | 47 virtual void OnTestStart(const testing::TestInfo& test_info) override { |
48 content_client_.reset(new ChromeContentClient); | 48 content_client_.reset(new ChromeContentClient); |
49 content::SetContentClient(content_client_.get()); | 49 content::SetContentClient(content_client_.get()); |
50 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. | 50 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. |
51 #if !defined(OS_IOS) | 51 #if !defined(OS_IOS) |
52 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); | 52 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); |
53 content::SetBrowserClientForTesting(browser_content_client_.get()); | 53 content::SetBrowserClientForTesting(browser_content_client_.get()); |
54 utility_content_client_.reset(new ChromeContentUtilityClient()); | 54 utility_content_client_.reset(new ChromeContentUtilityClient()); |
55 content::SetUtilityClientForTesting(utility_content_client_.get()); | 55 content::SetUtilityClientForTesting(utility_content_client_.get()); |
56 #endif | 56 #endif |
57 | 57 |
58 TestingBrowserProcess::CreateInstance(); | 58 TestingBrowserProcess::CreateInstance(); |
59 } | 59 } |
60 | 60 |
61 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { | 61 virtual void OnTestEnd(const testing::TestInfo& test_info) override { |
62 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. | 62 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. |
63 #if !defined(OS_IOS) | 63 #if !defined(OS_IOS) |
64 browser_content_client_.reset(); | 64 browser_content_client_.reset(); |
65 utility_content_client_.reset(); | 65 utility_content_client_.reset(); |
66 #endif | 66 #endif |
67 content_client_.reset(); | 67 content_client_.reset(); |
68 content::SetContentClient(NULL); | 68 content::SetContentClient(NULL); |
69 | 69 |
70 TestingBrowserProcess::DeleteInstance(); | 70 TestingBrowserProcess::DeleteInstance(); |
71 } | 71 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 #if defined(OS_MACOSX) && !defined(OS_IOS) | 152 #if defined(OS_MACOSX) && !defined(OS_IOS) |
153 PathService::Get(base::DIR_MODULE, &resources_pack_path); | 153 PathService::Get(base::DIR_MODULE, &resources_pack_path); |
154 resources_pack_path = | 154 resources_pack_path = |
155 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); | 155 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); |
156 #else | 156 #else |
157 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 157 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
158 #endif | 158 #endif |
159 ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 159 ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
160 resources_pack_path, ui::SCALE_FACTOR_NONE); | 160 resources_pack_path, ui::SCALE_FACTOR_NONE); |
161 } | 161 } |
OLD | NEW |