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

Side by Side Diff: net/test/spawned_test_server/spawner_communicator.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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) 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 "net/test/spawned_test_server/spawner_communicator.h" 5 #include "net/test/spawned_test_server/spawner_communicator.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 std::string server_return_data; 348 std::string server_return_data;
349 int result_code; 349 int result_code;
350 SendCommandAndWaitForResult("start", arguments, &result_code, 350 SendCommandAndWaitForResult("start", arguments, &result_code,
351 &server_return_data); 351 &server_return_data);
352 if (OK != result_code || server_return_data.empty()) 352 if (OK != result_code || server_return_data.empty())
353 return false; 353 return false;
354 354
355 // Check whether the data returned from spawner server is JSON-formatted. 355 // Check whether the data returned from spawner server is JSON-formatted.
356 std::unique_ptr<base::Value> value = 356 std::unique_ptr<base::Value> value =
357 base::JSONReader::Read(server_return_data); 357 base::JSONReader::Read(server_return_data);
358 if (!value.get() || !value->IsType(base::Value::TYPE_DICTIONARY)) { 358 if (!value.get() || !value->IsType(base::Value::Type::DICTIONARY)) {
359 LOG(ERROR) << "Invalid server data: " << server_return_data.c_str(); 359 LOG(ERROR) << "Invalid server data: " << server_return_data.c_str();
360 return false; 360 return false;
361 } 361 }
362 362
363 // Check whether spawner server returns valid data. 363 // Check whether spawner server returns valid data.
364 base::DictionaryValue* server_data = 364 base::DictionaryValue* server_data =
365 static_cast<base::DictionaryValue*>(value.get()); 365 static_cast<base::DictionaryValue*>(value.get());
366 std::string message; 366 std::string message;
367 if (!server_data->GetString("message", &message) || message != "started") { 367 if (!server_data->GetString("message", &message) || message != "started") {
368 LOG(ERROR) << "Invalid message in server data: "; 368 LOG(ERROR) << "Invalid message in server data: ";
(...skipping 20 matching lines...) Expand all
389 std::string server_return_data; 389 std::string server_return_data;
390 int result_code; 390 int result_code;
391 SendCommandAndWaitForResult("kill", "", &result_code, &server_return_data); 391 SendCommandAndWaitForResult("kill", "", &result_code, &server_return_data);
392 Shutdown(); 392 Shutdown();
393 if (OK != result_code || server_return_data != "killed") 393 if (OK != result_code || server_return_data != "killed")
394 return false; 394 return false;
395 return true; 395 return true;
396 } 396 }
397 397
398 } // namespace net 398 } // namespace net
OLDNEW
« no previous file with comments | « net/test/spawned_test_server/local_test_server.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698