| 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 #ifndef CHROME_TEST_CHROMEDRIVER_SESSION_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_SESSION_H_ |
| 6 #define CHROME_TEST_CHROMEDRIVER_SESSION_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_SESSION_H_ |
| 7 | 7 |
| 8 #include <list> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 14 #include "chrome/test/chromedriver/basic_types.h" | 15 #include "chrome/test/chromedriver/basic_types.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class DictionaryValue; | 18 class DictionaryValue; |
| 18 } | 19 } |
| 19 | 20 |
| 20 class Chrome; | 21 class Chrome; |
| 21 class Status; | 22 class Status; |
| 22 class WebView; | 23 class WebView; |
| 23 | 24 |
| 25 struct FrameInfo { |
| 26 FrameInfo(const std::string& parent_frame_id, |
| 27 const std::string& frame_id, |
| 28 const std::string& chromedriver_frame_id); |
| 29 |
| 30 std::string parent_frame_id; |
| 31 std::string frame_id; |
| 32 std::string chromedriver_frame_id; |
| 33 }; |
| 34 |
| 24 struct Session { | 35 struct Session { |
| 25 explicit Session(const std::string& id); | 36 explicit Session(const std::string& id); |
| 26 Session(const std::string& id, scoped_ptr<Chrome> chrome); | 37 Session(const std::string& id, scoped_ptr<Chrome> chrome); |
| 27 ~Session(); | 38 ~Session(); |
| 28 | 39 |
| 29 Status GetTargetWindow(WebView** web_view); | 40 Status GetTargetWindow(WebView** web_view); |
| 30 | 41 |
| 42 void SwitchToTopFrame(); |
| 43 void SwitchToSubFrame(const std::string& frame_id, |
| 44 const std::string& chromedriver_frame_id); |
| 45 std::string GetCurrentFrameId() const; |
| 46 |
| 31 const std::string id; | 47 const std::string id; |
| 32 scoped_ptr<Chrome> chrome; | 48 scoped_ptr<Chrome> chrome; |
| 33 std::string window; | 49 std::string window; |
| 34 std::string frame; | 50 // List of |FrameInfo|s for each frame to the current target frame from the |
| 51 // first frame element in the root document. If target frame is window.top, |
| 52 // this list will be empty. |
| 53 std::list<FrameInfo> frames; |
| 35 WebPoint mouse_position; | 54 WebPoint mouse_position; |
| 36 int implicit_wait; | 55 int implicit_wait; |
| 37 int page_load_timeout; | 56 int page_load_timeout; |
| 38 int script_timeout; | 57 int script_timeout; |
| 39 std::string prompt_text; | 58 std::string prompt_text; |
| 40 const scoped_ptr<base::DictionaryValue> capabilities; | 59 const scoped_ptr<base::DictionaryValue> capabilities; |
| 41 | 60 |
| 42 private: | 61 private: |
| 43 scoped_ptr<base::DictionaryValue> CreateCapabilities(); | 62 scoped_ptr<base::DictionaryValue> CreateCapabilities(); |
| 44 }; | 63 }; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 61 private: | 80 private: |
| 62 virtual ~SessionAccessorImpl(); | 81 virtual ~SessionAccessorImpl(); |
| 63 | 82 |
| 64 base::Lock session_lock_; | 83 base::Lock session_lock_; |
| 65 scoped_ptr<Session> session_; | 84 scoped_ptr<Session> session_; |
| 66 | 85 |
| 67 DISALLOW_COPY_AND_ASSIGN(SessionAccessorImpl); | 86 DISALLOW_COPY_AND_ASSIGN(SessionAccessorImpl); |
| 68 }; | 87 }; |
| 69 | 88 |
| 70 #endif // CHROME_TEST_CHROMEDRIVER_SESSION_H_ | 89 #endif // CHROME_TEST_CHROMEDRIVER_SESSION_H_ |
| OLD | NEW |