OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if !defined(OS_WIN) | 7 #if !defined(OS_WIN) |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir_); | 229 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir_); |
230 test_dir_ = test_dir_.AppendASCII("skia"). | 230 test_dir_ = test_dir_.AppendASCII("skia"). |
231 AppendASCII("ext"). | 231 AppendASCII("ext"). |
232 AppendASCII("data"). | 232 AppendASCII("data"). |
233 AppendASCII(test_info.test_case_name()). | 233 AppendASCII(test_info.test_case_name()). |
234 AppendASCII(test_info.name()); | 234 AppendASCII(test_info.name()); |
235 | 235 |
236 // Hack for a quick lowercase. We assume all the tests names are ASCII. | 236 // Hack for a quick lowercase. We assume all the tests names are ASCII. |
237 std::string tmp(WideToASCII(test_dir_.ToWStringHack())); | 237 std::string tmp(WideToASCII(test_dir_.ToWStringHack())); |
238 for (size_t i = 0; i < tmp.size(); ++i) | 238 for (size_t i = 0; i < tmp.size(); ++i) |
239 tmp[i] = ToLowerASCII(tmp[i]); | 239 tmp[i] = base::ToLowerASCII(tmp[i]); |
240 test_dir_ = FilePath::FromWStringHack(ASCIIToWide(tmp)); | 240 test_dir_ = FilePath::FromWStringHack(ASCIIToWide(tmp)); |
241 | 241 |
242 if (action_ == GENERATE) { | 242 if (action_ == GENERATE) { |
243 // Make sure the directory exist. | 243 // Make sure the directory exist. |
244 file_util::CreateDirectory(test_dir_); | 244 file_util::CreateDirectory(test_dir_); |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
248 // Returns the fully qualified path of a data file. | 248 // Returns the fully qualified path of a data file. |
249 FilePath test_file(const FilePath::StringType& filename) const { | 249 FilePath test_file(const FilePath::StringType& filename) const { |
250 // Hack for a quick lowercase. We assume all the test data file names are | 250 // Hack for a quick lowercase. We assume all the test data file names are |
251 // ASCII. | 251 // ASCII. |
252 #if defined(OS_WIN) | 252 #if defined(OS_WIN) |
253 std::string tmp = WideToASCII(filename); | 253 std::string tmp = WideToASCII(filename); |
254 #else | 254 #else |
255 std::string tmp(filename); | 255 std::string tmp(filename); |
256 #endif | 256 #endif |
257 for (size_t i = 0; i < tmp.size(); ++i) | 257 for (size_t i = 0; i < tmp.size(); ++i) |
258 tmp[i] = ToLowerASCII(tmp[i]); | 258 tmp[i] = base::ToLowerASCII(tmp[i]); |
259 | 259 |
260 return test_dir_.AppendASCII(tmp); | 260 return test_dir_.AppendASCII(tmp); |
261 } | 261 } |
262 | 262 |
263 // Compares or saves the bitmap currently loaded in the context, depending on | 263 // Compares or saves the bitmap currently loaded in the context, depending on |
264 // kGenerating value. Returns 0 on success or any positive value between ]0, | 264 // kGenerating value. Returns 0 on success or any positive value between ]0, |
265 // 100] on failure. The return value is the percentage of difference between | 265 // 100] on failure. The return value is the percentage of difference between |
266 // the image in the file and the image in the canvas. | 266 // the image in the file and the image in the canvas. |
267 double ProcessCanvas(const skia::PlatformCanvas& canvas, | 267 double ProcessCanvas(const skia::PlatformCanvas& canvas, |
268 FilePath::StringType filename) const { | 268 FilePath::StringType filename) const { |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 { | 965 { |
966 vcanvas_->rotate(67); | 966 vcanvas_->rotate(67); |
967 pcanvas_->rotate(67); | 967 pcanvas_->rotate(67); |
968 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); | 968 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); |
969 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); | 969 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); |
970 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); | 970 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); |
971 } | 971 } |
972 } | 972 } |
973 | 973 |
974 } // namespace skia | 974 } // namespace skia |
OLD | NEW |