diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 01:28:10 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 01:28:10 +0000 |
commit | 5eb4be2a0f9036b9b300f3f1d1764b506c9abefa (patch) | |
tree | 2219d3112077a4d6129f6bc4045d1b0ace04ade4 /webkit/support | |
parent | 240fbc1de4f075ff33081ada91e830791e0e225c (diff) | |
download | chromium_src-5eb4be2a0f9036b9b300f3f1d1764b506c9abefa.zip chromium_src-5eb4be2a0f9036b9b300f3f1d1764b506c9abefa.tar.gz chromium_src-5eb4be2a0f9036b9b300f3f1d1764b506c9abefa.tar.bz2 |
Add DRT support code for FileSystem
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3779005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63164 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support')
-rw-r--r-- | webkit/support/test_webkit_client.cc | 6 | ||||
-rw-r--r-- | webkit/support/test_webkit_client.h | 5 | ||||
-rw-r--r-- | webkit/support/webkit_support.cc | 18 | ||||
-rw-r--r-- | webkit/support/webkit_support.h | 6 |
4 files changed, 35 insertions, 0 deletions
diff --git a/webkit/support/test_webkit_client.cc b/webkit/support/test_webkit_client.cc index 3bceef0..65897f4 100644 --- a/webkit/support/test_webkit_client.cc +++ b/webkit/support/test_webkit_client.cc @@ -117,6 +117,12 @@ TestWebKitClient::TestWebKitClient(bool unit_test_mode) 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); diff --git a/webkit/support/test_webkit_client.h b/webkit/support/test_webkit_client.h index a601ecb..6f1d28d 100644 --- a/webkit/support/test_webkit_client.h +++ b/webkit/support/test_webkit_client.h @@ -73,6 +73,10 @@ class TestWebKitClient : public webkit_glue::WebKitClientImpl { return &url_loader_factory_; } + const FilePath& file_system_root() const { + return file_system_root_.path(); + } + private: TestShellWebMimeRegistryImpl mime_registry_; MockWebClipboardImpl mock_clipboard_; @@ -83,6 +87,7 @@ class TestWebKitClient : public webkit_glue::WebKitClientImpl { SimpleWebCookieJarImpl cookie_jar_; scoped_refptr<TestShellWebBlobRegistryImpl> blob_registry_; SimpleFileSystem file_system_; + ScopedTempDir file_system_root_; WebURLLoaderMockFactory url_loader_factory_; bool unit_test_mode_; diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index f0e3f85..7844d98c7 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -28,6 +28,7 @@ #include "net/base/net_errors.h" #include "net/base/net_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h" #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" @@ -51,6 +52,8 @@ using WebKit::WebCString; using WebKit::WebDevToolsAgentClient; +using WebKit::WebFileSystem; +using WebKit::WebFileSystemCallbacks; using WebKit::WebFrame; using WebKit::WebMediaPlayerClient; using WebKit::WebPlugin; @@ -535,4 +538,19 @@ WebURL GetDevToolsPathAsURL() { return net::FilePathToFileURL(devToolsPath); } +// FileSystem +void OpenFileSystem(WebFrame*, WebFileSystem::Type, + WebFileSystemCallbacks* callbacks) { + // TODO(kinuko): hook up FileSystemPathManager in a way that the code could + // be shared with test_shell. + if (test_environment->webkit_client()->file_system_root().empty()) { + callbacks->didFail(WebKit::WebFileErrorSecurity); + } else { + callbacks->didOpenFileSystem( + "TestShellFileSystem", + webkit_glue::FilePathToWebString( + test_environment->webkit_client()->file_system_root())); + } +} + } // namespace webkit_support diff --git a/webkit/support/webkit_support.h b/webkit/support/webkit_support.h index b9642d8..3fc2a03 100644 --- a/webkit/support/webkit_support.h +++ b/webkit/support/webkit_support.h @@ -12,12 +12,14 @@ #include "base/basictypes.h" #include "base/string16.h" #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgentClient.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" class WebURLLoaderMockFactory; namespace WebKit { class WebApplicationCacheHost; class WebApplicationCacheHostClient; class WebCString; +class WebFileSystemCallbacks; class WebFrame; class WebKitClient; class WebMediaPlayer; @@ -153,6 +155,10 @@ WebKit::WebThemeEngine* GetThemeEngine(); WebKit::WebCString GetDevToolsDebuggerScriptSource(); WebKit::WebURL GetDevToolsPathAsURL(); +// - FileSystem +void OpenFileSystem(WebKit::WebFrame* frame, WebKit::WebFileSystem::Type type, + WebKit::WebFileSystemCallbacks* callbacks); + // -------- Keyboard code enum { VKEY_LEFT = app::VKEY_LEFT, |