OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 void YieldCurrentThread() { | 84 void YieldCurrentThread() { |
85 base::PlatformThread::YieldCurrentThread(); | 85 base::PlatformThread::YieldCurrentThread(); |
86 } | 86 } |
87 | 87 |
88 String BlinkRootDir() { | 88 String BlinkRootDir() { |
89 return FilePathToWebString(BlinkRootFilePath()); | 89 return FilePathToWebString(BlinkRootFilePath()); |
90 } | 90 } |
91 | 91 |
| 92 String ExecutableDir() { |
| 93 base::FilePath path; |
| 94 base::PathService::Get(base::DIR_EXE, &path); |
| 95 return FilePathToWebString(base::MakeAbsoluteFilePath(path)); |
| 96 } |
| 97 |
92 String WebTestDataPath(const String& relative_path) { | 98 String WebTestDataPath(const String& relative_path) { |
93 return FilePathToWebString( | 99 return FilePathToWebString( |
94 BlinkRootFilePath() | 100 BlinkRootFilePath() |
95 .Append(FILE_PATH_LITERAL("Source/web/tests/data")) | 101 .Append(FILE_PATH_LITERAL("Source/web/tests/data")) |
96 .Append(WebStringToFilePath(relative_path))); | 102 .Append(WebStringToFilePath(relative_path))); |
97 } | 103 } |
98 | 104 |
99 String PlatformTestDataPath(const String& relative_path) { | 105 String PlatformTestDataPath(const String& relative_path) { |
100 return FilePathToWebString( | 106 return FilePathToWebString( |
101 BlinkRootFilePath() | 107 BlinkRootFilePath() |
102 .Append(FILE_PATH_LITERAL("Source/platform/testing/data")) | 108 .Append(FILE_PATH_LITERAL("Source/platform/testing/data")) |
103 .Append(WebStringToFilePath(relative_path))); | 109 .Append(WebStringToFilePath(relative_path))); |
104 } | 110 } |
105 | 111 |
106 PassRefPtr<SharedBuffer> ReadFromFile(const String& path) { | 112 PassRefPtr<SharedBuffer> ReadFromFile(const String& path) { |
107 base::FilePath file_path = blink::WebStringToFilePath(path); | 113 base::FilePath file_path = blink::WebStringToFilePath(path); |
108 std::string buffer; | 114 std::string buffer; |
109 base::ReadFileToString(file_path, &buffer); | 115 base::ReadFileToString(file_path, &buffer); |
110 return SharedBuffer::Create(buffer.data(), buffer.size()); | 116 return SharedBuffer::Create(buffer.data(), buffer.size()); |
111 } | 117 } |
112 | 118 |
113 } // namespace testing | 119 } // namespace testing |
114 } // namespace blink | 120 } // namespace blink |
OLD | NEW |