| 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 "chrome/test/base/ui_test_utils.h" | 5 #include "chrome/test/base/ui_test_utils.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 | 624 |
| 625 MONITORINFO monitor_info = {}; | 625 MONITORINFO monitor_info = {}; |
| 626 monitor_info.cbSize = sizeof(monitor_info); | 626 monitor_info.cbSize = sizeof(monitor_info); |
| 627 HMONITOR main_monitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY); | 627 HMONITOR main_monitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY); |
| 628 if (GetMonitorInfo(main_monitor, &monitor_info)) { | 628 if (GetMonitorInfo(main_monitor, &monitor_info)) { |
| 629 RECT& rect = monitor_info.rcMonitor; | 629 RECT& rect = monitor_info.rcMonitor; |
| 630 | 630 |
| 631 std::vector<unsigned char> png_data; | 631 std::vector<unsigned char> png_data; |
| 632 gfx::Rect bounds( | 632 gfx::Rect bounds( |
| 633 gfx::Size(rect.right - rect.left, rect.bottom - rect.top)); | 633 gfx::Size(rect.right - rect.left, rect.bottom - rect.top)); |
| 634 if (ui::GrabWindowSnapshot(NULL, &png_data, bounds) && | 634 if (ui::GrabDesktopSnapshot(&png_data, bounds) && |
| 635 png_data.size() <= INT_MAX) { | 635 png_data.size() <= INT_MAX) { |
| 636 int bytes = static_cast<int>(png_data.size()); | 636 int bytes = static_cast<int>(png_data.size()); |
| 637 int written = file_util::WriteFile( | 637 int written = file_util::WriteFile( |
| 638 out_path, reinterpret_cast<char*>(&png_data[0]), bytes); | 638 out_path, reinterpret_cast<char*>(&png_data[0]), bytes); |
| 639 succeeded = (written == bytes); | 639 succeeded = (written == bytes); |
| 640 } | 640 } |
| 641 } | 641 } |
| 642 | 642 |
| 643 if (succeeded && screenshot_path != NULL) | 643 if (succeeded && screenshot_path != NULL) |
| 644 *screenshot_path = out_path; | 644 *screenshot_path = out_path; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 void HistoryEnumerator::HistoryQueryComplete( | 688 void HistoryEnumerator::HistoryQueryComplete( |
| 689 const base::Closure& quit_task, | 689 const base::Closure& quit_task, |
| 690 HistoryService::Handle request_handle, | 690 HistoryService::Handle request_handle, |
| 691 history::QueryResults* results) { | 691 history::QueryResults* results) { |
| 692 for (size_t i = 0; i < results->size(); ++i) | 692 for (size_t i = 0; i < results->size(); ++i) |
| 693 urls_.push_back((*results)[i].url()); | 693 urls_.push_back((*results)[i].url()); |
| 694 quit_task.Run(); | 694 quit_task.Run(); |
| 695 } | 695 } |
| 696 | 696 |
| 697 } // namespace ui_test_utils | 697 } // namespace ui_test_utils |
| OLD | NEW |