| 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 // This file looks like a unit test, but it contains benchmarks and test | 5 // This file looks like a unit test, but it contains benchmarks and test |
| 6 // utilities intended for manual evaluation of the scalers in | 6 // utilities intended for manual evaluation of the scalers in |
| 7 // gl_helper*. These tests produce output in the form of files and printouts, | 7 // gl_helper*. These tests produce output in the form of files and printouts, |
| 8 // but cannot really "fail". There is no point in making these tests part | 8 // but cannot really "fail". There is no point in making these tests part |
| 9 // of any test automation run. | 9 // of any test automation run. |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 virtual void TearDown() { | 75 virtual void TearDown() { |
| 76 helper_scaling_.reset(NULL); | 76 helper_scaling_.reset(NULL); |
| 77 helper_.reset(NULL); | 77 helper_.reset(NULL); |
| 78 context_.reset(NULL); | 78 context_.reset(NULL); |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 void LoadPngFileToSkBitmap(const base::FilePath& filename, | 82 void LoadPngFileToSkBitmap(const base::FilePath& filename, |
| 83 SkBitmap* bitmap) { | 83 SkBitmap* bitmap) { |
| 84 std::string compressed; | 84 std::string compressed; |
| 85 file_util::ReadFileToString(base::MakeAbsoluteFilePath(filename), | 85 base::ReadFileToString(base::MakeAbsoluteFilePath(filename), &compressed); |
| 86 &compressed); | |
| 87 ASSERT_TRUE(compressed.size()); | 86 ASSERT_TRUE(compressed.size()); |
| 88 ASSERT_TRUE(gfx::PNGCodec::Decode( | 87 ASSERT_TRUE(gfx::PNGCodec::Decode( |
| 89 reinterpret_cast<const unsigned char*>(compressed.data()), | 88 reinterpret_cast<const unsigned char*>(compressed.data()), |
| 90 compressed.size(), bitmap)); | 89 compressed.size(), bitmap)); |
| 91 } | 90 } |
| 92 | 91 |
| 93 // Save the image to a png file. Used to create the initial test files. | 92 // Save the image to a png file. Used to create the initial test files. |
| 94 void SaveToFile(SkBitmap* bitmap, const base::FilePath& filename) { | 93 void SaveToFile(SkBitmap* bitmap, const base::FilePath& filename) { |
| 95 std::vector<unsigned char> compressed; | 94 std::vector<unsigned char> compressed; |
| 96 ASSERT_TRUE(gfx::PNGCodec::Encode( | 95 ASSERT_TRUE(gfx::PNGCodec::Encode( |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 #if defined(OS_MACOSX) | 312 #if defined(OS_MACOSX) |
| 314 base::mac::ScopedNSAutoreleasePool pool; | 313 base::mac::ScopedNSAutoreleasePool pool; |
| 315 #endif | 314 #endif |
| 316 #if defined(TOOLKIT_GTK) | 315 #if defined(TOOLKIT_GTK) |
| 317 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); | 316 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); |
| 318 #endif | 317 #endif |
| 319 gfx::GLSurface::InitializeOneOff(); | 318 gfx::GLSurface::InitializeOneOff(); |
| 320 | 319 |
| 321 return content::UnitTestTestSuite(suite).Run(); | 320 return content::UnitTestTestSuite(suite).Run(); |
| 322 } | 321 } |
| OLD | NEW |