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

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

Issue 23542005: [chromedriver] Improve timeout behavior. Prompted by user who executes script on busy page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 7 years, 3 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) 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/chromedriver/session.h" 5 #include "chrome/test/chromedriver/session.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/test/chromedriver/chrome/chrome.h" 10 #include "chrome/test/chromedriver/chrome/chrome.h"
11 #include "chrome/test/chromedriver/chrome/status.h" 11 #include "chrome/test/chromedriver/chrome/status.h"
12 #include "chrome/test/chromedriver/chrome/version.h" 12 #include "chrome/test/chromedriver/chrome/version.h"
13 #include "chrome/test/chromedriver/chrome/web_view.h" 13 #include "chrome/test/chromedriver/chrome/web_view.h"
14 #include "chrome/test/chromedriver/logging.h" 14 #include "chrome/test/chromedriver/logging.h"
15 15
16 FrameInfo::FrameInfo(const std::string& parent_frame_id, 16 FrameInfo::FrameInfo(const std::string& parent_frame_id,
17 const std::string& frame_id, 17 const std::string& frame_id,
18 const std::string& chromedriver_frame_id) 18 const std::string& chromedriver_frame_id)
19 : parent_frame_id(parent_frame_id), 19 : parent_frame_id(parent_frame_id),
20 frame_id(frame_id), 20 frame_id(frame_id),
21 chromedriver_frame_id(chromedriver_frame_id) {} 21 chromedriver_frame_id(chromedriver_frame_id) {}
22 22
23 const int Session::kDefaultPageLoadTimeoutMs = 5 * 60 * 1000; 23 const base::TimeDelta Session::kDefaultPageLoadTimeout =
24 base::TimeDelta::FromMinutes(5);
24 25
25 Session::Session(const std::string& id) 26 Session::Session(const std::string& id)
26 : id(id), 27 : id(id),
27 quit(false), 28 quit(false),
28 detach(false), 29 detach(false),
29 sticky_modifiers(0), 30 sticky_modifiers(0),
30 mouse_position(0, 0), 31 mouse_position(0, 0),
31 page_load_timeout( 32 page_load_timeout(kDefaultPageLoadTimeout) {}
32 base::TimeDelta::FromMilliseconds(kDefaultPageLoadTimeoutMs)) {}
33 33
34 Session::Session(const std::string& id, scoped_ptr<Chrome> chrome) 34 Session::Session(const std::string& id, scoped_ptr<Chrome> chrome)
35 : id(id), 35 : id(id),
36 quit(false), 36 quit(false),
37 detach(false), 37 detach(false),
38 chrome(chrome.Pass()), 38 chrome(chrome.Pass()),
39 sticky_modifiers(0), 39 sticky_modifiers(0),
40 mouse_position(0, 0), 40 mouse_position(0, 0),
41 page_load_timeout( 41 page_load_timeout(kDefaultPageLoadTimeout),
42 base::TimeDelta::FromMilliseconds(kDefaultPageLoadTimeoutMs)),
43 capabilities(CreateCapabilities()) {} 42 capabilities(CreateCapabilities()) {}
44 43
45 Session::~Session() {} 44 Session::~Session() {}
46 45
47 Status Session::GetTargetWindow(WebView** web_view) { 46 Status Session::GetTargetWindow(WebView** web_view) {
48 if (!chrome) 47 if (!chrome)
49 return Status(kNoSuchWindow, "no chrome started in this session"); 48 return Status(kNoSuchWindow, "no chrome started in this session");
50 49
51 Status status = chrome->GetWebViewById(window, web_view); 50 Status status = chrome->GetWebViewById(window, web_view);
52 if (status.IsError()) 51 if (status.IsError())
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 caps->SetBoolean("locationContextEnabled", true); 84 caps->SetBoolean("locationContextEnabled", true);
86 caps->SetBoolean("applicationCacheEnabled", false); 85 caps->SetBoolean("applicationCacheEnabled", false);
87 caps->SetBoolean("browserConnectionEnabled", false); 86 caps->SetBoolean("browserConnectionEnabled", false);
88 caps->SetBoolean("cssSelectorsEnabled", true); 87 caps->SetBoolean("cssSelectorsEnabled", true);
89 caps->SetBoolean("webStorageEnabled", true); 88 caps->SetBoolean("webStorageEnabled", true);
90 caps->SetBoolean("rotatable", false); 89 caps->SetBoolean("rotatable", false);
91 caps->SetBoolean("acceptSslCerts", true); 90 caps->SetBoolean("acceptSslCerts", true);
92 caps->SetBoolean("nativeEvents", true); 91 caps->SetBoolean("nativeEvents", true);
93 return caps.Pass(); 92 return caps.Pass();
94 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698