Chromium Code Reviews| 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/npapi/webplugin_impl.h" | 64 #include "webkit/plugins/npapi/webplugin_impl.h" |
| 65 #include "webkit/plugins/npapi/webplugin_page_delegate.h" | 65 #include "webkit/plugins/npapi/webplugin_page_delegate.h" |
| 66 #include "webkit/plugins/webplugininfo.h" | 66 #include "webkit/plugins/webplugininfo.h" |
| 67 #include "webkit/renderer/appcache/web_application_cache_host_impl.h" | 67 #include "webkit/renderer/appcache/web_application_cache_host_impl.h" |
| 68 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" | 68 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" |
| 69 #include "webkit/renderer/media/media_stream_client.h" | 69 #include "webkit/renderer/media/media_stream_client.h" |
| 70 #include "webkit/renderer/media/webmediaplayer_impl.h" | 70 #include "webkit/renderer/media/webmediaplayer_impl.h" |
| 71 #include "webkit/renderer/media/webmediaplayer_ms.h" | 71 #include "webkit/renderer/media/webmediaplayer_ms.h" |
| 72 #include "webkit/renderer/media/webmediaplayer_params.h" | 72 #include "webkit/renderer/media/webmediaplayer_params.h" |
| 73 #include "webkit/support/platform_support.h" | 73 #include "webkit/support/platform_support.h" |
| 74 #include "webkit/support/simple_appcache_system.h" | |
| 75 #include "webkit/support/simple_database_system.h" | 74 #include "webkit/support/simple_database_system.h" |
| 76 #include "webkit/support/simple_dom_storage_system.h" | 75 #include "webkit/support/simple_dom_storage_system.h" |
| 77 #include "webkit/support/simple_file_system.h" | |
| 78 #include "webkit/support/simple_resource_loader_bridge.h" | |
| 79 #include "webkit/support/test_webkit_platform_support.h" | 76 #include "webkit/support/test_webkit_platform_support.h" |
| 80 #include "webkit/support/test_webplugin_page_delegate.h" | 77 #include "webkit/support/test_webplugin_page_delegate.h" |
| 81 #include "webkit/support/web_layer_tree_view_impl_for_testing.h" | 78 #include "webkit/support/web_layer_tree_view_impl_for_testing.h" |
| 82 | 79 |
| 83 #if defined(OS_ANDROID) | 80 #if defined(OS_ANDROID) |
| 84 #include "base/test/test_support_android.h" | 81 #include "base/test/test_support_android.h" |
| 85 #include "webkit/support/test_stream_texture_factory_android.h" | 82 #include "webkit/support/test_stream_texture_factory_android.h" |
| 86 #endif | 83 #endif |
| 87 | 84 |
| 88 using WebKit::WebCString; | 85 using WebKit::WebCString; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 InitLogging(); | 163 InitLogging(); |
| 167 } | 164 } |
| 168 main_message_loop_.reset(new MessageLoopType); | 165 main_message_loop_.reset(new MessageLoopType); |
| 169 | 166 |
| 170 // TestWebKitPlatformSupport must be instantiated after MessageLoopType. | 167 // TestWebKitPlatformSupport must be instantiated after MessageLoopType. |
| 171 webkit_platform_support_.reset( | 168 webkit_platform_support_.reset( |
| 172 new TestWebKitPlatformSupport(unit_test_mode, | 169 new TestWebKitPlatformSupport(unit_test_mode, |
| 173 shadow_platform_delegate)); | 170 shadow_platform_delegate)); |
| 174 } | 171 } |
| 175 | 172 |
| 176 ~TestEnvironment() { | |
| 177 SimpleResourceLoaderBridge::Shutdown(); | |
| 178 } | |
| 179 | |
| 180 TestWebKitPlatformSupport* webkit_platform_support() const { | 173 TestWebKitPlatformSupport* webkit_platform_support() const { |
| 181 return webkit_platform_support_.get(); | 174 return webkit_platform_support_.get(); |
| 182 } | 175 } |
| 183 | 176 |
| 184 #if defined(OS_WIN) || defined(OS_MACOSX) | 177 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 185 void set_theme_engine(WebKit::WebThemeEngine* engine) { | 178 void set_theme_engine(WebKit::WebThemeEngine* engine) { |
| 186 DCHECK(webkit_platform_support_ != 0); | 179 DCHECK(webkit_platform_support_ != 0); |
| 187 webkit_platform_support_->SetThemeEngine(engine); | 180 webkit_platform_support_->SetThemeEngine(engine); |
| 188 } | 181 } |
| 189 | 182 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 424 #endif | 417 #endif |
| 425 } | 418 } |
| 426 | 419 |
| 427 WebKit::WebMediaPlayer* CreateMediaPlayer( | 420 WebKit::WebMediaPlayer* CreateMediaPlayer( |
| 428 WebFrame* frame, | 421 WebFrame* frame, |
| 429 const WebURL& url, | 422 const WebURL& url, |
| 430 WebMediaPlayerClient* client) { | 423 WebMediaPlayerClient* client) { |
| 431 return CreateMediaPlayer(frame, url, client, NULL); | 424 return CreateMediaPlayer(frame, url, client, NULL); |
| 432 } | 425 } |
| 433 | 426 |
| 434 WebKit::WebApplicationCacheHost* CreateApplicationCacheHost( | |
| 435 WebFrame*, WebKit::WebApplicationCacheHostClient* client) { | |
| 436 return SimpleAppCacheSystem::CreateApplicationCacheHost(client); | |
| 437 } | |
| 438 | |
| 439 WebKit::WebStorageNamespace* CreateSessionStorageNamespace(unsigned quota) { | 427 WebKit::WebStorageNamespace* CreateSessionStorageNamespace(unsigned quota) { |
| 440 return SimpleDomStorageSystem::instance().CreateSessionStorageNamespace(); | 428 return SimpleDomStorageSystem::instance().CreateSessionStorageNamespace(); |
| 441 } | 429 } |
| 442 | 430 |
| 443 WebKit::WebString GetWebKitRootDir() { | 431 WebKit::WebString GetWebKitRootDir() { |
| 444 base::FilePath path = GetWebKitRootDirFilePath(); | 432 base::FilePath path = GetWebKitRootDirFilePath(); |
| 445 std::string path_ascii = path.MaybeAsASCII(); | 433 std::string path_ascii = path.MaybeAsASCII(); |
| 446 CHECK(!path_ascii.empty()); | 434 CHECK(!path_ascii.empty()); |
| 447 return WebKit::WebString::fromUTF8(path_ascii.c_str()); | 435 return WebKit::WebString::fromUTF8(path_ascii.c_str()); |
| 448 } | 436 } |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 772 SimpleDatabaseSystem::GetInstance()->SetDatabaseQuota(quota); | 760 SimpleDatabaseSystem::GetInstance()->SetDatabaseQuota(quota); |
| 773 } | 761 } |
| 774 | 762 |
| 775 void ClearAllDatabases() { | 763 void ClearAllDatabases() { |
| 776 SimpleDatabaseSystem::GetInstance()->ClearAllDatabases(); | 764 SimpleDatabaseSystem::GetInstance()->ClearAllDatabases(); |
| 777 } | 765 } |
| 778 | 766 |
| 779 // Bridge for SimpleResourceLoaderBridge | 767 // Bridge for SimpleResourceLoaderBridge |
| 780 | 768 |
| 781 void SetAcceptAllCookies(bool accept) { | 769 void SetAcceptAllCookies(bool accept) { |
| 782 SimpleResourceLoaderBridge::SetAcceptAllCookies(accept); | 770 LOG(ERROR) << "XXX:" << accept; |
|
jamesr
2013/06/20 04:58:00
hmm, NOTREACHED() << accept; ?
scottmg
2013/06/20 05:04:32
Done.
| |
| 783 } | 771 } |
| 784 | 772 |
| 785 // Theme engine | 773 // Theme engine |
| 786 #if defined(OS_WIN) || defined(OS_MACOSX) | 774 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 787 | 775 |
| 788 void SetThemeEngine(WebKit::WebThemeEngine* engine) { | 776 void SetThemeEngine(WebKit::WebThemeEngine* engine) { |
| 789 DCHECK(test_environment); | 777 DCHECK(test_environment); |
| 790 test_environment->set_theme_engine(engine); | 778 test_environment->set_theme_engine(engine); |
| 791 } | 779 } |
| 792 | 780 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 805 return WebURL(); | 793 return WebURL(); |
| 806 } | 794 } |
| 807 #if defined(OS_MACOSX) | 795 #if defined(OS_MACOSX) |
| 808 dirExe = dirExe.AppendASCII("../../.."); | 796 dirExe = dirExe.AppendASCII("../../.."); |
| 809 #endif | 797 #endif |
| 810 base::FilePath devToolsPath = dirExe.AppendASCII( | 798 base::FilePath devToolsPath = dirExe.AppendASCII( |
| 811 "resources/inspector/devtools.html"); | 799 "resources/inspector/devtools.html"); |
| 812 return net::FilePathToFileURL(devToolsPath); | 800 return net::FilePathToFileURL(devToolsPath); |
| 813 } | 801 } |
| 814 | 802 |
| 815 // FileSystem | |
| 816 void OpenFileSystem(WebFrame* frame, | |
| 817 WebKit::WebFileSystemType type, | |
| 818 long long size, bool create, WebFileSystemCallbacks* callbacks) { | |
| 819 SimpleFileSystem* fileSystem = static_cast<SimpleFileSystem*>( | |
| 820 test_environment->webkit_platform_support()->fileSystem()); | |
| 821 fileSystem->OpenFileSystem(frame, type, size, create, callbacks); | |
| 822 } | |
| 823 | |
| 824 void DeleteFileSystem(WebFrame* frame, | |
| 825 WebKit::WebFileSystemType type, | |
| 826 WebFileSystemCallbacks* callbacks) { | |
| 827 SimpleFileSystem* fileSystem = static_cast<SimpleFileSystem*>( | |
| 828 test_environment->webkit_platform_support()->fileSystem()); | |
| 829 fileSystem->DeleteFileSystem(frame, type, callbacks); | |
| 830 } | |
| 831 | |
| 832 WebKit::WebString RegisterIsolatedFileSystem( | 803 WebKit::WebString RegisterIsolatedFileSystem( |
| 833 const WebKit::WebVector<WebKit::WebString>& filenames) { | 804 const WebKit::WebVector<WebKit::WebString>& filenames) { |
| 834 fileapi::IsolatedContext::FileInfoSet files; | 805 fileapi::IsolatedContext::FileInfoSet files; |
| 835 for (size_t i = 0; i < filenames.size(); ++i) { | 806 for (size_t i = 0; i < filenames.size(); ++i) { |
| 836 base::FilePath path = webkit_base::WebStringToFilePath(filenames[i]); | 807 base::FilePath path = webkit_base::WebStringToFilePath(filenames[i]); |
| 837 files.AddPath(path, NULL); | 808 files.AddPath(path, NULL); |
| 838 } | 809 } |
| 839 std::string filesystemId = | 810 std::string filesystemId = |
| 840 fileapi::IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files); | 811 fileapi::IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files); |
| 841 return UTF8ToUTF16(filesystemId); | 812 return UTF8ToUTF16(filesystemId); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 852 // Logging | 823 // Logging |
| 853 void EnableWebCoreLogChannels(const std::string& channels) { | 824 void EnableWebCoreLogChannels(const std::string& channels) { |
| 854 webkit_glue::EnableWebCoreLogChannels(channels); | 825 webkit_glue::EnableWebCoreLogChannels(channels); |
| 855 } | 826 } |
| 856 | 827 |
| 857 void SetGamepadData(const WebKit::WebGamepads& pads) { | 828 void SetGamepadData(const WebKit::WebGamepads& pads) { |
| 858 test_environment->webkit_platform_support()->setGamepadData(pads); | 829 test_environment->webkit_platform_support()->setGamepadData(pads); |
| 859 } | 830 } |
| 860 | 831 |
| 861 } // namespace webkit_support | 832 } // namespace webkit_support |
| OLD | NEW |