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 #ifndef CHROME_TEST_WEBDRIVER_SESSION_MANAGER_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_SESSION_MANAGER_H_ |
6 #define CHROME_TEST_WEBDRIVER_SESSION_MANAGER_H_ | 6 #define CHROME_TEST_WEBDRIVER_SESSION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/singleton.h" | 11 #include "base/singleton.h" |
12 | 12 |
13 #include "chrome/test/webdriver/session.h" | 13 #include "chrome/test/webdriver/session.h" |
14 | 14 |
15 namespace webdriver { | 15 namespace webdriver { |
16 | 16 |
17 // Session manager keeps track of all of the session that are currently | 17 // Session manager keeps track of all of the session that are currently |
18 // running on the machine under test. With webdriver the user is allowed | 18 // running on the machine under test. With webdriver the user is allowed |
19 // multiple instances of the browser on the same machine. So 2 sessions | 19 // multiple instances of the browser on the same machine. So 2 sessions |
20 // open would mean you would have 2 instances of chrome running under | 20 // open would mean you would have 2 instances of chrome running under |
21 // their own profiles. | 21 // their own profiles. |
22 class SessionManager { | 22 class SessionManager { |
23 public: | 23 public: |
| 24 // Returns the singleton instance. |
| 25 static SessionManager* GetInstance(); |
| 26 |
24 std::string GetIPAddress(); | 27 std::string GetIPAddress(); |
25 bool SetIPAddress(const std::string& port); | 28 bool SetIPAddress(const std::string& port); |
26 | 29 |
27 bool Create(std::string* id); | 30 bool Create(std::string* id); |
28 bool Delete(const std::string& id); | 31 bool Delete(const std::string& id); |
29 bool Has(const std::string& id) const; | 32 bool Has(const std::string& id) const; |
30 | 33 |
31 Session* GetSession(const std::string& id) const; | 34 Session* GetSession(const std::string& id) const; |
32 | 35 |
33 private: | 36 private: |
(...skipping 12 matching lines...) Expand all Loading... |
46 std::string port_; | 49 std::string port_; |
47 int count_; | 50 int count_; |
48 | 51 |
49 DISALLOW_COPY_AND_ASSIGN(SessionManager); | 52 DISALLOW_COPY_AND_ASSIGN(SessionManager); |
50 }; | 53 }; |
51 | 54 |
52 } // namespace webdriver | 55 } // namespace webdriver |
53 | 56 |
54 #endif // CHROME_TEST_WEBDRIVER_SESSION_MANAGER_H_ | 57 #endif // CHROME_TEST_WEBDRIVER_SESSION_MANAGER_H_ |
55 | 58 |
OLD | NEW |