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 | |
98 String WebTestDataPath(const String& relative_path) { | 92 String WebTestDataPath(const String& relative_path) { |
99 return FilePathToWebString( | 93 return FilePathToWebString( |
100 BlinkRootFilePath() | 94 BlinkRootFilePath() |
101 .Append(FILE_PATH_LITERAL("Source/web/tests/data")) | 95 .Append(FILE_PATH_LITERAL("Source/web/tests/data")) |
102 .Append(WebStringToFilePath(relative_path))); | 96 .Append(WebStringToFilePath(relative_path))); |
103 } | 97 } |
104 | 98 |
105 String PlatformTestDataPath(const String& relative_path) { | 99 String PlatformTestDataPath(const String& relative_path) { |
106 return FilePathToWebString( | 100 return FilePathToWebString( |
107 BlinkRootFilePath() | 101 BlinkRootFilePath() |
108 .Append(FILE_PATH_LITERAL("Source/platform/testing/data")) | 102 .Append(FILE_PATH_LITERAL("Source/platform/testing/data")) |
109 .Append(WebStringToFilePath(relative_path))); | 103 .Append(WebStringToFilePath(relative_path))); |
110 } | 104 } |
111 | 105 |
112 PassRefPtr<SharedBuffer> ReadFromFile(const String& path) { | 106 PassRefPtr<SharedBuffer> ReadFromFile(const String& path) { |
113 base::FilePath file_path = blink::WebStringToFilePath(path); | 107 base::FilePath file_path = blink::WebStringToFilePath(path); |
114 std::string buffer; | 108 std::string buffer; |
115 base::ReadFileToString(file_path, &buffer); | 109 base::ReadFileToString(file_path, &buffer); |
116 return SharedBuffer::Create(buffer.data(), buffer.size()); | 110 return SharedBuffer::Create(buffer.data(), buffer.size()); |
117 } | 111 } |
118 | 112 |
119 } // namespace testing | 113 } // namespace testing |
120 } // namespace blink | 114 } // namespace blink |
OLD | NEW |