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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 namespace content { | 30 namespace content { |
31 | 31 |
32 class ContentShellTestSuiteInitializer | 32 class ContentShellTestSuiteInitializer |
33 : public testing::EmptyTestEventListener { | 33 : public testing::EmptyTestEventListener { |
34 public: | 34 public: |
35 ContentShellTestSuiteInitializer() { | 35 ContentShellTestSuiteInitializer() { |
36 } | 36 } |
37 | 37 |
38 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { | 38 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { |
39 DCHECK(!GetContentClient()); | |
40 content_client_.reset(new ShellContentClient); | 39 content_client_.reset(new ShellContentClient); |
41 browser_content_client_.reset(new ShellContentBrowserClient()); | 40 browser_content_client_.reset(new ShellContentBrowserClient()); |
42 content_client_->set_browser_for_testing(browser_content_client_.get()); | |
43 SetContentClient(content_client_.get()); | 41 SetContentClient(content_client_.get()); |
| 42 SetBrowserClientForTesting(browser_content_client_.get()); |
44 } | 43 } |
45 | 44 |
46 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { | 45 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { |
47 DCHECK_EQ(content_client_.get(), GetContentClient()); | |
48 browser_content_client_.reset(); | 46 browser_content_client_.reset(); |
49 content_client_.reset(); | 47 content_client_.reset(); |
50 SetContentClient(NULL); | 48 SetContentClient(NULL); |
51 } | 49 } |
52 | 50 |
53 private: | 51 private: |
54 scoped_ptr<ShellContentClient> content_client_; | 52 scoped_ptr<ShellContentClient> content_client_; |
55 scoped_ptr<ShellContentBrowserClient> browser_content_client_; | 53 scoped_ptr<ShellContentBrowserClient> browser_content_client_; |
56 | 54 |
57 DISALLOW_COPY_AND_ASSIGN(ContentShellTestSuiteInitializer); | 55 DISALLOW_COPY_AND_ASSIGN(ContentShellTestSuiteInitializer); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 private: | 125 private: |
128 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); | 126 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); |
129 }; | 127 }; |
130 | 128 |
131 } // namespace content | 129 } // namespace content |
132 | 130 |
133 int main(int argc, char** argv) { | 131 int main(int argc, char** argv) { |
134 content::ContentTestLauncherDelegate launcher_delegate; | 132 content::ContentTestLauncherDelegate launcher_delegate; |
135 return LaunchTests(&launcher_delegate, argc, argv); | 133 return LaunchTests(&launcher_delegate, argc, argv); |
136 } | 134 } |
OLD | NEW |