summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 22:51:20 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 22:51:20 +0000
commit5e6bd3e3630c63f1cb422de5950269e9568d3acd (patch)
treeaad7aa3bcfd0433ccc9fe3c84d5bea46759f8cf6
parent210399f6f7eddbe934e8eaef79277d96fccb2e51 (diff)
downloadchromium_src-5e6bd3e3630c63f1cb422de5950269e9568d3acd.zip
chromium_src-5e6bd3e3630c63f1cb422de5950269e9568d3acd.tar.gz
chromium_src-5e6bd3e3630c63f1cb422de5950269e9568d3acd.tar.bz2
Enable FileSystem for TestShell.
BUG=52799 TEST=none Review URL: http://codereview.chromium.org/3369011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59167 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/tools/test_shell/test_shell.cc6
-rw-r--r--webkit/tools/test_shell/test_shell.h8
-rw-r--r--webkit/tools/test_shell/test_shell_webkit_init.cc1
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc17
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h6
5 files changed, 38 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index a433901..5573179 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -159,6 +159,12 @@ TestShell::TestShell()
url_util::AddStandardScheme("test-shell-resource");
URLRequest::RegisterProtocolFactory("blob", &BlobURLRequestJobFactory);
+
+ 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());
+ }
}
TestShell::~TestShell() {
diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h
index cca827a6..737bd72 100644
--- a/webkit/tools/test_shell/test_shell.h
+++ b/webkit/tools/test_shell/test_shell.h
@@ -33,6 +33,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/scoped_temp_dir.h"
#if defined(OS_MACOSX)
#include "base/lazy_instance.h"
#endif
@@ -317,6 +318,10 @@ public:
test_params_ = test_params;
}
+ const FilePath& file_system_root() const {
+ return file_system_root_.path();
+ }
+
#if defined(OS_MACOSX)
// handle cleaning up a shell given the associated window
static void DestroyAssociatedShell(gfx::NativeWindow handle);
@@ -416,6 +421,9 @@ private:
scoped_ptr<WebKit::WebDeviceOrientationClientMock>
device_orientation_client_mock_;
+ // A temporary directory for FileSystem API.
+ ScopedTempDir file_system_root_;
+
const TestParams* test_params_;
// True while a test is preparing to run
diff --git a/webkit/tools/test_shell/test_shell_webkit_init.cc b/webkit/tools/test_shell/test_shell_webkit_init.cc
index f9ab233..812d815 100644
--- a/webkit/tools/test_shell/test_shell_webkit_init.cc
+++ b/webkit/tools/test_shell/test_shell_webkit_init.cc
@@ -40,6 +40,7 @@ TestShellWebKitInit::TestShellWebKitInit(bool layout_test_mode) {
WebKit::WebRuntimeFeatures::enableTouch(true);
WebKit::WebRuntimeFeatures::enableIndexedDatabase(true);
WebKit::WebRuntimeFeatures::enableSpeechInput(true);
+ WebKit::WebRuntimeFeatures::enableFileSystem(true);
// TODO(hwennborg): Enable this once the implementation supports it.
WebKit::WebRuntimeFeatures::enableDeviceMotion(false);
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 82941a3..c3dfeae 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -28,6 +28,8 @@
#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h"
#include "third_party/WebKit/WebKit/chromium/public/WebImage.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFileError.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h"
@@ -87,6 +89,8 @@ using WebKit::WebDataSource;
using WebKit::WebDragData;
using WebKit::WebDragOperationsMask;
using WebKit::WebEditingAction;
+using WebKit::WebFileSystem;
+using WebKit::WebFileSystemCallbacks;
using WebKit::WebFormElement;
using WebKit::WebFrame;
using WebKit::WebHistoryItem;
@@ -1105,6 +1109,19 @@ bool TestWebViewDelegate::allowScript(WebFrame* frame,
return enabled_per_settings && shell_->allow_scripts();
}
+void TestWebViewDelegate::openFileSystem(
+ WebFrame* frame, WebFileSystem::Type type, long long size,
+ WebFileSystemCallbacks* callbacks) {
+ if (shell_->file_system_root().empty()) {
+ // The FileSystem temp directory was not initialized successfully.
+ callbacks->didFail(WebKit::WebFileErrorSecurity);
+ } else {
+ callbacks->didOpenFileSystem(
+ "TestShellFileSystem",
+ webkit_glue::FilePathToWebString(shell_->file_system_root()));
+ }
+}
+
// WebPluginPageDelegate -----------------------------------------------------
WebCookieJar* TestWebViewDelegate::GetCookieJar() {
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index 6648496..e4b3e2f 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -27,6 +27,7 @@
#include "base/scoped_ptr.h"
#include "base/weak_ptr.h"
#include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrameClient.h"
#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#if defined(OS_MACOSX)
@@ -222,6 +223,11 @@ class TestWebViewDelegate : public WebKit::WebViewClient,
virtual void didRunInsecureContent(
WebKit::WebFrame* frame, const WebKit::WebSecurityOrigin& origin);
virtual bool allowScript(WebKit::WebFrame* frame, bool enabled_per_settings);
+ virtual void openFileSystem(
+ WebKit::WebFrame* frame,
+ WebKit::WebFileSystem::Type type,
+ long long size,
+ WebKit::WebFileSystemCallbacks* callbacks);
// webkit_glue::WebPluginPageDelegate
virtual webkit_glue::WebPluginDelegate* CreatePluginDelegate(