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

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

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 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
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/session_commands.h" 5 #include "chrome/test/chromedriver/session_commands.h"
6 6
7 #include <list> 7 #include <list>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 WebView* web_view = NULL; 147 WebView* web_view = NULL;
148 Status status = session->GetTargetWindow(&web_view); 148 Status status = session->GetTargetWindow(&web_view);
149 if (status.IsError()) 149 if (status.IsError())
150 return Status(kSessionNotCreatedException, status); 150 return Status(kSessionNotCreatedException, status);
151 151
152 status = web_view->ConnectIfNecessary(); 152 status = web_view->ConnectIfNecessary();
153 if (status.IsError()) 153 if (status.IsError())
154 return Status(kSessionNotCreatedException, status); 154 return Status(kSessionNotCreatedException, status);
155 155
156 base::ListValue args; 156 base::ListValue args;
157 std::unique_ptr<base::Value> result(new base::FundamentalValue(0)); 157 std::unique_ptr<base::Value> result(new base::Value(0));
158 status = web_view->CallFunction(session->GetCurrentFrameId(), 158 status = web_view->CallFunction(session->GetCurrentFrameId(),
159 "function(s) { return 1; }", args, &result); 159 "function(s) { return 1; }", args, &result);
160 if (status.IsError()) 160 if (status.IsError())
161 return Status(kSessionNotCreatedException, status); 161 return Status(kSessionNotCreatedException, status);
162 162
163 int response; 163 int response;
164 if (!result->GetAsInteger(&response) || response != 1) { 164 if (!result->GetAsInteger(&response) || response != 1) {
165 return Status(kSessionNotCreatedException, 165 return Status(kSessionNotCreatedException,
166 "unexpected response from browser"); 166 "unexpected response from browser");
167 } 167 }
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 502
503 status = web_view->ConnectIfNecessary(); 503 status = web_view->ConnectIfNecessary();
504 if (status.IsError()) 504 if (status.IsError())
505 return status; 505 return status;
506 506
507 bool is_pending; 507 bool is_pending;
508 status = web_view->IsPendingNavigation( 508 status = web_view->IsPendingNavigation(
509 session->GetCurrentFrameId(), nullptr, &is_pending); 509 session->GetCurrentFrameId(), nullptr, &is_pending);
510 if (status.IsError()) 510 if (status.IsError())
511 return status; 511 return status;
512 value->reset(new base::FundamentalValue(is_pending)); 512 value->reset(new base::Value(is_pending));
513 return Status(kOk); 513 return Status(kOk);
514 } 514 }
515 515
516 Status ExecuteGetLocation(Session* session, 516 Status ExecuteGetLocation(Session* session,
517 const base::DictionaryValue& params, 517 const base::DictionaryValue& params,
518 std::unique_ptr<base::Value>* value) { 518 std::unique_ptr<base::Value>* value) {
519 if (!session->overridden_geoposition) { 519 if (!session->overridden_geoposition) {
520 return Status(kUnknownError, 520 return Status(kUnknownError,
521 "Location must be set before it can be retrieved"); 521 "Location must be set before it can be retrieved");
522 } 522 }
(...skipping 14 matching lines...) Expand all
537 ChromeDesktopImpl* desktop = nullptr; 537 ChromeDesktopImpl* desktop = nullptr;
538 Status status = session->chrome->GetAsDesktop(&desktop); 538 Status status = session->chrome->GetAsDesktop(&desktop);
539 if (status.IsError()) 539 if (status.IsError())
540 return status; 540 return status;
541 if (!desktop->IsNetworkConnectionEnabled()) 541 if (!desktop->IsNetworkConnectionEnabled())
542 return Status(kUnknownError, "network connection must be enabled"); 542 return Status(kUnknownError, "network connection must be enabled");
543 543
544 int connection_type = 0; 544 int connection_type = 0;
545 connection_type = desktop->GetNetworkConnection(); 545 connection_type = desktop->GetNetworkConnection();
546 546
547 value->reset(new base::FundamentalValue(connection_type)); 547 value->reset(new base::Value(connection_type));
548 return Status(kOk); 548 return Status(kOk);
549 } 549 }
550 550
551 Status ExecuteGetNetworkConditions(Session* session, 551 Status ExecuteGetNetworkConditions(Session* session,
552 const base::DictionaryValue& params, 552 const base::DictionaryValue& params,
553 std::unique_ptr<base::Value>* value) { 553 std::unique_ptr<base::Value>* value) {
554 if (!session->overridden_network_conditions) { 554 if (!session->overridden_network_conditions) {
555 return Status(kUnknownError, 555 return Status(kUnknownError,
556 "network conditions must be set before it can be retrieved"); 556 "network conditions must be set before it can be retrieved");
557 } 557 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 630
631 for (std::string web_view_id : web_view_ids) { 631 for (std::string web_view_id : web_view_ids) {
632 WebView* web_view; 632 WebView* web_view;
633 status = session->chrome->GetWebViewById(web_view_id, &web_view); 633 status = session->chrome->GetWebViewById(web_view_id, &web_view);
634 if (status.IsError()) 634 if (status.IsError())
635 return status; 635 return status;
636 web_view->OverrideNetworkConditions( 636 web_view->OverrideNetworkConditions(
637 *session->overridden_network_conditions); 637 *session->overridden_network_conditions);
638 } 638 }
639 639
640 value->reset(new base::FundamentalValue(connection_type)); 640 value->reset(new base::Value(connection_type));
641 return Status(kOk); 641 return Status(kOk);
642 } 642 }
643 643
644 Status ExecuteGetWindowPosition(Session* session, 644 Status ExecuteGetWindowPosition(Session* session,
645 const base::DictionaryValue& params, 645 const base::DictionaryValue& params,
646 std::unique_ptr<base::Value>* value) { 646 std::unique_ptr<base::Value>* value) {
647 ChromeDesktopImpl* desktop = NULL; 647 ChromeDesktopImpl* desktop = NULL;
648 Status status = session->chrome->GetAsDesktop(&desktop); 648 Status status = session->chrome->GetAsDesktop(&desktop);
649 if (status.IsError()) 649 if (status.IsError())
650 return status; 650 return status;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 if (status.IsError()) 822 if (status.IsError())
823 return Status(kUnknownError, "unable to unzip 'file'", status); 823 return Status(kUnknownError, "unable to unzip 'file'", status);
824 824
825 value->reset(new base::StringValue(upload.value())); 825 value->reset(new base::StringValue(upload.value()));
826 return Status(kOk); 826 return Status(kOk);
827 } 827 }
828 828
829 Status ExecuteIsAutoReporting(Session* session, 829 Status ExecuteIsAutoReporting(Session* session,
830 const base::DictionaryValue& params, 830 const base::DictionaryValue& params,
831 std::unique_ptr<base::Value>* value) { 831 std::unique_ptr<base::Value>* value) {
832 value->reset(new base::FundamentalValue(session->auto_reporting_enabled)); 832 value->reset(new base::Value(session->auto_reporting_enabled));
833 return Status(kOk); 833 return Status(kOk);
834 } 834 }
835 835
836 Status ExecuteSetAutoReporting(Session* session, 836 Status ExecuteSetAutoReporting(Session* session,
837 const base::DictionaryValue& params, 837 const base::DictionaryValue& params,
838 std::unique_ptr<base::Value>* value) { 838 std::unique_ptr<base::Value>* value) {
839 bool enabled; 839 bool enabled;
840 if (!params.GetBoolean("enabled", &enabled)) 840 if (!params.GetBoolean("enabled", &enabled))
841 return Status(kUnknownError, "missing parameter 'enabled'"); 841 return Status(kUnknownError, "missing parameter 'enabled'");
842 session->auto_reporting_enabled = enabled; 842 session->auto_reporting_enabled = enabled;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 std::unique_ptr<base::Value>* value) { 889 std::unique_ptr<base::Value>* value) {
890 WebView* web_view = nullptr; 890 WebView* web_view = nullptr;
891 Status status = session->GetTargetWindow(&web_view); 891 Status status = session->GetTargetWindow(&web_view);
892 if (status.IsError()) 892 if (status.IsError())
893 return status; 893 return status;
894 status = web_view->DeleteScreenOrientation(); 894 status = web_view->DeleteScreenOrientation();
895 if (status.IsError()) 895 if (status.IsError())
896 return status; 896 return status;
897 return Status(kOk); 897 return Status(kOk);
898 } 898 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/server/http_handler_unittest.cc ('k') | chromecast/base/device_capabilities_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698