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

Side by Side Diff: chrome/test/chromedriver/window_commands.cc

Issue 2030013003: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client_unittest.cc ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromedriver/window_commands.h" 5 #include "chrome/test/chromedriver/window_commands.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <list> 9 #include <list>
10 #include <string> 10 #include <string>
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 std::string id_string; 357 std::string id_string;
358 int id_int; 358 int id_int;
359 if (id->GetAsString(&id_string)) { 359 if (id->GetAsString(&id_string)) {
360 xpath += base::StringPrintf( 360 xpath += base::StringPrintf(
361 "[@name=\"%s\" or @id=\"%s\"]", id_string.c_str(), id_string.c_str()); 361 "[@name=\"%s\" or @id=\"%s\"]", id_string.c_str(), id_string.c_str());
362 } else if (id->GetAsInteger(&id_int)) { 362 } else if (id->GetAsInteger(&id_int)) {
363 xpath += base::StringPrintf("[%d]", id_int + 1); 363 xpath += base::StringPrintf("[%d]", id_int + 1);
364 } else { 364 } else {
365 return Status(kUnknownError, "invalid 'id'"); 365 return Status(kUnknownError, "invalid 'id'");
366 } 366 }
367 args.Append(new base::StringValue(xpath)); 367 args.AppendString(xpath);
368 } 368 }
369 std::string frame; 369 std::string frame;
370 Status status = web_view->GetFrameByFunction( 370 Status status = web_view->GetFrameByFunction(
371 session->GetCurrentFrameId(), script, args, &frame); 371 session->GetCurrentFrameId(), script, args, &frame);
372 if (status.IsError()) 372 if (status.IsError())
373 return status; 373 return status;
374 374
375 std::unique_ptr<base::Value> result; 375 std::unique_ptr<base::Value> result;
376 status = web_view->CallFunction( 376 status = web_view->CallFunction(
377 session->GetCurrentFrameId(), script, args, &result); 377 session->GetCurrentFrameId(), script, args, &result);
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 Status ExecuteGetStorageItem(const char* storage, 743 Status ExecuteGetStorageItem(const char* storage,
744 Session* session, 744 Session* session,
745 WebView* web_view, 745 WebView* web_view,
746 const base::DictionaryValue& params, 746 const base::DictionaryValue& params,
747 std::unique_ptr<base::Value>* value, 747 std::unique_ptr<base::Value>* value,
748 Timeout* timeout) { 748 Timeout* timeout) {
749 std::string key; 749 std::string key;
750 if (!params.GetString("key", &key)) 750 if (!params.GetString("key", &key))
751 return Status(kUnknownError, "'key' must be a string"); 751 return Status(kUnknownError, "'key' must be a string");
752 base::ListValue args; 752 base::ListValue args;
753 args.Append(new base::StringValue(key)); 753 args.AppendString(key);
754 return web_view->CallFunction( 754 return web_view->CallFunction(
755 session->GetCurrentFrameId(), 755 session->GetCurrentFrameId(),
756 base::StringPrintf("function(key) { return %s[key]; }", storage), 756 base::StringPrintf("function(key) { return %s[key]; }", storage),
757 args, 757 args,
758 value); 758 value);
759 } 759 }
760 760
761 Status ExecuteGetStorageKeys(const char* storage, 761 Status ExecuteGetStorageKeys(const char* storage,
762 Session* session, 762 Session* session,
763 WebView* web_view, 763 WebView* web_view,
(...skipping 18 matching lines...) Expand all
782 const base::DictionaryValue& params, 782 const base::DictionaryValue& params,
783 std::unique_ptr<base::Value>* value, 783 std::unique_ptr<base::Value>* value,
784 Timeout* timeout) { 784 Timeout* timeout) {
785 std::string key; 785 std::string key;
786 if (!params.GetString("key", &key)) 786 if (!params.GetString("key", &key))
787 return Status(kUnknownError, "'key' must be a string"); 787 return Status(kUnknownError, "'key' must be a string");
788 std::string storage_value; 788 std::string storage_value;
789 if (!params.GetString("value", &storage_value)) 789 if (!params.GetString("value", &storage_value))
790 return Status(kUnknownError, "'value' must be a string"); 790 return Status(kUnknownError, "'value' must be a string");
791 base::ListValue args; 791 base::ListValue args;
792 args.Append(new base::StringValue(key)); 792 args.AppendString(key);
793 args.Append(new base::StringValue(storage_value)); 793 args.AppendString(storage_value);
794 return web_view->CallFunction( 794 return web_view->CallFunction(
795 session->GetCurrentFrameId(), 795 session->GetCurrentFrameId(),
796 base::StringPrintf("function(key, value) { %s[key] = value; }", storage), 796 base::StringPrintf("function(key, value) { %s[key] = value; }", storage),
797 args, 797 args,
798 value); 798 value);
799 } 799 }
800 800
801 Status ExecuteRemoveStorageItem(const char* storage, 801 Status ExecuteRemoveStorageItem(const char* storage,
802 Session* session, 802 Session* session,
803 WebView* web_view, 803 WebView* web_view,
804 const base::DictionaryValue& params, 804 const base::DictionaryValue& params,
805 std::unique_ptr<base::Value>* value, 805 std::unique_ptr<base::Value>* value,
806 Timeout* timeout) { 806 Timeout* timeout) {
807 std::string key; 807 std::string key;
808 if (!params.GetString("key", &key)) 808 if (!params.GetString("key", &key))
809 return Status(kUnknownError, "'key' must be a string"); 809 return Status(kUnknownError, "'key' must be a string");
810 base::ListValue args; 810 base::ListValue args;
811 args.Append(new base::StringValue(key)); 811 args.AppendString(key);
812 return web_view->CallFunction( 812 return web_view->CallFunction(
813 session->GetCurrentFrameId(), 813 session->GetCurrentFrameId(),
814 base::StringPrintf("function(key) { %s.removeItem(key) }", storage), 814 base::StringPrintf("function(key) { %s.removeItem(key) }", storage),
815 args, 815 args,
816 value); 816 value);
817 } 817 }
818 818
819 Status ExecuteClearStorage(const char* storage, 819 Status ExecuteClearStorage(const char* storage,
820 Session* session, 820 Session* session,
821 WebView* web_view, 821 WebView* web_view,
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 return status; 1060 return status;
1061 } 1061 }
1062 1062
1063 Status ExecuteTakeHeapSnapshot(Session* session, 1063 Status ExecuteTakeHeapSnapshot(Session* session,
1064 WebView* web_view, 1064 WebView* web_view,
1065 const base::DictionaryValue& params, 1065 const base::DictionaryValue& params,
1066 std::unique_ptr<base::Value>* value, 1066 std::unique_ptr<base::Value>* value,
1067 Timeout* timeout) { 1067 Timeout* timeout) {
1068 return web_view->TakeHeapSnapshot(value); 1068 return web_view->TakeHeapSnapshot(value);
1069 } 1069 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698