| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "content/public/common/geoposition.h" | 67 #include "content/public/common/geoposition.h" |
| 68 #include "content/public/test/browser_test_utils.h" | 68 #include "content/public/test/browser_test_utils.h" |
| 69 #include "content/public/test/download_test_observer.h" | 69 #include "content/public/test/download_test_observer.h" |
| 70 #include "content/public/test/test_navigation_observer.h" | 70 #include "content/public/test/test_navigation_observer.h" |
| 71 #include "content/public/test/test_utils.h" | 71 #include "content/public/test/test_utils.h" |
| 72 #include "net/base/net_util.h" | 72 #include "net/base/net_util.h" |
| 73 #include "net/test/python_utils.h" | 73 #include "net/test/python_utils.h" |
| 74 #include "third_party/skia/include/core/SkBitmap.h" | 74 #include "third_party/skia/include/core/SkBitmap.h" |
| 75 #include "third_party/skia/include/core/SkColor.h" | 75 #include "third_party/skia/include/core/SkColor.h" |
| 76 #include "ui/gfx/size.h" | 76 #include "ui/gfx/size.h" |
| 77 #include "ui/snapshot/snapshot.h" | 77 #include "ui/snapshot/snapshot_desktop.h" |
| 78 | 78 |
| 79 #if defined(USE_AURA) | 79 #if defined(USE_AURA) |
| 80 #include "ash/shell.h" | 80 #include "ash/shell.h" |
| 81 #include "ui/aura/root_window.h" | 81 #include "ui/aura/root_window.h" |
| 82 #endif | 82 #endif |
| 83 | 83 |
| 84 using content::BrowserThread; | 84 using content::BrowserThread; |
| 85 using content::DomOperationNotificationDetails; | 85 using content::DomOperationNotificationDetails; |
| 86 using content::NativeWebKeyboardEvent; | 86 using content::NativeWebKeyboardEvent; |
| 87 using content::NavigationController; | 87 using content::NavigationController; |
| (...skipping 536 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 |