OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <exdisp.h> | 7 #include <exdisp.h> |
8 | 8 |
9 #include "app/app_paths.h" | 9 #include "app/app_paths.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
11 #include "app/win_util.h" | 11 #include "app/win_util.h" |
12 | 12 |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/i18n/icu_util.h" | 15 #include "base/i18n/icu_util.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/scoped_bstr_win.h" | 17 #include "base/scoped_bstr_win.h" |
18 #include "base/scoped_comptr_win.h" | 18 #include "base/scoped_comptr_win.h" |
19 #include "base/scoped_variant_win.h" | 19 #include "base/scoped_variant_win.h" |
20 | 20 |
21 #include "chrome/browser/browser_prefs.h" | 21 #include "chrome/browser/browser_prefs.h" |
22 #include "chrome/browser/chrome_thread.h" | |
23 #include "chrome/browser/process_singleton.h" | 22 #include "chrome/browser/process_singleton.h" |
24 #include "chrome/browser/profile_manager.h" | 23 #include "chrome/browser/profile_manager.h" |
25 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
26 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
29 #include "chrome/browser/renderer_host/render_process_host.h" | 28 #include "chrome/browser/renderer_host/render_process_host.h" |
30 | 29 |
31 #include "chrome_frame/utils.h" | 30 #include "chrome_frame/utils.h" |
32 #include "chrome_frame/test/chrome_frame_test_utils.h" | 31 #include "chrome_frame/test/chrome_frame_test_utils.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 ResourceBundle::CleanupSharedInstance(); | 137 ResourceBundle::CleanupSharedInstance(); |
139 } | 138 } |
140 | 139 |
141 CFUrlRequestUnittestRunner::CFUrlRequestUnittestRunner(int argc, char** argv) | 140 CFUrlRequestUnittestRunner::CFUrlRequestUnittestRunner(int argc, char** argv) |
142 : NetTestSuite(argc, argv), | 141 : NetTestSuite(argc, argv), |
143 chrome_frame_html_("/chrome_frame", kChromeFrameHtml) { | 142 chrome_frame_html_("/chrome_frame", kChromeFrameHtml) { |
144 fake_chrome_.Initialize(); | 143 fake_chrome_.Initialize(); |
145 pss_subclass_.reset(new ProcessSingletonSubclass(this)); | 144 pss_subclass_.reset(new ProcessSingletonSubclass(this)); |
146 EXPECT_TRUE(pss_subclass_->Subclass(fake_chrome_.user_data())); | 145 EXPECT_TRUE(pss_subclass_->Subclass(fake_chrome_.user_data())); |
147 StartChromeFrameInHostBrowser(); | 146 StartChromeFrameInHostBrowser(); |
| 147 // Register the main thread by instantiating it, but don't call any methods. |
| 148 main_thread_.reset(new ChromeThread()); |
| 149 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
148 } | 150 } |
149 | 151 |
150 CFUrlRequestUnittestRunner::~CFUrlRequestUnittestRunner() { | 152 CFUrlRequestUnittestRunner::~CFUrlRequestUnittestRunner() { |
151 fake_chrome_.Shutdown(); | 153 fake_chrome_.Shutdown(); |
152 } | 154 } |
153 | 155 |
154 DWORD WINAPI NavigateIE(void* param) { | 156 DWORD WINAPI NavigateIE(void* param) { |
155 return 0; | 157 return 0; |
156 win_util::ScopedCOMInitializer com; | 158 win_util::ScopedCOMInitializer com; |
157 BSTR url = reinterpret_cast<BSTR>(param); | 159 BSTR url = reinterpret_cast<BSTR>(param); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 272 } |
271 | 273 |
272 void CFUrlRequestUnittestRunner::OnInitialTabLoaded() { | 274 void CFUrlRequestUnittestRunner::OnInitialTabLoaded() { |
273 test_http_server_.reset(); | 275 test_http_server_.reset(); |
274 StartTests(); | 276 StartTests(); |
275 } | 277 } |
276 | 278 |
277 void CFUrlRequestUnittestRunner::RunMainUIThread() { | 279 void CFUrlRequestUnittestRunner::RunMainUIThread() { |
278 DCHECK(MessageLoop::current()); | 280 DCHECK(MessageLoop::current()); |
279 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); | 281 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); |
280 | |
281 // Register the main thread by instantiating it, but don't call any methods. | |
282 ChromeThread main_thread; | |
283 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | |
284 | |
285 MessageLoop::current()->Run(); | 282 MessageLoop::current()->Run(); |
286 } | 283 } |
287 | 284 |
288 void CFUrlRequestUnittestRunner::StartTests() { | 285 void CFUrlRequestUnittestRunner::StartTests() { |
289 if (PromptAfterSetup()) | 286 if (PromptAfterSetup()) |
290 MessageBoxA(NULL, "click ok to run", "", MB_OK); | 287 MessageBoxA(NULL, "click ok to run", "", MB_OK); |
291 | 288 |
292 DCHECK_EQ(test_thread_.IsValid(), false); | 289 DCHECK_EQ(test_thread_.IsValid(), false); |
293 test_thread_.Set(::CreateThread(NULL, 0, RunAllUnittests, this, 0, | 290 test_thread_.Set(::CreateThread(NULL, 0, RunAllUnittests, this, 0, |
294 &test_thread_id_)); | 291 &test_thread_id_)); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 DialogWatchdog watchdog; | 379 DialogWatchdog watchdog; |
383 // See url_request_unittest.cc for these credentials. | 380 // See url_request_unittest.cc for these credentials. |
384 SupplyProxyCredentials credentials("user", "secret"); | 381 SupplyProxyCredentials credentials("user", "secret"); |
385 watchdog.AddObserver(&credentials); | 382 watchdog.AddObserver(&credentials); |
386 testing::InitGoogleTest(&argc, argv); | 383 testing::InitGoogleTest(&argc, argv); |
387 FilterDisabledTests(); | 384 FilterDisabledTests(); |
388 CFUrlRequestUnittestRunner test_suite(argc, argv); | 385 CFUrlRequestUnittestRunner test_suite(argc, argv); |
389 test_suite.RunMainUIThread(); | 386 test_suite.RunMainUIThread(); |
390 return 0; | 387 return 0; |
391 } | 388 } |
OLD | NEW |