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/test_webkit_platform_support.h" | 5 #include "webkit/support/test_webkit_platform_support.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/metrics/stats_counters.h" | 9 #include "base/metrics/stats_counters.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 return 0; | 604 return 0; |
| 605 } | 605 } |
| 606 | 606 |
| 607 WebKit::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve( | 607 WebKit::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve( |
| 608 int device_source, | 608 int device_source, |
| 609 const WebKit::WebFloatPoint& velocity, | 609 const WebKit::WebFloatPoint& velocity, |
| 610 const WebKit::WebSize& cumulative_scroll) { | 610 const WebKit::WebSize& cumulative_scroll) { |
| 611 // Caller will retain and release. | 611 // Caller will retain and release. |
| 612 return new WebGestureCurveMock(velocity, cumulative_scroll); | 612 return new WebGestureCurveMock(velocity, cumulative_scroll); |
| 613 } | 613 } |
| 614 | |
| 615 void TestWebKitPlatformSupport::registerMockedURL( | |
| 616 const WebKit::WebURL& url, | |
| 617 const WebKit::WebURLResponse& response, | |
| 618 const WebKit::WebString& file_path) { | |
| 619 url_loader_factory_.RegisterURL(url, response, file_path); | |
| 620 } | |
| 621 | |
| 622 void TestWebKitPlatformSupport::registerMockedErrorURL( | |
| 623 const WebKit::WebURL& url, | |
| 624 const WebKit::WebURLResponse& response, | |
| 625 const WebKit::WebURLError& error) { | |
| 626 url_loader_factory_.RegisterErrorURL(url, response, error); | |
| 627 } | |
| 628 | |
| 629 void TestWebKitPlatformSupport::unregisterMockedURL(const WebKit::WebURL& url) { | |
| 630 url_loader_factory_.UnregisterURL(url); | |
| 631 } | |
| 632 | |
| 633 void TestWebKitPlatformSupport::unregisterAllMockedURLs() { | |
| 634 url_loader_factory_.UnregisterAllURLs(); | |
| 635 } | |
| 636 | |
| 637 void TestWebKitPlatformSupport::serveAsynchronousMockedRequests() { | |
| 638 url_loader_factory_.ServeAsynchronousRequests(); | |
| 639 } | |
| 640 | |
| 641 WebKit::WebString TestWebKitPlatformSupport::getWebKitRootDir() { | |
|
darin (slow to review)
2013/02/10 05:07:03
this looks like a copy of GetWebKitRootDirFilePath
| |
| 642 base::FilePath basePath; | |
| 643 PathService::Get(base::DIR_SOURCE_ROOT, &basePath); | |
| 644 if (file_util::PathExists( | |
| 645 basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { | |
| 646 // We're in a WebKit-in-chrome checkout. | |
| 647 basePath = basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")); | |
| 648 } else if (file_util::PathExists( | |
| 649 basePath.Append(FILE_PATH_LITERAL("chromium")))) { | |
| 650 // We're in a WebKit-only checkout on Windows. | |
| 651 basePath = basePath.Append(FILE_PATH_LITERAL("../..")); | |
| 652 } else if (file_util::PathExists( | |
| 653 basePath.Append(FILE_PATH_LITERAL("webkit/support")))) { | |
| 654 // We're in a WebKit-only/xcodebuild checkout on Mac | |
| 655 basePath = basePath.Append(FILE_PATH_LITERAL("../../..")); | |
| 656 } | |
| 657 CHECK(file_util::AbsolutePath(&basePath)); | |
| 658 std::string path_ascii = basePath.MaybeAsASCII(); | |
| 659 CHECK(!path_ascii.empty()); | |
| 660 return WebKit::WebString::fromUTF8(path_ascii.c_str()); | |
| 661 } | |
| 662 | |
| OLD | NEW |