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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 gfx::Rect tab_contents_bounds; | 393 gfx::Rect tab_contents_bounds; |
394 chrome::GetActiveWebContents(browser())->GetContainerBounds( | 394 chrome::GetActiveWebContents(browser())->GetContainerBounds( |
395 &tab_contents_bounds); | 395 &tab_contents_bounds); |
396 | 396 |
397 gfx::Rect snapshot_bounds(tab_contents_bounds.x() - root_bounds.x(), | 397 gfx::Rect snapshot_bounds(tab_contents_bounds.x() - root_bounds.x(), |
398 tab_contents_bounds.y() - root_bounds.y(), | 398 tab_contents_bounds.y() - root_bounds.y(), |
399 tab_contents_bounds.width(), | 399 tab_contents_bounds.width(), |
400 tab_contents_bounds.height()); | 400 tab_contents_bounds.height()); |
401 | 401 |
402 gfx::NativeWindow native_window = browser()->window()->GetNativeWindow(); | 402 gfx::NativeWindow native_window = browser()->window()->GetNativeWindow(); |
403 if (!chrome::GrabWindowSnapshot(native_window, &png, snapshot_bounds)) { | 403 if (!chrome::GrabWindowSnapshotForUser(native_window, &png, |
| 404 snapshot_bounds)) { |
404 LOG(ERROR) << "browser::GrabWindowSnapShot() failed"; | 405 LOG(ERROR) << "browser::GrabWindowSnapShot() failed"; |
405 return false; | 406 return false; |
406 } | 407 } |
407 | 408 |
408 if (!gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&*png.begin()), | 409 if (!gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&*png.begin()), |
409 png.size(), bitmap)) { | 410 png.size(), bitmap)) { |
410 LOG(ERROR) << "Decode PNG to a SkBitmap failed"; | 411 LOG(ERROR) << "Decode PNG to a SkBitmap failed"; |
411 return false; | 412 return false; |
412 } | 413 } |
413 return true; | 414 return true; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 IN_PROC_BROWSER_TEST_F(Canvas2DPixelTestSD, Canvas2DRedBoxSD) { | 508 IN_PROC_BROWSER_TEST_F(Canvas2DPixelTestSD, Canvas2DRedBoxSD) { |
508 // If test baseline needs to be updated after a given revision, update the | 509 // If test baseline needs to be updated after a given revision, update the |
509 // following number. If no revision requirement, then 0. | 510 // following number. If no revision requirement, then 0. |
510 const int64 ref_img_revision_update = 123489; | 511 const int64 ref_img_revision_update = 123489; |
511 | 512 |
512 gfx::Size container_size(400, 300); | 513 gfx::Size container_size(400, 300); |
513 FilePath url = | 514 FilePath url = |
514 test_data_dir().AppendASCII("pixel_canvas2d.html"); | 515 test_data_dir().AppendASCII("pixel_canvas2d.html"); |
515 RunPixelTest(container_size, url, ref_img_revision_update); | 516 RunPixelTest(container_size, url, ref_img_revision_update); |
516 } | 517 } |
OLD | NEW |