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

Unified Diff: content/test/test_webkit_platform_support.cc

Issue 41703005: Revert "Trim more dead code from webkit/support/" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/test_webkit_platform_support.h ('k') | content/test/webkit_support.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/test_webkit_platform_support.cc
diff --git a/content/test/test_webkit_platform_support.cc b/content/test/test_webkit_platform_support.cc
index dbbc5c7a12890f116ea4a38220021800e376bf4b..4c9bf779a179fcbca0444fd5245fcac391c02d05 100644
--- a/content/test/test_webkit_platform_support.cc
+++ b/content/test/test_webkit_platform_support.cc
@@ -4,8 +4,10 @@
#include "content/test/test_webkit_platform_support.h"
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/scoped_temp_dir.h"
#include "base/metrics/stats_counters.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
@@ -13,11 +15,25 @@
#include "content/test/web_gesture_curve_mock.h"
#include "content/test/web_layer_tree_view_impl_for_testing.h"
#include "content/test/weburl_loader_mock_factory.h"
+#include "media/base/media.h"
+#include "net/cookies/cookie_monster.h"
+#include "net/test/spawned_test_server/spawned_test_server.h"
#include "third_party/WebKit/public/platform/WebData.h"
+#include "third_party/WebKit/public/platform/WebFileSystem.h"
+#include "third_party/WebKit/public/platform/WebStorageArea.h"
+#include "third_party/WebKit/public/platform/WebStorageNamespace.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
+#include "third_party/WebKit/public/web/WebDatabase.h"
#include "third_party/WebKit/public/web/WebKit.h"
+#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
+#include "third_party/WebKit/public/web/WebScriptController.h"
+#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
+#include "third_party/WebKit/public/web/WebStorageEventDispatcher.h"
#include "v8/include/v8.h"
+#include "webkit/browser/database/vfs_backend.h"
+#include "webkit/child/webkitplatformsupport_impl.h"
+#include "webkit/glue/simple_webmimeregistry_impl.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h"
@@ -27,6 +43,7 @@
#include "base/mac/mac_util.h"
#endif
+using WebKit::WebScriptController;
using webkit::WebLayerTreeViewImplForTesting;
namespace content {
@@ -36,12 +53,55 @@ TestWebKitPlatformSupport::TestWebKitPlatformSupport() {
mock_clipboard_.reset(new MockWebClipboardImpl());
v8::V8::SetCounterFunction(base::StatsTable::FindLocation);
+ WebKit::initialize(this);
+ WebKit::setLayoutTestMode(true);
+ WebKit::WebSecurityPolicy::registerURLSchemeAsLocal(
+ WebKit::WebString::fromUTF8("test-shell-resource"));
+ WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess(
+ WebKit::WebString::fromUTF8("test-shell-resource"));
+ WebKit::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(
+ WebKit::WebString::fromUTF8("test-shell-resource"));
+ WebKit::WebSecurityPolicy::registerURLSchemeAsEmptyDocument(
+ WebKit::WebString::fromUTF8("test-shell-resource"));
+ WebScriptController::enableV8SingleThreadMode();
+ WebKit::WebRuntimeFeatures::enableApplicationCache(true);
+ WebKit::WebRuntimeFeatures::enableDatabase(true);
+ WebKit::WebRuntimeFeatures::enableNotifications(true);
+ WebKit::WebRuntimeFeatures::enableTouch(true);
+
+ // Load libraries for media and enable the media player.
+ bool enable_media = false;
+ base::FilePath module_path;
+ if (PathService::Get(base::DIR_MODULE, &module_path)) {
+#if defined(OS_MACOSX)
+ if (base::mac::AmIBundled())
+ module_path = module_path.DirName().DirName().DirName();
+#endif
+ if (media::InitializeMediaLibrary(module_path))
+ enable_media = true;
+ }
+ WebKit::WebRuntimeFeatures::enableMediaPlayer(enable_media);
+ LOG_IF(WARNING, !enable_media) << "Failed to initialize the media library.\n";
+
+ // TODO(joth): Make a dummy geolocation service implemenation for
+ // test_shell, and set this to true. http://crbug.com/36451
+ WebKit::WebRuntimeFeatures::enableGeolocation(false);
+
+ file_utilities_.set_sandbox_enabled(false);
+
+ if (!file_system_root_.CreateUniqueTempDir()) {
+ LOG(WARNING) << "Failed to create a temp dir for the filesystem."
+ "FileSystem feature will be disabled.";
+ DCHECK(file_system_root_.path().empty());
+ }
#if defined(OS_WIN)
// Ensure we pick up the default theme engine.
SetThemeEngine(NULL);
#endif
+ net::CookieMonster::EnableFileScheme();
+
// Test shell always exposes the GC.
webkit_glue::SetJavaScriptFlags(" --expose-gc");
}
@@ -62,11 +122,41 @@ WebKit::WebClipboard* TestWebKitPlatformSupport::clipboard() {
return mock_clipboard_.get();
}
+WebKit::WebFileUtilities* TestWebKitPlatformSupport::fileUtilities() {
+ return &file_utilities_;
+}
+
+WebKit::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() {
+ NOTREACHED() <<
+ "IndexedDB cannot be tested with in-process harnesses.";
+ return NULL;
+}
+
WebKit::WebURLLoader* TestWebKitPlatformSupport::createURLLoader() {
return url_loader_factory_->CreateURLLoader(
webkit_glue::WebKitPlatformSupportImpl::createURLLoader());
}
+WebKit::WebData TestWebKitPlatformSupport::loadResource(const char* name) {
+ if (!strcmp(name, "deleteButton")) {
+ // Create a red 30x30 square.
+ const char red_square[] =
+ "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52"
+ "\x00\x00\x00\x1e\x00\x00\x00\x1e\x04\x03\x00\x00\x00\xc9\x1e\xb3"
+ "\x91\x00\x00\x00\x30\x50\x4c\x54\x45\x00\x00\x00\x80\x00\x00\x00"
+ "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80"
+ "\x80\xc0\xc0\xc0\xff\x00\x00\x00\xff\x00\xff\xff\x00\x00\x00\xff"
+ "\xff\x00\xff\x00\xff\xff\xff\xff\xff\x7b\x1f\xb1\xc4\x00\x00\x00"
+ "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a"
+ "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a"
+ "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d"
+ "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60"
+ "\x82";
+ return WebKit::WebData(red_square, arraysize(red_square));
+ }
+ return webkit_glue::WebKitPlatformSupportImpl::loadResource(name);
+}
+
WebKit::WebString TestWebKitPlatformSupport::queryLocalizedString(
WebKit::WebLocalizedString::Name name) {
// Returns placeholder strings to check if they are correctly localized.
« no previous file with comments | « content/test/test_webkit_platform_support.h ('k') | content/test/webkit_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698