OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/renderer/chrome_content_renderer_client.h" | 42 #include "chrome/renderer/chrome_content_renderer_client.h" |
43 #include "chrome_frame/crash_server_init.h" | 43 #include "chrome_frame/crash_server_init.h" |
44 #include "chrome_frame/test/chrome_frame_test_utils.h" | 44 #include "chrome_frame/test/chrome_frame_test_utils.h" |
45 #include "chrome_frame/test/net/test_automation_resource_message_filter.h" | 45 #include "chrome_frame/test/net/test_automation_resource_message_filter.h" |
46 #include "chrome_frame/test/simulate_input.h" | 46 #include "chrome_frame/test/simulate_input.h" |
47 #include "chrome_frame/test/win_event_receiver.h" | 47 #include "chrome_frame/test/win_event_receiver.h" |
48 #include "chrome_frame/utils.h" | 48 #include "chrome_frame/utils.h" |
49 #include "content/browser/plugin_service.h" | 49 #include "content/browser/plugin_service.h" |
50 #include "content/browser/renderer_host/render_process_host.h" | 50 #include "content/browser/renderer_host/render_process_host.h" |
51 #include "content/common/content_paths.h" | 51 #include "content/common/content_paths.h" |
52 #include "content/common/notification_service.h" | 52 #include "content/browser/notification_service_impl.h" |
53 #include "content/public/common/content_client.h" | 53 #include "content/public/common/content_client.h" |
54 #include "testing/gtest/include/gtest/gtest.h" | 54 #include "testing/gtest/include/gtest/gtest.h" |
55 #include "ui/base/resource/resource_bundle.h" | 55 #include "ui/base/resource/resource_bundle.h" |
56 #include "ui/base/ui_base_paths.h" | 56 #include "ui/base/ui_base_paths.h" |
57 | 57 |
58 namespace { | 58 namespace { |
59 | 59 |
60 // A special command line switch to allow developers to manually launch the | 60 // A special command line switch to allow developers to manually launch the |
61 // browser and debug CF inside the browser. | 61 // browser and debug CF inside the browser. |
62 const char kManualBrowserLaunch[] = "manual-browser"; | 62 const char kManualBrowserLaunch[] = "manual-browser"; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 FakeExternalTab::~FakeExternalTab() { | 226 FakeExternalTab::~FakeExternalTab() { |
227 if (!overridden_user_dir_.empty()) { | 227 if (!overridden_user_dir_.empty()) { |
228 PathService::Override(chrome::DIR_USER_DATA, overridden_user_dir_); | 228 PathService::Override(chrome::DIR_USER_DATA, overridden_user_dir_); |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
232 void FakeExternalTab::Initialize() { | 232 void FakeExternalTab::Initialize() { |
233 DCHECK(g_browser_process == NULL); | 233 DCHECK(g_browser_process == NULL); |
234 | 234 |
235 notificaton_service_.reset(new NotificationService); | 235 notificaton_service_.reset(new NotificationServiceImpl); |
236 | 236 |
237 base::SystemMonitor system_monitor; | 237 base::SystemMonitor system_monitor; |
238 | 238 |
239 icu_util::Initialize(); | 239 icu_util::Initialize(); |
240 TestTimeouts::Initialize(); | 240 TestTimeouts::Initialize(); |
241 | 241 |
242 // Do not call chrome::RegisterPathProvider() since it is also called by our | 242 // Do not call chrome::RegisterPathProvider() since it is also called by our |
243 // test runner, CFUrlRequestUnittestRunner, and calling it twice unfortunately | 243 // test runner, CFUrlRequestUnittestRunner, and calling it twice unfortunately |
244 // causes a DCHECK(). | 244 // causes a DCHECK(). |
245 content::RegisterPathProvider(); | 245 content::RegisterPathProvider(); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 DCHECK_EQ(test_thread_.IsValid(), false); | 402 DCHECK_EQ(test_thread_.IsValid(), false); |
403 test_thread_.Set(::CreateThread(NULL, 0, RunAllUnittests, this, 0, | 403 test_thread_.Set(::CreateThread(NULL, 0, RunAllUnittests, this, 0, |
404 &test_thread_id_)); | 404 &test_thread_id_)); |
405 DCHECK(test_thread_.IsValid()); | 405 DCHECK(test_thread_.IsValid()); |
406 } | 406 } |
407 | 407 |
408 // static | 408 // static |
409 DWORD CFUrlRequestUnittestRunner::RunAllUnittests(void* param) { | 409 DWORD CFUrlRequestUnittestRunner::RunAllUnittests(void* param) { |
410 base::PlatformThread::SetName("CFUrlRequestUnittestRunner"); | 410 base::PlatformThread::SetName("CFUrlRequestUnittestRunner"); |
411 // Needed for some url request tests like the intercept job tests, etc. | 411 // Needed for some url request tests like the intercept job tests, etc. |
412 NotificationService service; | 412 NotificationServiceImpl service; |
413 CFUrlRequestUnittestRunner* me = | 413 CFUrlRequestUnittestRunner* me = |
414 reinterpret_cast<CFUrlRequestUnittestRunner*>(param); | 414 reinterpret_cast<CFUrlRequestUnittestRunner*>(param); |
415 me->test_result_ = me->Run(); | 415 me->test_result_ = me->Run(); |
416 me->fake_chrome_.ui_loop()->PostTask(FROM_HERE, | 416 me->fake_chrome_.ui_loop()->PostTask(FROM_HERE, |
417 NewRunnableFunction(TakeDownBrowser, me)); | 417 NewRunnableFunction(TakeDownBrowser, me)); |
418 return 0; | 418 return 0; |
419 } | 419 } |
420 | 420 |
421 // static | 421 // static |
422 void CFUrlRequestUnittestRunner::TakeDownBrowser( | 422 void CFUrlRequestUnittestRunner::TakeDownBrowser( |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); | 594 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); |
595 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); | 595 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); |
596 // Avoid CRT cleanup in debug test runs to ensure that webkit ASSERTs which | 596 // Avoid CRT cleanup in debug test runs to ensure that webkit ASSERTs which |
597 // check if globals are created and destroyed on the same thread don't fire. | 597 // check if globals are created and destroyed on the same thread don't fire. |
598 // Webkit global objects are created on the inproc renderer thread. | 598 // Webkit global objects are created on the inproc renderer thread. |
599 #if !defined(NDEBUG) | 599 #if !defined(NDEBUG) |
600 ExitProcess(test_suite.test_result()); | 600 ExitProcess(test_suite.test_result()); |
601 #endif // NDEBUG | 601 #endif // NDEBUG |
602 return test_suite.test_result(); | 602 return test_suite.test_result(); |
603 } | 603 } |
OLD | NEW |