| OLD | NEW |
| 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/automation/browser_proxy.h" | 5 #include "chrome/test/automation/browser_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 return result; | 421 return result; |
| 422 } | 422 } |
| 423 | 423 |
| 424 bool BrowserProxy::SendJSONRequest(const std::string& request, | 424 bool BrowserProxy::SendJSONRequest(const std::string& request, |
| 425 int timeout_ms, | 425 int timeout_ms, |
| 426 std::string* response) { | 426 std::string* response) { |
| 427 if (!is_valid()) | 427 if (!is_valid()) |
| 428 return false; | 428 return false; |
| 429 | 429 |
| 430 bool result = false; | 430 bool result = false; |
| 431 if (!sender_->Send(new AutomationMsg_SendJSONRequest(handle_, | 431 if (!sender_->Send( |
| 432 request, | 432 new AutomationMsg_SendJSONRequestWithBrowserHandle(handle_, |
| 433 response, | 433 request, |
| 434 &result), | 434 response, |
| 435 timeout_ms)) | 435 &result), |
| 436 timeout_ms)) |
| 436 return false; | 437 return false; |
| 437 return result; | 438 return result; |
| 438 } | 439 } |
| 439 | 440 |
| 440 bool BrowserProxy::GetInitialLoadTimes(int timeout_ms, | 441 bool BrowserProxy::GetInitialLoadTimes(int timeout_ms, |
| 441 float* min_start_time, | 442 float* min_start_time, |
| 442 float* max_stop_time, | 443 float* max_stop_time, |
| 443 std::vector<float>* stop_times) { | 444 std::vector<float>* stop_times) { |
| 444 std::string json_response; | 445 std::string json_response; |
| 445 const char* kJSONCommand = "{\"command\": \"GetInitialLoadTimes\"}"; | 446 const char* kJSONCommand = "{\"command\": \"GetInitialLoadTimes\"}"; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 if (i == 0) | 490 if (i == 0) |
| 490 *min_start_time = start_ms; | 491 *min_start_time = start_ms; |
| 491 | 492 |
| 492 *min_start_time = std::min(start_ms, *min_start_time); | 493 *min_start_time = std::min(start_ms, *min_start_time); |
| 493 *max_stop_time = std::max(stop_ms, *max_stop_time); | 494 *max_stop_time = std::max(stop_ms, *max_stop_time); |
| 494 stop_times->push_back(stop_ms); | 495 stop_times->push_back(stop_ms); |
| 495 } | 496 } |
| 496 std::sort(stop_times->begin(), stop_times->end()); | 497 std::sort(stop_times->begin(), stop_times->end()); |
| 497 return true; | 498 return true; |
| 498 } | 499 } |
| OLD | NEW |