Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: webkit/support/webkit_support.cc

Issue 10408091: Chromium support of running DumpRenderTree as an apk on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and move out net dependency from testing/android Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/support/platform_support_android.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // webkit/glue/plugin/plugin_list_win.cc checks --old-wmp. 274 // webkit/glue/plugin/plugin_list_win.cc checks --old-wmp.
266 // If DRT needs these flags, specify them in the following kFixedArguments. 275 // If DRT needs these flags, specify them in the following kFixedArguments.
267 const char* kFixedArguments[] = {"DumpRenderTree"}; 276 const char* kFixedArguments[] = {"DumpRenderTree"};
268 CommandLine::Init(arraysize(kFixedArguments), kFixedArguments); 277 CommandLine::Init(arraysize(kFixedArguments), kFixedArguments);
269 278
270 // Explicitly initialize the GURL library before spawning any threads. 279 // Explicitly initialize the GURL library before spawning any threads.
271 // Otherwise crash may happend when different threads try to create a GURL 280 // Otherwise crash may happend when different threads try to create a GURL
272 // at same time. 281 // at same time.
273 url_util::Initialize(); 282 url_util::Initialize();
274 base::AtExitManager* at_exit_manager = NULL; 283 base::AtExitManager* at_exit_manager = NULL;
284 // In Android DumpRenderTree, AtExitManager is created in
285 // testing/android/native_test_wrapper.cc before main() is called.
286 #if !defined(OS_ANDROID)
275 // Some initialization code may use a AtExitManager before initializing 287 // Some initialization code may use a AtExitManager before initializing
276 // TestEnvironment, so we create a AtExitManager early and pass its ownership 288 // TestEnvironment, so we create a AtExitManager early and pass its ownership
277 // to TestEnvironment. 289 // to TestEnvironment.
278 if (!unit_test_mode) 290 if (!unit_test_mode)
279 at_exit_manager = new base::AtExitManager; 291 at_exit_manager = new base::AtExitManager;
292 #endif
280 webkit_support::BeforeInitialize(unit_test_mode); 293 webkit_support::BeforeInitialize(unit_test_mode);
281 test_environment = new TestEnvironment(unit_test_mode, at_exit_manager); 294 test_environment = new TestEnvironment(unit_test_mode, at_exit_manager);
282 webkit_support::AfterInitialize(unit_test_mode); 295 webkit_support::AfterInitialize(unit_test_mode);
283 if (!unit_test_mode) { 296 if (!unit_test_mode) {
284 // Load ICU data tables. This has to run after TestEnvironment is created 297 // Load ICU data tables. This has to run after TestEnvironment is created
285 // because on Linux, we need base::AtExitManager. 298 // because on Linux, we need base::AtExitManager.
286 icu_util::Initialize(); 299 icu_util::Initialize();
287 } 300 }
288 webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct( 301 webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct(
289 "DumpRenderTree/0.0.0.0"), false); 302 "DumpRenderTree/0.0.0.0"), false);
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 // Logging 781 // Logging
769 void EnableWebCoreLogChannels(const std::string& channels) { 782 void EnableWebCoreLogChannels(const std::string& channels) {
770 webkit_glue::EnableWebCoreLogChannels(channels); 783 webkit_glue::EnableWebCoreLogChannels(channels);
771 } 784 }
772 785
773 void SetGamepadData(const WebKit::WebGamepads& pads) { 786 void SetGamepadData(const WebKit::WebGamepads& pads) {
774 test_environment->webkit_platform_support()->setGamepadData(pads); 787 test_environment->webkit_platform_support()->setGamepadData(pads);
775 } 788 }
776 789
777 } // namespace webkit_support 790 } // namespace webkit_support
OLDNEW
« no previous file with comments | « webkit/support/platform_support_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698