| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/browser/blink_test_controller.h" | 5 #include "content/shell/browser/blink_test_controller.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 524 |
| 525 printer_->PrintImageHeader(actual_pixel_hash, expected_pixel_hash_); | 525 printer_->PrintImageHeader(actual_pixel_hash, expected_pixel_hash_); |
| 526 | 526 |
| 527 // Only encode and dump the png if the hashes don't match. Encoding the | 527 // Only encode and dump the png if the hashes don't match. Encoding the |
| 528 // image is really expensive. | 528 // image is really expensive. |
| 529 if (actual_pixel_hash != expected_pixel_hash_) { | 529 if (actual_pixel_hash != expected_pixel_hash_) { |
| 530 std::vector<unsigned char> png; | 530 std::vector<unsigned char> png; |
| 531 | 531 |
| 532 bool discard_transparency = true; | 532 bool discard_transparency = true; |
| 533 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 533 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 534 switches::kEnableOverlayFullscreenVideo)) | 534 switches::kEnableOverlayFullscreenVideo) || |
| 535 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 536 switches::kForceOverlayFullscreenVideo)) |
| 535 discard_transparency = false; | 537 discard_transparency = false; |
| 536 | 538 |
| 537 std::vector<gfx::PNGCodec::Comment> comments; | 539 std::vector<gfx::PNGCodec::Comment> comments; |
| 538 comments.push_back(gfx::PNGCodec::Comment("checksum", actual_pixel_hash)); | 540 comments.push_back(gfx::PNGCodec::Comment("checksum", actual_pixel_hash)); |
| 539 bool success = gfx::PNGCodec::Encode( | 541 bool success = gfx::PNGCodec::Encode( |
| 540 static_cast<const unsigned char*>(image.getPixels()), | 542 static_cast<const unsigned char*>(image.getPixels()), |
| 541 gfx::PNGCodec::FORMAT_BGRA, | 543 gfx::PNGCodec::FORMAT_BGRA, |
| 542 gfx::Size(image.width(), image.height()), | 544 gfx::Size(image.width(), image.height()), |
| 543 static_cast<int>(image.rowBytes()), | 545 static_cast<int>(image.rowBytes()), |
| 544 discard_transparency, | 546 discard_transparency, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 692 |
| 691 printer_->AddErrorMessage( | 693 printer_->AddErrorMessage( |
| 692 base::StringPrintf("#LEAK - renderer pid %d (%s)", current_pid_, | 694 base::StringPrintf("#LEAK - renderer pid %d (%s)", current_pid_, |
| 693 result.detail.c_str())); | 695 result.detail.c_str())); |
| 694 CHECK(!crash_when_leak_found_); | 696 CHECK(!crash_when_leak_found_); |
| 695 | 697 |
| 696 DiscardMainWindow(); | 698 DiscardMainWindow(); |
| 697 } | 699 } |
| 698 | 700 |
| 699 } // namespace content | 701 } // namespace content |
| OLD | NEW |