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 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/file_path.h" | 17 #include "base/file_path.h" |
18 #include "base/json/json_reader.h" | 18 #include "base/json/json_reader.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "base/message_loop.h" | 20 #include "base/message_loop.h" |
21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
22 #include "base/process_util.h" | 22 #include "base/process_util.h" |
23 #include "base/rand_util.h" | 23 #include "base/rand_util.h" |
24 #include "base/string_number_conversions.h" | 24 #include "base/string_number_conversions.h" |
25 #include "base/test/test_timeouts.h" | 25 #include "base/test/test_timeouts.h" |
| 26 #include "base/time.h" |
26 #include "base/utf_string_conversions.h" | 27 #include "base/utf_string_conversions.h" |
27 #include "base/values.h" | 28 #include "base/values.h" |
28 #include "chrome/browser/bookmarks/bookmark_model.h" | 29 #include "chrome/browser/bookmarks/bookmark_model.h" |
29 #include "chrome/browser/browser_process.h" | 30 #include "chrome/browser/browser_process.h" |
30 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/browser/search_engines/template_url_service.h" | 32 #include "chrome/browser/search_engines/template_url_service.h" |
32 #include "chrome/browser/search_engines/template_url_service_test_util.h" | 33 #include "chrome/browser/search_engines/template_url_service_test_util.h" |
33 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 34 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
34 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 35 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
35 #include "chrome/browser/ui/browser.h" | 36 #include "chrome/browser/ui/browser.h" |
(...skipping 14 matching lines...) Expand all Loading... |
50 #include "content/public/browser/geolocation.h" | 51 #include "content/public/browser/geolocation.h" |
51 #include "content/public/browser/navigation_controller.h" | 52 #include "content/public/browser/navigation_controller.h" |
52 #include "content/public/browser/navigation_entry.h" | 53 #include "content/public/browser/navigation_entry.h" |
53 #include "content/public/browser/notification_service.h" | 54 #include "content/public/browser/notification_service.h" |
54 #include "content/public/browser/render_process_host.h" | 55 #include "content/public/browser/render_process_host.h" |
55 #include "content/public/browser/render_view_host.h" | 56 #include "content/public/browser/render_view_host.h" |
56 #include "content/public/browser/render_view_host_delegate.h" | 57 #include "content/public/browser/render_view_host_delegate.h" |
57 #include "content/public/browser/web_contents.h" | 58 #include "content/public/browser/web_contents.h" |
58 #include "content/public/browser/web_contents_observer.h" | 59 #include "content/public/browser/web_contents_observer.h" |
59 #include "content/public/browser/web_contents_view.h" | 60 #include "content/public/browser/web_contents_view.h" |
| 61 #include "content/public/common/geoposition.h" |
60 #include "content/test/test_navigation_observer.h" | 62 #include "content/test/test_navigation_observer.h" |
61 #include "googleurl/src/gurl.h" | 63 #include "googleurl/src/gurl.h" |
62 #include "net/base/net_util.h" | 64 #include "net/base/net_util.h" |
63 #include "net/test/python_utils.h" | 65 #include "net/test/python_utils.h" |
64 #include "testing/gtest/include/gtest/gtest.h" | 66 #include "testing/gtest/include/gtest/gtest.h" |
65 #include "third_party/skia/include/core/SkBitmap.h" | 67 #include "third_party/skia/include/core/SkBitmap.h" |
66 #include "third_party/skia/include/core/SkColor.h" | 68 #include "third_party/skia/include/core/SkColor.h" |
67 #include "ui/gfx/size.h" | 69 #include "ui/gfx/size.h" |
68 #include "ui/ui_controls/ui_controls.h" | 70 #include "ui/ui_controls/ui_controls.h" |
69 | 71 |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); | 1187 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); |
1186 } | 1188 } |
1187 | 1189 |
1188 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { | 1190 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { |
1189 DCHECK(bitmap); | 1191 DCHECK(bitmap); |
1190 SnapshotTaker taker; | 1192 SnapshotTaker taker; |
1191 return taker.TakeEntirePageSnapshot(rvh, bitmap); | 1193 return taker.TakeEntirePageSnapshot(rvh, bitmap); |
1192 } | 1194 } |
1193 | 1195 |
1194 void OverrideGeolocation(double latitude, double longitude) { | 1196 void OverrideGeolocation(double latitude, double longitude) { |
1195 content::OverrideLocationForTesting( | 1197 content::Geoposition position; |
1196 latitude, longitude, 0, base::Bind(MessageLoop::QuitClosure())); | 1198 position.latitude = latitude; |
| 1199 position.longitude = longitude; |
| 1200 position.altitude = 0.; |
| 1201 position.accuracy = 0.; |
| 1202 position.timestamp = base::Time::Now(); |
| 1203 content::OverrideLocationForTesting(position, |
| 1204 base::Bind(MessageLoop::QuitClosure())); |
1197 RunMessageLoop(); | 1205 RunMessageLoop(); |
1198 } | 1206 } |
1199 | 1207 |
1200 namespace internal { | 1208 namespace internal { |
1201 | 1209 |
1202 void ClickTask(ui_controls::MouseButton button, | 1210 void ClickTask(ui_controls::MouseButton button, |
1203 int state, | 1211 int state, |
1204 const base::Closure& followup) { | 1212 const base::Closure& followup) { |
1205 if (!followup.is_null()) | 1213 if (!followup.is_null()) |
1206 ui_controls::SendMouseEventsNotifyWhenDone(button, state, followup); | 1214 ui_controls::SendMouseEventsNotifyWhenDone(button, state, followup); |
1207 else | 1215 else |
1208 ui_controls::SendMouseEvents(button, state); | 1216 ui_controls::SendMouseEvents(button, state); |
1209 } | 1217 } |
1210 | 1218 |
1211 } // namespace internal | 1219 } // namespace internal |
1212 } // namespace ui_test_utils | 1220 } // namespace ui_test_utils |
OLD | NEW |