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

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

Issue 316016: Move the json-related files into a separate json directory. This hopefully al... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/renderer/extensions/extension_process_bindings.cc ('k') | ipc/ipc_message_utils.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/ui_test_utils.h" 5 #include "chrome/test/ui_test_utils.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/process_util.h" 12 #include "base/process_util.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/browser.h" 14 #include "chrome/browser/browser.h"
15 #include "chrome/browser/dom_operation_notification_details.h" 15 #include "chrome/browser/dom_operation_notification_details.h"
16 #include "chrome/browser/download/download_manager.h" 16 #include "chrome/browser/download/download_manager.h"
17 #include "chrome/browser/renderer_host/render_process_host.h" 17 #include "chrome/browser/renderer_host/render_process_host.h"
18 #include "chrome/browser/tab_contents/navigation_controller.h" 18 #include "chrome/browser/tab_contents/navigation_controller.h"
19 #include "chrome/browser/tab_contents/navigation_entry.h" 19 #include "chrome/browser/tab_contents/navigation_entry.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 std::wstring script = L"window.domAutomationController.setAutomationId(0);" + 390 std::wstring script = L"window.domAutomationController.setAutomationId(0);" +
391 original_script; 391 original_script;
392 render_view_host->ExecuteJavascriptInWebFrame(frame_xpath, script); 392 render_view_host->ExecuteJavascriptInWebFrame(frame_xpath, script);
393 DOMOperationObserver dom_op_observer(render_view_host); 393 DOMOperationObserver dom_op_observer(render_view_host);
394 std::string json = dom_op_observer.response(); 394 std::string json = dom_op_observer.response();
395 // Wrap |json| in an array before deserializing because valid JSON has an 395 // Wrap |json| in an array before deserializing because valid JSON has an
396 // array or an object as the root. 396 // array or an object as the root.
397 json.insert(0, "["); 397 json.insert(0, "[");
398 json.append("]"); 398 json.append("]");
399 399
400 scoped_ptr<Value> root_val(JSONReader::Read(json, true)); 400 scoped_ptr<Value> root_val(base::JSONReader::Read(json, true));
401 if (!root_val->IsType(Value::TYPE_LIST)) 401 if (!root_val->IsType(Value::TYPE_LIST))
402 return NULL; 402 return NULL;
403 403
404 ListValue* list = static_cast<ListValue*>(root_val.get()); 404 ListValue* list = static_cast<ListValue*>(root_val.get());
405 Value* result; 405 Value* result;
406 if (!list || !list->GetSize() || 406 if (!list || !list->GetSize() ||
407 !list->Remove(0, &result)) // Remove gives us ownership of the value. 407 !list->Remove(0, &result)) // Remove gives us ownership of the value.
408 return NULL; 408 return NULL;
409 409
410 return result; 410 return result;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 NotificationObserver* observer, 497 NotificationObserver* observer,
498 int64 timeout_ms) { 498 int64 timeout_ms) {
499 NotificationRegistrar registrar; 499 NotificationRegistrar registrar;
500 registrar.Add(observer, type, NotificationService::AllSources()); 500 registrar.Add(observer, type, NotificationService::AllSources());
501 MessageLoop::current()->PostDelayedTask( 501 MessageLoop::current()->PostDelayedTask(
502 FROM_HERE, new MessageLoop::QuitTask, timeout_ms); 502 FROM_HERE, new MessageLoop::QuitTask, timeout_ms);
503 RunMessageLoop(); 503 RunMessageLoop();
504 } 504 }
505 505
506 } // namespace ui_test_utils 506 } // namespace ui_test_utils
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_process_bindings.cc ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698