| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx | 116 // http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx |
| 117 UINT existing_flags = SetErrorMode(new_flags); | 117 UINT existing_flags = SetErrorMode(new_flags); |
| 118 SetErrorMode(existing_flags | new_flags); | 118 SetErrorMode(existing_flags | new_flags); |
| 119 } | 119 } |
| 120 #endif | 120 #endif |
| 121 | 121 |
| 122 #if defined(OS_ANDROID) | 122 #if defined(OS_ANDROID) |
| 123 // On Android we expect the log to appear in logcat. | 123 // On Android we expect the log to appear in logcat. |
| 124 base::InitAndroidTestLogging(); | 124 base::InitAndroidTestLogging(); |
| 125 #else | 125 #else |
| 126 FilePath log_filename; | 126 base::FilePath log_filename; |
| 127 PathService::Get(base::DIR_EXE, &log_filename); | 127 PathService::Get(base::DIR_EXE, &log_filename); |
| 128 log_filename = log_filename.AppendASCII("DumpRenderTree.log"); | 128 log_filename = log_filename.AppendASCII("DumpRenderTree.log"); |
| 129 logging::InitLogging( | 129 logging::InitLogging( |
| 130 log_filename.value().c_str(), | 130 log_filename.value().c_str(), |
| 131 // Only log to a file. This prevents debugging output from disrupting | 131 // Only log to a file. This prevents debugging output from disrupting |
| 132 // whether or not we pass. | 132 // whether or not we pass. |
| 133 logging::LOG_ONLY_TO_FILE, | 133 logging::LOG_ONLY_TO_FILE, |
| 134 // We might have multiple DumpRenderTree processes going at once. | 134 // We might have multiple DumpRenderTree processes going at once. |
| 135 logging::LOCK_LOG_FILE, | 135 logging::LOCK_LOG_FILE, |
| 136 logging::DELETE_OLD_LOG_FILE, | 136 logging::DELETE_OLD_LOG_FILE, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 WebKit::WebThemeEngine* theme_engine() const { | 208 WebKit::WebThemeEngine* theme_engine() const { |
| 209 return webkit_platform_support_->themeEngine(); | 209 return webkit_platform_support_->themeEngine(); |
| 210 } | 210 } |
| 211 #endif | 211 #endif |
| 212 | 212 |
| 213 #if defined(OS_ANDROID) | 213 #if defined(OS_ANDROID) |
| 214 // On Android under layout test mode, we mock the current directory | 214 // On Android under layout test mode, we mock the current directory |
| 215 // in SetCurrentDirectoryForFileURL() and GetAbsoluteWebStringFromUTF8Path(), | 215 // in SetCurrentDirectoryForFileURL() and GetAbsoluteWebStringFromUTF8Path(), |
| 216 // as the directory might not exist on the device because we are using | 216 // as the directory might not exist on the device because we are using |
| 217 // file-over-http bridge. | 217 // file-over-http bridge. |
| 218 void set_mock_current_directory(const FilePath& directory) { | 218 void set_mock_current_directory(const base::FilePath& directory) { |
| 219 mock_current_directory_ = directory; | 219 mock_current_directory_ = directory; |
| 220 } | 220 } |
| 221 | 221 |
| 222 FilePath mock_current_directory() const { | 222 base::FilePath mock_current_directory() const { |
| 223 return mock_current_directory_; | 223 return mock_current_directory_; |
| 224 } | 224 } |
| 225 | 225 |
| 226 webkit_media::WebMediaPlayerManagerAndroid* media_player_manager() { | 226 webkit_media::WebMediaPlayerManagerAndroid* media_player_manager() { |
| 227 return media_player_manager_.get(); | 227 return media_player_manager_.get(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 webkit_media::MediaPlayerBridgeManagerImpl* media_bridge_manager() { | 230 webkit_media::MediaPlayerBridgeManagerImpl* media_bridge_manager() { |
| 231 return media_bridge_manager_.get(); | 231 return media_bridge_manager_.get(); |
| 232 } | 232 } |
| 233 #endif | 233 #endif |
| 234 | 234 |
| 235 private: | 235 private: |
| 236 // Data member at_exit_manager_ will take the ownership of the input | 236 // Data member at_exit_manager_ will take the ownership of the input |
| 237 // AtExitManager and manage its lifecycle. | 237 // AtExitManager and manage its lifecycle. |
| 238 scoped_ptr<base::AtExitManager> at_exit_manager_; | 238 scoped_ptr<base::AtExitManager> at_exit_manager_; |
| 239 scoped_ptr<MessageLoopType> main_message_loop_; | 239 scoped_ptr<MessageLoopType> main_message_loop_; |
| 240 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; | 240 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; |
| 241 | 241 |
| 242 #if defined(OS_ANDROID) | 242 #if defined(OS_ANDROID) |
| 243 FilePath mock_current_directory_; | 243 base::FilePath mock_current_directory_; |
| 244 scoped_ptr<webkit_media::WebMediaPlayerManagerAndroid> media_player_manager_; | 244 scoped_ptr<webkit_media::WebMediaPlayerManagerAndroid> media_player_manager_; |
| 245 scoped_ptr<webkit_media::MediaPlayerBridgeManagerImpl> media_bridge_manager_; | 245 scoped_ptr<webkit_media::MediaPlayerBridgeManagerImpl> media_bridge_manager_; |
| 246 #endif | 246 #endif |
| 247 }; | 247 }; |
| 248 | 248 |
| 249 class WebPluginImplWithPageDelegate | 249 class WebPluginImplWithPageDelegate |
| 250 : public webkit_support::TestWebPluginPageDelegate, | 250 : public webkit_support::TestWebPluginPageDelegate, |
| 251 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>, | 251 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>, |
| 252 public webkit::npapi::WebPluginImpl { | 252 public webkit::npapi::WebPluginImpl { |
| 253 public: | 253 public: |
| 254 WebPluginImplWithPageDelegate(WebFrame* frame, | 254 WebPluginImplWithPageDelegate(WebFrame* frame, |
| 255 const WebPluginParams& params, | 255 const WebPluginParams& params, |
| 256 const FilePath& path) | 256 const base::FilePath& path) |
| 257 : webkit_support::TestWebPluginPageDelegate(), | 257 : webkit_support::TestWebPluginPageDelegate(), |
| 258 webkit::npapi::WebPluginImpl(frame, params, path, AsWeakPtr()) {} | 258 webkit::npapi::WebPluginImpl(frame, params, path, AsWeakPtr()) {} |
| 259 virtual ~WebPluginImplWithPageDelegate() {} | 259 virtual ~WebPluginImplWithPageDelegate() {} |
| 260 private: | 260 private: |
| 261 DISALLOW_COPY_AND_ASSIGN(WebPluginImplWithPageDelegate); | 261 DISALLOW_COPY_AND_ASSIGN(WebPluginImplWithPageDelegate); |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 FilePath GetWebKitRootDirFilePath() { | 264 base::FilePath GetWebKitRootDirFilePath() { |
| 265 FilePath basePath; | 265 base::FilePath basePath; |
| 266 PathService::Get(base::DIR_SOURCE_ROOT, &basePath); | 266 PathService::Get(base::DIR_SOURCE_ROOT, &basePath); |
| 267 if (file_util::PathExists( | 267 if (file_util::PathExists( |
| 268 basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { | 268 basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { |
| 269 // We're in a WebKit-in-chrome checkout. | 269 // We're in a WebKit-in-chrome checkout. |
| 270 basePath = basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")); | 270 basePath = basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")); |
| 271 } else if (file_util::PathExists( | 271 } else if (file_util::PathExists( |
| 272 basePath.Append(FILE_PATH_LITERAL("chromium")))) { | 272 basePath.Append(FILE_PATH_LITERAL("chromium")))) { |
| 273 // We're in a WebKit-only checkout on Windows. | 273 // We're in a WebKit-only checkout on Windows. |
| 274 basePath = basePath.Append(FILE_PATH_LITERAL("../..")); | 274 basePath = basePath.Append(FILE_PATH_LITERAL("../..")); |
| 275 } else if (file_util::PathExists( | 275 } else if (file_util::PathExists( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 icu_util::Initialize(); | 346 icu_util::Initialize(); |
| 347 } | 347 } |
| 348 webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct( | 348 webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct( |
| 349 "DumpRenderTree/0.0.0.0"), false); | 349 "DumpRenderTree/0.0.0.0"), false); |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace | 352 } // namespace |
| 353 | 353 |
| 354 namespace webkit_support { | 354 namespace webkit_support { |
| 355 | 355 |
| 356 FilePath GetChromiumRootDirFilePath() { | 356 base::FilePath GetChromiumRootDirFilePath() { |
| 357 FilePath basePath; | 357 base::FilePath basePath; |
| 358 PathService::Get(base::DIR_SOURCE_ROOT, &basePath); | 358 PathService::Get(base::DIR_SOURCE_ROOT, &basePath); |
| 359 if (file_util::PathExists( | 359 if (file_util::PathExists( |
| 360 basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { | 360 basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { |
| 361 // We're in a WebKit-in-chrome checkout. | 361 // We're in a WebKit-in-chrome checkout. |
| 362 return basePath; | 362 return basePath; |
| 363 } | 363 } |
| 364 return GetWebKitRootDirFilePath() | 364 return GetWebKitRootDirFilePath() |
| 365 .Append(FILE_PATH_LITERAL("Source/WebKit/chromium")); | 365 .Append(FILE_PATH_LITERAL("Source/WebKit/chromium")); |
| 366 } | 366 } |
| 367 | 367 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 WebKit::WebApplicationCacheHost* CreateApplicationCacheHost( | 473 WebKit::WebApplicationCacheHost* CreateApplicationCacheHost( |
| 474 WebFrame*, WebKit::WebApplicationCacheHostClient* client) { | 474 WebFrame*, WebKit::WebApplicationCacheHostClient* client) { |
| 475 return SimpleAppCacheSystem::CreateApplicationCacheHost(client); | 475 return SimpleAppCacheSystem::CreateApplicationCacheHost(client); |
| 476 } | 476 } |
| 477 | 477 |
| 478 WebKit::WebStorageNamespace* CreateSessionStorageNamespace(unsigned quota) { | 478 WebKit::WebStorageNamespace* CreateSessionStorageNamespace(unsigned quota) { |
| 479 return SimpleDomStorageSystem::instance().CreateSessionStorageNamespace(); | 479 return SimpleDomStorageSystem::instance().CreateSessionStorageNamespace(); |
| 480 } | 480 } |
| 481 | 481 |
| 482 WebKit::WebString GetWebKitRootDir() { | 482 WebKit::WebString GetWebKitRootDir() { |
| 483 FilePath path = GetWebKitRootDirFilePath(); | 483 base::FilePath path = GetWebKitRootDirFilePath(); |
| 484 std::string path_ascii = path.MaybeAsASCII(); | 484 std::string path_ascii = path.MaybeAsASCII(); |
| 485 CHECK(!path_ascii.empty()); | 485 CHECK(!path_ascii.empty()); |
| 486 return WebKit::WebString::fromUTF8(path_ascii.c_str()); | 486 return WebKit::WebString::fromUTF8(path_ascii.c_str()); |
| 487 } | 487 } |
| 488 | 488 |
| 489 void SetUpGLBindings(GLBindingPreferences bindingPref) { | 489 void SetUpGLBindings(GLBindingPreferences bindingPref) { |
| 490 switch (bindingPref) { | 490 switch (bindingPref) { |
| 491 case GL_BINDING_DEFAULT: | 491 case GL_BINDING_DEFAULT: |
| 492 gfx::GLSurface::InitializeOneOff(); | 492 gfx::GLSurface::InitializeOneOff(); |
| 493 break; | 493 break; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 MessageLoop::current()->PostDelayedTask( | 612 MessageLoop::current()->PostDelayedTask( |
| 613 FROM_HERE, | 613 FROM_HERE, |
| 614 base::Bind(&TaskAdaptor::Run, base::Owned(task)), | 614 base::Bind(&TaskAdaptor::Run, base::Owned(task)), |
| 615 base::TimeDelta::FromMilliseconds(delay_ms)); | 615 base::TimeDelta::FromMilliseconds(delay_ms)); |
| 616 } | 616 } |
| 617 | 617 |
| 618 // Wrappers for FilePath and file_util | 618 // Wrappers for FilePath and file_util |
| 619 | 619 |
| 620 WebString GetAbsoluteWebStringFromUTF8Path(const std::string& utf8_path) { | 620 WebString GetAbsoluteWebStringFromUTF8Path(const std::string& utf8_path) { |
| 621 #if defined(OS_WIN) | 621 #if defined(OS_WIN) |
| 622 FilePath path(UTF8ToWide(utf8_path)); | 622 base::FilePath path(UTF8ToWide(utf8_path)); |
| 623 file_util::AbsolutePath(&path); | 623 file_util::AbsolutePath(&path); |
| 624 return WebString(path.value()); | 624 return WebString(path.value()); |
| 625 #else | 625 #else |
| 626 FilePath path(base::SysWideToNativeMB(base::SysUTF8ToWide(utf8_path))); | 626 base::FilePath path(base::SysWideToNativeMB(base::SysUTF8ToWide(utf8_path))); |
| 627 #if defined(OS_ANDROID) | 627 #if defined(OS_ANDROID) |
| 628 if (WebKit::layoutTestMode()) { | 628 if (WebKit::layoutTestMode()) { |
| 629 // See comment of TestEnvironment::set_mock_current_directory(). | 629 // See comment of TestEnvironment::set_mock_current_directory(). |
| 630 if (!path.IsAbsolute()) { | 630 if (!path.IsAbsolute()) { |
| 631 // Not using FilePath::Append() because it can't handle '..' in path. | 631 // Not using FilePath::Append() because it can't handle '..' in path. |
| 632 DCHECK(test_environment); | 632 DCHECK(test_environment); |
| 633 GURL base_url = net::FilePathToFileURL( | 633 GURL base_url = net::FilePathToFileURL( |
| 634 test_environment->mock_current_directory() | 634 test_environment->mock_current_directory() |
| 635 .Append(FILE_PATH_LITERAL("foo"))); | 635 .Append(FILE_PATH_LITERAL("foo"))); |
| 636 net::FileURLToFilePath(base_url.Resolve(path.value()), &path); | 636 net::FileURLToFilePath(base_url.Resolve(path.value()), &path); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 648 WebURL CreateURLForPathOrURL(const std::string& path_or_url_in_nativemb) { | 648 WebURL CreateURLForPathOrURL(const std::string& path_or_url_in_nativemb) { |
| 649 // NativeMB to UTF-8 | 649 // NativeMB to UTF-8 |
| 650 std::wstring wide_path_or_url | 650 std::wstring wide_path_or_url |
| 651 = base::SysNativeMBToWide(path_or_url_in_nativemb); | 651 = base::SysNativeMBToWide(path_or_url_in_nativemb); |
| 652 std::string path_or_url_in_utf8 = WideToUTF8(wide_path_or_url); | 652 std::string path_or_url_in_utf8 = WideToUTF8(wide_path_or_url); |
| 653 | 653 |
| 654 GURL url(path_or_url_in_utf8); | 654 GURL url(path_or_url_in_utf8); |
| 655 if (url.is_valid() && url.has_scheme()) | 655 if (url.is_valid() && url.has_scheme()) |
| 656 return WebURL(url); | 656 return WebURL(url); |
| 657 #if defined(OS_WIN) | 657 #if defined(OS_WIN) |
| 658 FilePath path(wide_path_or_url); | 658 base::FilePath path(wide_path_or_url); |
| 659 #else | 659 #else |
| 660 FilePath path(path_or_url_in_nativemb); | 660 base::FilePath path(path_or_url_in_nativemb); |
| 661 #endif | 661 #endif |
| 662 file_util::AbsolutePath(&path); | 662 file_util::AbsolutePath(&path); |
| 663 return net::FilePathToFileURL(path); | 663 return net::FilePathToFileURL(path); |
| 664 } | 664 } |
| 665 | 665 |
| 666 WebURL RewriteLayoutTestsURL(const std::string& utf8_url) { | 666 WebURL RewriteLayoutTestsURL(const std::string& utf8_url) { |
| 667 const char kPrefix[] = "file:///tmp/LayoutTests/"; | 667 const char kPrefix[] = "file:///tmp/LayoutTests/"; |
| 668 const int kPrefixLen = arraysize(kPrefix) - 1; | 668 const int kPrefixLen = arraysize(kPrefix) - 1; |
| 669 | 669 |
| 670 if (utf8_url.compare(0, kPrefixLen, kPrefix, kPrefixLen)) | 670 if (utf8_url.compare(0, kPrefixLen, kPrefix, kPrefixLen)) |
| 671 return WebURL(GURL(utf8_url)); | 671 return WebURL(GURL(utf8_url)); |
| 672 | 672 |
| 673 FilePath replacePath = | 673 base::FilePath replacePath = |
| 674 GetWebKitRootDirFilePath().Append(FILE_PATH_LITERAL("LayoutTests/")); | 674 GetWebKitRootDirFilePath().Append(FILE_PATH_LITERAL("LayoutTests/")); |
| 675 | 675 |
| 676 // On Android, the file is actually accessed through file-over-http. Disable | 676 // On Android, the file is actually accessed through file-over-http. Disable |
| 677 // the following CHECK because the file is unlikely to exist on the device. | 677 // the following CHECK because the file is unlikely to exist on the device. |
| 678 #if !defined(OS_ANDROID) | 678 #if !defined(OS_ANDROID) |
| 679 CHECK(file_util::PathExists(replacePath)) << replacePath.value() << | 679 CHECK(file_util::PathExists(replacePath)) << replacePath.value() << |
| 680 " (re-written from " << utf8_url << ") does not exit"; | 680 " (re-written from " << utf8_url << ") does not exit"; |
| 681 #endif | 681 #endif |
| 682 | 682 |
| 683 #if defined(OS_WIN) | 683 #if defined(OS_WIN) |
| 684 std::string utf8_path = WideToUTF8(replacePath.value()); | 684 std::string utf8_path = WideToUTF8(replacePath.value()); |
| 685 #else | 685 #else |
| 686 std::string utf8_path | 686 std::string utf8_path |
| 687 = WideToUTF8(base::SysNativeMBToWide(replacePath.value())); | 687 = WideToUTF8(base::SysNativeMBToWide(replacePath.value())); |
| 688 #endif | 688 #endif |
| 689 std::string newUrl = std::string("file://") + utf8_path | 689 std::string newUrl = std::string("file://") + utf8_path |
| 690 + utf8_url.substr(kPrefixLen); | 690 + utf8_url.substr(kPrefixLen); |
| 691 return WebURL(GURL(newUrl)); | 691 return WebURL(GURL(newUrl)); |
| 692 } | 692 } |
| 693 | 693 |
| 694 bool SetCurrentDirectoryForFileURL(const WebKit::WebURL& fileUrl) { | 694 bool SetCurrentDirectoryForFileURL(const WebKit::WebURL& fileUrl) { |
| 695 FilePath local_path; | 695 base::FilePath local_path; |
| 696 if (!net::FileURLToFilePath(fileUrl, &local_path)) | 696 if (!net::FileURLToFilePath(fileUrl, &local_path)) |
| 697 return false; | 697 return false; |
| 698 #if defined(OS_ANDROID) | 698 #if defined(OS_ANDROID) |
| 699 if (WebKit::layoutTestMode()) { | 699 if (WebKit::layoutTestMode()) { |
| 700 // See comment of TestEnvironment::set_mock_current_directory(). | 700 // See comment of TestEnvironment::set_mock_current_directory(). |
| 701 DCHECK(test_environment); | 701 DCHECK(test_environment); |
| 702 FilePath directory = local_path.DirName(); | 702 base::FilePath directory = local_path.DirName(); |
| 703 test_environment->set_mock_current_directory(directory); | 703 test_environment->set_mock_current_directory(directory); |
| 704 // Still try to actually change the directory, but ignore any error. | 704 // Still try to actually change the directory, but ignore any error. |
| 705 // For a few tests that need to access resources directly as files | 705 // For a few tests that need to access resources directly as files |
| 706 // (e.g. blob tests) we still push the resources and need to chdir there. | 706 // (e.g. blob tests) we still push the resources and need to chdir there. |
| 707 file_util::SetCurrentDirectory(directory); | 707 file_util::SetCurrentDirectory(directory); |
| 708 return true; | 708 return true; |
| 709 } | 709 } |
| 710 #endif | 710 #endif |
| 711 return file_util::SetCurrentDirectory(local_path.DirName()); | 711 return file_util::SetCurrentDirectory(local_path.DirName()); |
| 712 } | 712 } |
| 713 | 713 |
| 714 WebURL LocalFileToDataURL(const WebURL& fileUrl) { | 714 WebURL LocalFileToDataURL(const WebURL& fileUrl) { |
| 715 FilePath local_path; | 715 base::FilePath local_path; |
| 716 if (!net::FileURLToFilePath(fileUrl, &local_path)) | 716 if (!net::FileURLToFilePath(fileUrl, &local_path)) |
| 717 return WebURL(); | 717 return WebURL(); |
| 718 | 718 |
| 719 std::string contents; | 719 std::string contents; |
| 720 if (!file_util::ReadFileToString(local_path, &contents)) | 720 if (!file_util::ReadFileToString(local_path, &contents)) |
| 721 return WebURL(); | 721 return WebURL(); |
| 722 | 722 |
| 723 std::string contents_base64; | 723 std::string contents_base64; |
| 724 if (!base::Base64Encode(contents, &contents_base64)) | 724 if (!base::Base64Encode(contents, &contents_base64)) |
| 725 return WebURL(); | 725 return WebURL(); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 | 827 |
| 828 WebKit::WebThemeEngine* GetThemeEngine() { | 828 WebKit::WebThemeEngine* GetThemeEngine() { |
| 829 DCHECK(test_environment); | 829 DCHECK(test_environment); |
| 830 return test_environment->theme_engine(); | 830 return test_environment->theme_engine(); |
| 831 } | 831 } |
| 832 | 832 |
| 833 #endif | 833 #endif |
| 834 | 834 |
| 835 // DevTools frontend path for inspector LayoutTests. | 835 // DevTools frontend path for inspector LayoutTests. |
| 836 WebURL GetDevToolsPathAsURL() { | 836 WebURL GetDevToolsPathAsURL() { |
| 837 FilePath dirExe; | 837 base::FilePath dirExe; |
| 838 if (!PathService::Get(base::DIR_EXE, &dirExe)) { | 838 if (!PathService::Get(base::DIR_EXE, &dirExe)) { |
| 839 DCHECK(false); | 839 DCHECK(false); |
| 840 return WebURL(); | 840 return WebURL(); |
| 841 } | 841 } |
| 842 #if defined(OS_MACOSX) | 842 #if defined(OS_MACOSX) |
| 843 dirExe = dirExe.AppendASCII("../../.."); | 843 dirExe = dirExe.AppendASCII("../../.."); |
| 844 #endif | 844 #endif |
| 845 FilePath devToolsPath = dirExe.AppendASCII( | 845 base::FilePath devToolsPath = dirExe.AppendASCII( |
| 846 "resources/inspector/devtools.html"); | 846 "resources/inspector/devtools.html"); |
| 847 return net::FilePathToFileURL(devToolsPath); | 847 return net::FilePathToFileURL(devToolsPath); |
| 848 } | 848 } |
| 849 | 849 |
| 850 // FileSystem | 850 // FileSystem |
| 851 void OpenFileSystem(WebFrame* frame, WebFileSystem::Type type, | 851 void OpenFileSystem(WebFrame* frame, WebFileSystem::Type type, |
| 852 long long size, bool create, WebFileSystemCallbacks* callbacks) { | 852 long long size, bool create, WebFileSystemCallbacks* callbacks) { |
| 853 SimpleFileSystem* fileSystem = static_cast<SimpleFileSystem*>( | 853 SimpleFileSystem* fileSystem = static_cast<SimpleFileSystem*>( |
| 854 test_environment->webkit_platform_support()->fileSystem()); | 854 test_environment->webkit_platform_support()->fileSystem()); |
| 855 fileSystem->OpenFileSystem(frame, type, size, create, callbacks); | 855 fileSystem->OpenFileSystem(frame, type, size, create, callbacks); |
| 856 } | 856 } |
| 857 | 857 |
| 858 void DeleteFileSystem(WebFrame* frame, WebFileSystem::Type type, | 858 void DeleteFileSystem(WebFrame* frame, WebFileSystem::Type type, |
| 859 WebFileSystemCallbacks* callbacks) { | 859 WebFileSystemCallbacks* callbacks) { |
| 860 SimpleFileSystem* fileSystem = static_cast<SimpleFileSystem*>( | 860 SimpleFileSystem* fileSystem = static_cast<SimpleFileSystem*>( |
| 861 test_environment->webkit_platform_support()->fileSystem()); | 861 test_environment->webkit_platform_support()->fileSystem()); |
| 862 fileSystem->DeleteFileSystem(frame, type, callbacks); | 862 fileSystem->DeleteFileSystem(frame, type, callbacks); |
| 863 } | 863 } |
| 864 | 864 |
| 865 WebKit::WebString RegisterIsolatedFileSystem( | 865 WebKit::WebString RegisterIsolatedFileSystem( |
| 866 const WebKit::WebVector<WebKit::WebString>& filenames) { | 866 const WebKit::WebVector<WebKit::WebString>& filenames) { |
| 867 fileapi::IsolatedContext::FileInfoSet files; | 867 fileapi::IsolatedContext::FileInfoSet files; |
| 868 for (size_t i = 0; i < filenames.size(); ++i) { | 868 for (size_t i = 0; i < filenames.size(); ++i) { |
| 869 FilePath path = webkit_base::WebStringToFilePath(filenames[i]); | 869 base::FilePath path = webkit_base::WebStringToFilePath(filenames[i]); |
| 870 files.AddPath(path, NULL); | 870 files.AddPath(path, NULL); |
| 871 } | 871 } |
| 872 std::string filesystemId = | 872 std::string filesystemId = |
| 873 fileapi::IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files); | 873 fileapi::IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files); |
| 874 return UTF8ToUTF16(filesystemId); | 874 return UTF8ToUTF16(filesystemId); |
| 875 } | 875 } |
| 876 | 876 |
| 877 // Keyboard code | 877 // Keyboard code |
| 878 #if defined(TOOLKIT_GTK) | 878 #if defined(TOOLKIT_GTK) |
| 879 int NativeKeyCodeForWindowsKeyCode(int keycode, bool shift) { | 879 int NativeKeyCodeForWindowsKeyCode(int keycode, bool shift) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 890 // Logging | 890 // Logging |
| 891 void EnableWebCoreLogChannels(const std::string& channels) { | 891 void EnableWebCoreLogChannels(const std::string& channels) { |
| 892 webkit_glue::EnableWebCoreLogChannels(channels); | 892 webkit_glue::EnableWebCoreLogChannels(channels); |
| 893 } | 893 } |
| 894 | 894 |
| 895 void SetGamepadData(const WebKit::WebGamepads& pads) { | 895 void SetGamepadData(const WebKit::WebGamepads& pads) { |
| 896 test_environment->webkit_platform_support()->setGamepadData(pads); | 896 test_environment->webkit_platform_support()->setGamepadData(pads); |
| 897 } | 897 } |
| 898 | 898 |
| 899 } // namespace webkit_support | 899 } // namespace webkit_support |
| OLD | NEW |