Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/test/base/ui_test_utils.cc

Issue 11753009: Simplify ExecuteJavaScript* functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update prerender_browsertest.cc. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/base/tracing_browsertest.cc ('k') | chrome/test/gpu/gpu_pixel_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 char* script =
568 "window.domAutomationController.send(" 568 "window.domAutomationController.send("
569 "JSON.stringify([document.width, document.height]))"; 569 " JSON.stringify([document.width, document.height]))";
570 std::string json; 570 std::string json;
571 if (!content::ExecuteJavaScriptAndExtractString(rvh, "", script, &json)) 571 if (!content::ExecuteScriptAndExtractString(rvh, 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
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
OLDNEW
« no previous file with comments | « chrome/test/base/tracing_browsertest.cc ('k') | chrome/test/gpu/gpu_pixel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698