Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 | 32 |
| 33 #include "platform/TestingPlatformSupport.h" | 33 #include "platform/TestingPlatformSupport.h" |
| 34 | 34 |
| 35 #include <base/file_util.h> | |
|
jamesr
2014/06/06 18:56:04
<> style includes should only be used for standard
| |
| 36 #include <base/files/file_path.h> | |
| 37 #include <base/path_service.h> | |
| 38 #include <string> | |
| 39 | |
| 35 namespace WebCore { | 40 namespace WebCore { |
| 36 | 41 |
| 37 TestingDiscardableMemory::TestingDiscardableMemory(size_t size) : m_data(size), m_isLocked(true) | 42 TestingDiscardableMemory::TestingDiscardableMemory(size_t size) : m_data(size), m_isLocked(true) |
| 38 { | 43 { |
| 39 } | 44 } |
| 40 | 45 |
| 41 TestingDiscardableMemory::~TestingDiscardableMemory() | 46 TestingDiscardableMemory::~TestingDiscardableMemory() |
| 42 { | 47 { |
| 43 } | 48 } |
| 44 | 49 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 void TestingPlatformSupport::cryptographicallyRandomValues(unsigned char* buffer , size_t length) | 88 void TestingPlatformSupport::cryptographicallyRandomValues(unsigned char* buffer , size_t length) |
| 84 { | 89 { |
| 85 } | 90 } |
| 86 | 91 |
| 87 const unsigned char* TestingPlatformSupport::getTraceCategoryEnabledFlag(const c har* categoryName) | 92 const unsigned char* TestingPlatformSupport::getTraceCategoryEnabledFlag(const c har* categoryName) |
| 88 { | 93 { |
| 89 static const unsigned char tracingIsDisabled = 0; | 94 static const unsigned char tracingIsDisabled = 0; |
| 90 return &tracingIsDisabled; | 95 return &tracingIsDisabled; |
| 91 } | 96 } |
| 92 | 97 |
| 98 blink::WebUnitTestSupport* TestingPlatformSupport::unitTestSupport() | |
| 99 { | |
| 100 return this; | |
| 101 } | |
| 102 | |
| 103 blink::WebString TestingPlatformSupport::webKitRootDir() | |
| 104 { | |
| 105 base::FilePath path; | |
| 106 PathService::Get(base::DIR_SOURCE_ROOT, &path); | |
| 107 path = path.Append(FILE_PATH_LITERAL("third_party/WebKit")); | |
| 108 path = base::MakeAbsoluteFilePath(path); | |
| 109 ASSERT(!path.empty()); | |
| 110 std::string pathAscii = path.MaybeAsASCII(); | |
| 111 ASSERT(!pathAscii.empty()); | |
| 112 return blink::WebString::fromUTF8(pathAscii.c_str()); | |
| 113 } | |
| 114 | |
| 115 blink::WebData TestingPlatformSupport::readFromFile(const blink::WebString& path ) | |
| 116 { | |
| 117 base::FilePath filePath = base::FilePath::FromUTF8Unsafe(path.utf8()); | |
| 118 | |
| 119 std::string buffer; | |
| 120 base::ReadFileToString(filePath, &buffer); | |
| 121 | |
| 122 return blink::WebData(buffer.data(), buffer.size()); | |
| 123 } | |
| 124 | |
| 93 } // namespace WebCore | 125 } // namespace WebCore |
| OLD | NEW |