| 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/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 : webkit_support::TestWebPluginPageDelegate(), | 194 : webkit_support::TestWebPluginPageDelegate(), |
| 195 webkit::npapi::WebPluginImpl(frame, params, path, AsWeakPtr()) {} | 195 webkit::npapi::WebPluginImpl(frame, params, path, AsWeakPtr()) {} |
| 196 virtual ~WebPluginImplWithPageDelegate() {} | 196 virtual ~WebPluginImplWithPageDelegate() {} |
| 197 private: | 197 private: |
| 198 DISALLOW_COPY_AND_ASSIGN(WebPluginImplWithPageDelegate); | 198 DISALLOW_COPY_AND_ASSIGN(WebPluginImplWithPageDelegate); |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 base::FilePath GetWebKitRootDirFilePath() { | 201 base::FilePath GetWebKitRootDirFilePath() { |
| 202 base::FilePath basePath; | 202 base::FilePath basePath; |
| 203 PathService::Get(base::DIR_SOURCE_ROOT, &basePath); | 203 PathService::Get(base::DIR_SOURCE_ROOT, &basePath); |
| 204 if (file_util::PathExists( | 204 if (base::PathExists( |
| 205 basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { | 205 basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { |
| 206 // We're in a WebKit-in-chrome checkout. | 206 // We're in a WebKit-in-chrome checkout. |
| 207 basePath = basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")); | 207 basePath = basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")); |
| 208 } else if (file_util::PathExists( | 208 } else if (base::PathExists( |
| 209 basePath.Append(FILE_PATH_LITERAL("chromium")))) { | 209 basePath.Append(FILE_PATH_LITERAL("chromium")))) { |
| 210 // We're in a WebKit-only checkout on Windows. | 210 // We're in a WebKit-only checkout on Windows. |
| 211 basePath = basePath.Append(FILE_PATH_LITERAL("../..")); | 211 basePath = basePath.Append(FILE_PATH_LITERAL("../..")); |
| 212 } else if (file_util::PathExists( | 212 } else if (base::PathExists( |
| 213 basePath.Append(FILE_PATH_LITERAL("webkit/support")))) { | 213 basePath.Append(FILE_PATH_LITERAL("webkit/support")))) { |
| 214 // We're in a WebKit-only/xcodebuild checkout on Mac | 214 // We're in a WebKit-only/xcodebuild checkout on Mac |
| 215 basePath = basePath.Append(FILE_PATH_LITERAL("../../..")); | 215 basePath = basePath.Append(FILE_PATH_LITERAL("../../..")); |
| 216 } | 216 } |
| 217 basePath = base::MakeAbsoluteFilePath(basePath); | 217 basePath = base::MakeAbsoluteFilePath(basePath); |
| 218 CHECK(!basePath.empty()); | 218 CHECK(!basePath.empty()); |
| 219 // We're in a WebKit-only, make-build, so the DIR_SOURCE_ROOT is already the | 219 // We're in a WebKit-only, make-build, so the DIR_SOURCE_ROOT is already the |
| 220 // WebKit root. That, or we have no idea where we are. | 220 // WebKit root. That, or we have no idea where we are. |
| 221 return basePath; | 221 return basePath; |
| 222 } | 222 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 239 | 239 |
| 240 TestEnvironment* test_environment; | 240 TestEnvironment* test_environment; |
| 241 | 241 |
| 242 } // namespace | 242 } // namespace |
| 243 | 243 |
| 244 namespace webkit_support { | 244 namespace webkit_support { |
| 245 | 245 |
| 246 base::FilePath GetChromiumRootDirFilePath() { | 246 base::FilePath GetChromiumRootDirFilePath() { |
| 247 base::FilePath basePath; | 247 base::FilePath basePath; |
| 248 PathService::Get(base::DIR_SOURCE_ROOT, &basePath); | 248 PathService::Get(base::DIR_SOURCE_ROOT, &basePath); |
| 249 if (file_util::PathExists( | 249 if (base::PathExists( |
| 250 basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { | 250 basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { |
| 251 // We're in a WebKit-in-chrome checkout. | 251 // We're in a WebKit-in-chrome checkout. |
| 252 return basePath; | 252 return basePath; |
| 253 } | 253 } |
| 254 return GetWebKitRootDirFilePath() | 254 return GetWebKitRootDirFilePath() |
| 255 .Append(FILE_PATH_LITERAL("Source/WebKit/chromium")); | 255 .Append(FILE_PATH_LITERAL("Source/WebKit/chromium")); |
| 256 } | 256 } |
| 257 | 257 |
| 258 void SetUpTestEnvironmentForUnitTests() { | 258 void SetUpTestEnvironmentForUnitTests() { |
| 259 base::debug::EnableInProcessStackDumping(); | 259 base::debug::EnableInProcessStackDumping(); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 505 |
| 506 if (utf8_url.compare(0, kPrefixLen, kPrefix, kPrefixLen)) | 506 if (utf8_url.compare(0, kPrefixLen, kPrefix, kPrefixLen)) |
| 507 return WebURL(GURL(utf8_url)); | 507 return WebURL(GURL(utf8_url)); |
| 508 | 508 |
| 509 base::FilePath replacePath = | 509 base::FilePath replacePath = |
| 510 GetWebKitRootDirFilePath().Append(FILE_PATH_LITERAL("LayoutTests/")); | 510 GetWebKitRootDirFilePath().Append(FILE_PATH_LITERAL("LayoutTests/")); |
| 511 | 511 |
| 512 // On Android, the file is actually accessed through file-over-http. Disable | 512 // On Android, the file is actually accessed through file-over-http. Disable |
| 513 // the following CHECK because the file is unlikely to exist on the device. | 513 // the following CHECK because the file is unlikely to exist on the device. |
| 514 #if !defined(OS_ANDROID) | 514 #if !defined(OS_ANDROID) |
| 515 CHECK(file_util::PathExists(replacePath)) << replacePath.value() << | 515 CHECK(base::PathExists(replacePath)) << replacePath.value() << |
| 516 " (re-written from " << utf8_url << ") does not exit"; | 516 " (re-written from " << utf8_url << ") does not exit"; |
| 517 #endif | 517 #endif |
| 518 | 518 |
| 519 #if defined(OS_WIN) | 519 #if defined(OS_WIN) |
| 520 std::string utf8_path = WideToUTF8(replacePath.value()); | 520 std::string utf8_path = WideToUTF8(replacePath.value()); |
| 521 #else | 521 #else |
| 522 std::string utf8_path | 522 std::string utf8_path |
| 523 = WideToUTF8(base::SysNativeMBToWide(replacePath.value())); | 523 = WideToUTF8(base::SysNativeMBToWide(replacePath.value())); |
| 524 #endif | 524 #endif |
| 525 std::string newUrl = std::string("file://") + utf8_path | 525 std::string newUrl = std::string("file://") + utf8_path |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 // Logging | 689 // Logging |
| 690 void EnableWebCoreLogChannels(const std::string& channels) { | 690 void EnableWebCoreLogChannels(const std::string& channels) { |
| 691 webkit_glue::EnableWebCoreLogChannels(channels); | 691 webkit_glue::EnableWebCoreLogChannels(channels); |
| 692 } | 692 } |
| 693 | 693 |
| 694 void SetGamepadData(const WebKit::WebGamepads& pads) { | 694 void SetGamepadData(const WebKit::WebGamepads& pads) { |
| 695 test_environment->webkit_platform_support()->setGamepadData(pads); | 695 test_environment->webkit_platform_support()->setGamepadData(pads); |
| 696 } | 696 } |
| 697 | 697 |
| 698 } // namespace webkit_support | 698 } // namespace webkit_support |
| OLD | NEW |