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 "webkit/support/webkit_support.h" | 5 #include "webkit/support/webkit_support.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 #include "webkit/plugins/webplugininfo.h" | 64 #include "webkit/plugins/webplugininfo.h" |
65 #include "webkit/support/platform_support.h" | 65 #include "webkit/support/platform_support.h" |
66 #include "webkit/support/simple_database_system.h" | 66 #include "webkit/support/simple_database_system.h" |
67 #include "webkit/support/test_webkit_platform_support.h" | 67 #include "webkit/support/test_webkit_platform_support.h" |
68 #include "webkit/support/test_webplugin_page_delegate.h" | 68 #include "webkit/support/test_webplugin_page_delegate.h" |
69 #include "webkit/tools/test_shell/simple_appcache_system.h" | 69 #include "webkit/tools/test_shell/simple_appcache_system.h" |
70 #include "webkit/tools/test_shell/simple_dom_storage_system.h" | 70 #include "webkit/tools/test_shell/simple_dom_storage_system.h" |
71 #include "webkit/tools/test_shell/simple_file_system.h" | 71 #include "webkit/tools/test_shell/simple_file_system.h" |
72 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 72 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
73 | 73 |
74 #if defined(OS_ANDROID) | |
75 #include "base/test/test_support_android.h" | |
76 #endif | |
77 | |
74 using WebKit::WebCString; | 78 using WebKit::WebCString; |
75 using WebKit::WebDevToolsAgentClient; | 79 using WebKit::WebDevToolsAgentClient; |
76 using WebKit::WebFileSystem; | 80 using WebKit::WebFileSystem; |
77 using WebKit::WebFileSystemCallbacks; | 81 using WebKit::WebFileSystemCallbacks; |
78 using WebKit::WebFrame; | 82 using WebKit::WebFrame; |
79 using WebKit::WebMediaPlayerClient; | 83 using WebKit::WebMediaPlayerClient; |
80 using WebKit::WebPlugin; | 84 using WebKit::WebPlugin; |
81 using WebKit::WebPluginParams; | 85 using WebKit::WebPluginParams; |
82 using WebKit::WebString; | 86 using WebKit::WebString; |
83 using WebKit::WebURL; | 87 using WebKit::WebURL; |
(...skipping 13 matching lines...) Expand all Loading... | |
97 UINT new_flags = SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX | 101 UINT new_flags = SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX |
98 | SEM_NOGPFAULTERRORBOX; | 102 | SEM_NOGPFAULTERRORBOX; |
99 | 103 |
100 // Preserve existing error mode, as discussed at | 104 // Preserve existing error mode, as discussed at |
101 // http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx | 105 // http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx |
102 UINT existing_flags = SetErrorMode(new_flags); | 106 UINT existing_flags = SetErrorMode(new_flags); |
103 SetErrorMode(existing_flags | new_flags); | 107 SetErrorMode(existing_flags | new_flags); |
104 } | 108 } |
105 #endif | 109 #endif |
106 | 110 |
111 #if defined(OS_ANDROID) | |
112 // On Android we expect the log to appear in logcat. | |
113 InitAndroidTestLogging(); | |
114 #else | |
107 FilePath log_filename; | 115 FilePath log_filename; |
108 PathService::Get(base::DIR_EXE, &log_filename); | 116 PathService::Get(base::DIR_EXE, &log_filename); |
109 log_filename = log_filename.AppendASCII("DumpRenderTree.log"); | 117 log_filename = log_filename.AppendASCII("DumpRenderTree.log"); |
110 logging::InitLogging( | 118 logging::InitLogging( |
111 log_filename.value().c_str(), | 119 log_filename.value().c_str(), |
112 // Only log to a file. This prevents debugging output from disrupting | 120 // Only log to a file. This prevents debugging output from disrupting |
113 // whether or not we pass. | 121 // whether or not we pass. |
114 logging::LOG_ONLY_TO_FILE, | 122 logging::LOG_ONLY_TO_FILE, |
115 // We might have multiple DumpRenderTree processes going at once. | 123 // We might have multiple DumpRenderTree processes going at once. |
116 logging::LOCK_LOG_FILE, | 124 logging::LOCK_LOG_FILE, |
117 logging::DELETE_OLD_LOG_FILE, | 125 logging::DELETE_OLD_LOG_FILE, |
118 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | 126 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); |
119 | 127 |
120 // We want process and thread IDs because we may have multiple processes. | 128 // We want process and thread IDs because we may have multiple processes. |
121 const bool kProcessId = true; | 129 const bool kProcessId = true; |
122 const bool kThreadId = true; | 130 const bool kThreadId = true; |
123 const bool kTimestamp = true; | 131 const bool kTimestamp = true; |
124 const bool kTickcount = true; | 132 const bool kTickcount = true; |
125 logging::SetLogItems(kProcessId, kThreadId, !kTimestamp, kTickcount); | 133 logging::SetLogItems(kProcessId, kThreadId, !kTimestamp, kTickcount); |
134 #endif // else defined(OS_ANDROID) | |
126 } | 135 } |
127 | 136 |
128 class TestEnvironment { | 137 class TestEnvironment { |
129 public: | 138 public: |
130 #if defined(OS_ANDROID) | 139 #if defined(OS_ANDROID) |
131 // Android UI message loop goes through Java, so don't use it in tests. | 140 // Android UI message loop goes through Java, so don't use it in tests. |
132 typedef MessageLoop MessageLoopType; | 141 typedef MessageLoop MessageLoopType; |
133 #else | 142 #else |
134 typedef MessageLoopForUI MessageLoopType; | 143 typedef MessageLoopForUI MessageLoopType; |
135 #endif | 144 #endif |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 | 264 |
256 // Explicitly initialize the GURL library before spawning any threads. | 265 // Explicitly initialize the GURL library before spawning any threads. |
257 // Otherwise crash may happend when different threads try to create a GURL | 266 // Otherwise crash may happend when different threads try to create a GURL |
258 // at same time. | 267 // at same time. |
259 url_util::Initialize(); | 268 url_util::Initialize(); |
260 base::AtExitManager* at_exit_manager = NULL; | 269 base::AtExitManager* at_exit_manager = NULL; |
261 // Some initialization code may use a AtExitManager before initializing | 270 // Some initialization code may use a AtExitManager before initializing |
262 // TestEnvironment, so we create a AtExitManager early and pass its ownership | 271 // TestEnvironment, so we create a AtExitManager early and pass its ownership |
263 // to TestEnvironment. | 272 // to TestEnvironment. |
264 if (!unit_test_mode) | 273 if (!unit_test_mode) |
265 at_exit_manager = new base::AtExitManager; | 274 at_exit_manager = new base::ShadowingAtExitManager; |
Paweł Hajdan Jr.
2012/05/25 19:06:08
Don't do that, it's most likely papering over some
Xianzhu
2012/05/29 17:15:55
Now use #if !defined(OS_ANDROID).
| |
266 BeforeInitialize(unit_test_mode); | 275 BeforeInitialize(unit_test_mode); |
267 test_environment = new TestEnvironment(unit_test_mode, at_exit_manager); | 276 test_environment = new TestEnvironment(unit_test_mode, at_exit_manager); |
268 AfterInitialize(unit_test_mode); | 277 AfterInitialize(unit_test_mode); |
269 if (!unit_test_mode) { | 278 if (!unit_test_mode) { |
270 // Load ICU data tables. This has to run after TestEnvironment is created | 279 // Load ICU data tables. This has to run after TestEnvironment is created |
271 // because on Linux, we need base::AtExitManager. | 280 // because on Linux, we need base::AtExitManager. |
272 icu_util::Initialize(); | 281 icu_util::Initialize(); |
273 } | 282 } |
274 webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct( | 283 webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct( |
275 "DumpRenderTree/0.0.0.0"), false); | 284 "DumpRenderTree/0.0.0.0"), false); |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
714 // Logging | 723 // Logging |
715 void EnableWebCoreLogChannels(const std::string& channels) { | 724 void EnableWebCoreLogChannels(const std::string& channels) { |
716 webkit_glue::EnableWebCoreLogChannels(channels); | 725 webkit_glue::EnableWebCoreLogChannels(channels); |
717 } | 726 } |
718 | 727 |
719 void SetGamepadData(const WebKit::WebGamepads& pads) { | 728 void SetGamepadData(const WebKit::WebGamepads& pads) { |
720 test_environment->webkit_platform_support()->setGamepadData(pads); | 729 test_environment->webkit_platform_support()->setGamepadData(pads); |
721 } | 730 } |
722 | 731 |
723 } // namespace webkit_support | 732 } // namespace webkit_support |
OLD | NEW |