| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 return false; | 574 return false; |
| 575 return result; | 575 return result; |
| 576 } | 576 } |
| 577 | 577 |
| 578 bool BrowserProxy::SendJSONRequest(const std::string& request, | 578 bool BrowserProxy::SendJSONRequest(const std::string& request, |
| 579 std::string* response) { | 579 std::string* response) { |
| 580 if (!is_valid()) | 580 if (!is_valid()) |
| 581 return false; | 581 return false; |
| 582 | 582 |
| 583 bool result = false; | 583 bool result = false; |
| 584 return sender_->Send(new AutomationMsg_SendJSONRequest(handle_, | 584 if (!sender_->Send(new AutomationMsg_SendJSONRequest(handle_, |
| 585 request, response, | 585 request, |
| 586 &result)); | 586 response, |
| 587 &result))) |
| 588 return false; |
| 587 return result; | 589 return result; |
| 588 } | 590 } |
| 589 | 591 |
| 590 bool BrowserProxy::GetInitialLoadTimes(float* min_start_time, | 592 bool BrowserProxy::GetInitialLoadTimes(float* min_start_time, |
| 591 float* max_stop_time, | 593 float* max_stop_time, |
| 592 std::vector<float>* stop_times) { | 594 std::vector<float>* stop_times) { |
| 593 std::string json_response; | 595 std::string json_response; |
| 594 const char* kJSONCommand = "{\"command\": \"GetInitialLoadTimes\"}"; | 596 const char* kJSONCommand = "{\"command\": \"GetInitialLoadTimes\"}"; |
| 595 | 597 |
| 596 *max_stop_time = 0; | 598 *max_stop_time = 0; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 if (i == 0) | 641 if (i == 0) |
| 640 *min_start_time = start_ms; | 642 *min_start_time = start_ms; |
| 641 | 643 |
| 642 *min_start_time = std::min(start_ms, *min_start_time); | 644 *min_start_time = std::min(start_ms, *min_start_time); |
| 643 *max_stop_time = std::max(stop_ms, *max_stop_time); | 645 *max_stop_time = std::max(stop_ms, *max_stop_time); |
| 644 stop_times->push_back(stop_ms); | 646 stop_times->push_back(stop_ms); |
| 645 } | 647 } |
| 646 std::sort(stop_times->begin(), stop_times->end()); | 648 std::sort(stop_times->begin(), stop_times->end()); |
| 647 return true; | 649 return true; |
| 648 } | 650 } |
| OLD | NEW |