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/public/test/test_launcher.h" | 5 #include "content/public/test/test_launcher.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { | 39 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { |
40 content_client_.reset(new ShellContentClient); | 40 content_client_.reset(new ShellContentClient); |
41 browser_content_client_.reset(new ShellContentBrowserClient()); | 41 browser_content_client_.reset(new ShellContentBrowserClient()); |
42 SetContentClient(content_client_.get()); | 42 SetContentClient(content_client_.get()); |
43 SetBrowserClientForTesting(browser_content_client_.get()); | 43 SetBrowserClientForTesting(browser_content_client_.get()); |
44 } | 44 } |
45 | 45 |
46 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { | 46 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { |
| 47 #if !defined(OS_ANDROID) |
| 48 // On Android, production code doesn't reset ContentClient during shutdown. |
| 49 // We try to do the same thing as production. Refer to crbug.com/181069. |
47 browser_content_client_.reset(); | 50 browser_content_client_.reset(); |
48 content_client_.reset(); | 51 content_client_.reset(); |
49 SetContentClient(NULL); | 52 SetContentClient(NULL); |
| 53 #endif |
50 } | 54 } |
51 | 55 |
52 private: | 56 private: |
53 scoped_ptr<ShellContentClient> content_client_; | 57 scoped_ptr<ShellContentClient> content_client_; |
54 scoped_ptr<ShellContentBrowserClient> browser_content_client_; | 58 scoped_ptr<ShellContentBrowserClient> browser_content_client_; |
55 | 59 |
56 DISALLOW_COPY_AND_ASSIGN(ContentShellTestSuiteInitializer); | 60 DISALLOW_COPY_AND_ASSIGN(ContentShellTestSuiteInitializer); |
57 }; | 61 }; |
58 | 62 |
59 #if defined(OS_ANDROID) | 63 #if defined(OS_ANDROID) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); | 129 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); |
126 }; | 130 }; |
127 | 131 |
128 } // namespace content | 132 } // namespace content |
129 | 133 |
130 int main(int argc, char** argv) { | 134 int main(int argc, char** argv) { |
131 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); | 135 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); |
132 content::ContentTestLauncherDelegate launcher_delegate; | 136 content::ContentTestLauncherDelegate launcher_delegate; |
133 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 137 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
134 } | 138 } |
OLD | NEW |