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 "chrome_frame/test/net/fake_external_tab.h" | 5 #include "chrome_frame/test/net/fake_external_tab.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlcom.h> | 8 #include <atlcom.h> |
9 #include <exdisp.h> | 9 #include <exdisp.h> |
10 #include <Winsock2.h> | 10 #include <Winsock2.h> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 g_renderer_client = LAZY_INSTANCE_INITIALIZER; | 140 g_renderer_client = LAZY_INSTANCE_INITIALIZER; |
141 | 141 |
142 class FakeMainDelegate : public content::ContentMainDelegate { | 142 class FakeMainDelegate : public content::ContentMainDelegate { |
143 public: | 143 public: |
144 virtual ~FakeMainDelegate() {} | 144 virtual ~FakeMainDelegate() {} |
145 | 145 |
146 virtual bool BasicStartupComplete(int* exit_code) OVERRIDE { | 146 virtual bool BasicStartupComplete(int* exit_code) OVERRIDE { |
147 logging_win::InstallTestLogCollector( | 147 logging_win::InstallTestLogCollector( |
148 testing::UnitTest::GetInstance()); | 148 testing::UnitTest::GetInstance()); |
149 | 149 |
150 // Initialize the content client. | |
151 content::SetContentClient(&g_chrome_content_client.Get()); | 150 content::SetContentClient(&g_chrome_content_client.Get()); |
152 | 151 content::GetContentClient()->set_renderer_for_testing( |
153 // Override the default ContentBrowserClient to let Chrome participate in | 152 &g_renderer_client.Get()); |
154 // content logic. We use a subclass of Chrome's implementation, | |
155 // FakeContentBrowserClient, to override CreateBrowserMainParts. Must | |
156 // be done before any tabs are created. | |
157 content::GetContentClient()->set_browser(&g_browser_client.Get()); | |
158 content::GetContentClient()->set_renderer(&g_renderer_client.Get()); | |
159 return false; | 153 return false; |
160 } | 154 } |
| 155 |
| 156 // Override the default ContentBrowserClient to let Chrome participate in |
| 157 // content logic. We use a subclass of Chrome's implementation, |
| 158 // FakeContentBrowserClient, to override CreateBrowserMainParts. Must |
| 159 // be done before any tabs are created. |
| 160 virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE { |
| 161 return &g_browser_client.Get(); |
| 162 }; |
161 }; | 163 }; |
162 | 164 |
163 void FilterDisabledTests() { | 165 void FilterDisabledTests() { |
164 if (::testing::FLAGS_gtest_filter.length() && | 166 if (::testing::FLAGS_gtest_filter.length() && |
165 ::testing::FLAGS_gtest_filter.Compare("*") != 0) { | 167 ::testing::FLAGS_gtest_filter.Compare("*") != 0) { |
166 // Don't override user specified filters. | 168 // Don't override user specified filters. |
167 return; | 169 return; |
168 } | 170 } |
169 | 171 |
170 const char* disabled_tests[] = { | 172 const char* disabled_tests[] = { |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 // content::InitializeSandboxInfo(&sandbox_info); | 890 // content::InitializeSandboxInfo(&sandbox_info); |
889 FakeMainDelegate delegate; | 891 FakeMainDelegate delegate; |
890 content::ContentMain( | 892 content::ContentMain( |
891 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)), | 893 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)), |
892 &sandbox_info, | 894 &sandbox_info, |
893 &delegate); | 895 &delegate); |
894 | 896 |
895 // Note: In debug builds, we ExitProcess during PostDestroyThreads. | 897 // Note: In debug builds, we ExitProcess during PostDestroyThreads. |
896 return g_test_suite->test_result(); | 898 return g_test_suite->test_result(); |
897 } | 899 } |
OLD | NEW |