| 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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 base::Bind(&SnapshotTaker::OnSnapshotTaken, base::Unretained(this)), | 557 base::Bind(&SnapshotTaker::OnSnapshotTaken, base::Unretained(this)), |
| 558 page_size, | 558 page_size, |
| 559 desired_size); | 559 desired_size); |
| 560 message_loop_runner_ = new content::MessageLoopRunner; | 560 message_loop_runner_ = new content::MessageLoopRunner; |
| 561 message_loop_runner_->Run(); | 561 message_loop_runner_->Run(); |
| 562 return snapshot_taken_; | 562 return snapshot_taken_; |
| 563 } | 563 } |
| 564 | 564 |
| 565 bool TakeEntirePageSnapshot(RenderViewHost* rvh, | 565 bool TakeEntirePageSnapshot(RenderViewHost* rvh, |
| 566 SkBitmap* bitmap) WARN_UNUSED_RESULT { | 566 SkBitmap* bitmap) WARN_UNUSED_RESULT { |
| 567 const char* script = | 567 const wchar_t* script = |
| 568 "window.domAutomationController.send(" | 568 L"window.domAutomationController.send(" |
| 569 "JSON.stringify([document.width, document.height]))"; | 569 L" JSON.stringify([document.width, document.height]))"; |
| 570 std::string json; | 570 std::string json; |
| 571 if (!content::ExecuteJavaScriptAndExtractString(rvh, "", script, &json)) | 571 if (!content::ExecuteJavaScriptAndExtractString(rvh, L"", script, &json)) |
| 572 return false; | 572 return false; |
| 573 | 573 |
| 574 // Parse the JSON. | 574 // Parse the JSON. |
| 575 std::vector<int> dimensions; | 575 std::vector<int> dimensions; |
| 576 scoped_ptr<Value> value( | 576 scoped_ptr<Value> value( |
| 577 base::JSONReader::Read(json, base::JSON_ALLOW_TRAILING_COMMAS)); | 577 base::JSONReader::Read(json, base::JSON_ALLOW_TRAILING_COMMAS)); |
| 578 if (!value->IsType(Value::TYPE_LIST)) | 578 if (!value->IsType(Value::TYPE_LIST)) |
| 579 return false; | 579 return false; |
| 580 ListValue* list = static_cast<ListValue*>(value.get()); | 580 ListValue* list = static_cast<ListValue*>(value.get()); |
| 581 int width, height; | 581 int width, height; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 void HistoryEnumerator::HistoryQueryComplete( | 704 void HistoryEnumerator::HistoryQueryComplete( |
| 705 const base::Closure& quit_task, | 705 const base::Closure& quit_task, |
| 706 HistoryService::Handle request_handle, | 706 HistoryService::Handle request_handle, |
| 707 history::QueryResults* results) { | 707 history::QueryResults* results) { |
| 708 for (size_t i = 0; i < results->size(); ++i) | 708 for (size_t i = 0; i < results->size(); ++i) |
| 709 urls_.push_back((*results)[i].url()); | 709 urls_.push_back((*results)[i].url()); |
| 710 quit_task.Run(); | 710 quit_task.Run(); |
| 711 } | 711 } |
| 712 | 712 |
| 713 } // namespace ui_test_utils | 713 } // namespace ui_test_utils |
| OLD | NEW |