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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 HMONITOR main_monitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY); | 480 HMONITOR main_monitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY); |
481 if (GetMonitorInfo(main_monitor, &monitor_info)) { | 481 if (GetMonitorInfo(main_monitor, &monitor_info)) { |
482 RECT& rect = monitor_info.rcMonitor; | 482 RECT& rect = monitor_info.rcMonitor; |
483 | 483 |
484 std::vector<unsigned char> png_data; | 484 std::vector<unsigned char> png_data; |
485 gfx::Rect bounds( | 485 gfx::Rect bounds( |
486 gfx::Size(rect.right - rect.left, rect.bottom - rect.top)); | 486 gfx::Size(rect.right - rect.left, rect.bottom - rect.top)); |
487 if (ui::GrabDesktopSnapshot(bounds, &png_data) && | 487 if (ui::GrabDesktopSnapshot(bounds, &png_data) && |
488 png_data.size() <= INT_MAX) { | 488 png_data.size() <= INT_MAX) { |
489 int bytes = static_cast<int>(png_data.size()); | 489 int bytes = static_cast<int>(png_data.size()); |
490 int written = file_util::WriteFile( | 490 int written = base::WriteFile( |
491 out_path, reinterpret_cast<char*>(&png_data[0]), bytes); | 491 out_path, reinterpret_cast<char*>(&png_data[0]), bytes); |
492 succeeded = (written == bytes); | 492 succeeded = (written == bytes); |
493 } | 493 } |
494 } | 494 } |
495 | 495 |
496 if (succeeded && screenshot_path != NULL) | 496 if (succeeded && screenshot_path != NULL) |
497 *screenshot_path = out_path; | 497 *screenshot_path = out_path; |
498 | 498 |
499 return succeeded; | 499 return succeeded; |
500 } | 500 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 void HistoryEnumerator::HistoryQueryComplete( | 544 void HistoryEnumerator::HistoryQueryComplete( |
545 const base::Closure& quit_task, | 545 const base::Closure& quit_task, |
546 HistoryService::Handle request_handle, | 546 HistoryService::Handle request_handle, |
547 history::QueryResults* results) { | 547 history::QueryResults* results) { |
548 for (size_t i = 0; i < results->size(); ++i) | 548 for (size_t i = 0; i < results->size(); ++i) |
549 urls_.push_back((*results)[i].url()); | 549 urls_.push_back((*results)[i].url()); |
550 quit_task.Run(); | 550 quit_task.Run(); |
551 } | 551 } |
552 | 552 |
553 } // namespace ui_test_utils | 553 } // namespace ui_test_utils |
OLD | NEW |