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

Side by Side Diff: chrome/test/automation/browser_proxy.cc

Issue 6685099: Removing command_execution_timeout_ms in favor of action_max_timeout_ms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 #include "base/test/test_timeouts.h"
11 #include "base/threading/platform_thread.h" 12 #include "base/threading/platform_thread.h"
12 #include "base/time.h" 13 #include "base/time.h"
13 #include "chrome/common/automation_constants.h" 14 #include "chrome/common/automation_constants.h"
14 #include "chrome/common/automation_messages.h" 15 #include "chrome/common/automation_messages.h"
15 #include "chrome/test/automation/autocomplete_edit_proxy.h" 16 #include "chrome/test/automation/autocomplete_edit_proxy.h"
16 #include "chrome/test/automation/automation_proxy.h" 17 #include "chrome/test/automation/automation_proxy.h"
17 #include "chrome/test/automation/tab_proxy.h" 18 #include "chrome/test/automation/tab_proxy.h"
18 #include "chrome/test/automation/window_proxy.h" 19 #include "chrome/test/automation/window_proxy.h"
19 #include "ui/gfx/point.h" 20 #include "ui/gfx/point.h"
20 21
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 if (!is_valid()) 570 if (!is_valid())
570 return false; 571 return false;
571 572
572 bool result = false; 573 bool result = false;
573 if (!sender_->Send(new AutomationMsg_WaitForPopupMenuToOpen(&result))) 574 if (!sender_->Send(new AutomationMsg_WaitForPopupMenuToOpen(&result)))
574 return false; 575 return false;
575 return result; 576 return result;
576 } 577 }
577 578
578 bool BrowserProxy::SendJSONRequest(const std::string& request, 579 bool BrowserProxy::SendJSONRequest(const std::string& request,
580 int timeout_ms,
579 std::string* response) { 581 std::string* response) {
580 if (!is_valid()) 582 if (!is_valid())
581 return false; 583 return false;
582 584
583 bool result = false; 585 bool result = false;
584 if (!sender_->Send(new AutomationMsg_SendJSONRequest(handle_, 586 if (!sender_->Send(new AutomationMsg_SendJSONRequest(handle_,
585 request, 587 request,
586 response, 588 response,
587 &result))) 589 &result),
590 timeout_ms))
588 return false; 591 return false;
589 return result; 592 return result;
590 } 593 }
591 594
592 bool BrowserProxy::GetInitialLoadTimes(float* min_start_time, 595 bool BrowserProxy::GetInitialLoadTimes(float* min_start_time,
593 float* max_stop_time, 596 float* max_stop_time,
594 std::vector<float>* stop_times) { 597 std::vector<float>* stop_times) {
595 std::string json_response; 598 std::string json_response;
596 const char* kJSONCommand = "{\"command\": \"GetInitialLoadTimes\"}"; 599 const char* kJSONCommand = "{\"command\": \"GetInitialLoadTimes\"}";
597 600
598 *max_stop_time = 0; 601 *max_stop_time = 0;
599 *min_start_time = -1; 602 *min_start_time = -1;
600 if (!SendJSONRequest(kJSONCommand, &json_response)) { 603 if (!SendJSONRequest(kJSONCommand,
604 TestTimeouts::action_max_timeout_ms(), &json_response)) {
Paweł Hajdan Jr. 2011/03/31 20:11:09 nit: I think this should be indented 4 more spaces
601 // Older browser versions do not support GetInitialLoadTimes. 605 // Older browser versions do not support GetInitialLoadTimes.
602 // Fail gracefully and do not record them in this case. 606 // Fail gracefully and do not record them in this case.
603 return false; 607 return false;
604 } 608 }
605 std::string error; 609 std::string error;
606 base::JSONReader reader; 610 base::JSONReader reader;
607 scoped_ptr<Value> values(reader.ReadAndReturnError(json_response, true, 611 scoped_ptr<Value> values(reader.ReadAndReturnError(json_response, true,
608 NULL, &error)); 612 NULL, &error));
609 if (!error.empty() || values->GetType() != Value::TYPE_DICTIONARY) 613 if (!error.empty() || values->GetType() != Value::TYPE_DICTIONARY)
610 return false; 614 return false;
(...skipping 30 matching lines...) Expand all
641 if (i == 0) 645 if (i == 0)
642 *min_start_time = start_ms; 646 *min_start_time = start_ms;
643 647
644 *min_start_time = std::min(start_ms, *min_start_time); 648 *min_start_time = std::min(start_ms, *min_start_time);
645 *max_stop_time = std::max(stop_ms, *max_stop_time); 649 *max_stop_time = std::max(stop_ms, *max_stop_time);
646 stop_times->push_back(stop_ms); 650 stop_times->push_back(stop_ms);
647 } 651 }
648 std::sort(stop_times->begin(), stop_times->end()); 652 std::sort(stop_times->begin(), stop_times->end());
649 return true; 653 return true;
650 } 654 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698