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_BROWSER_SESSIONS_SESSION_SERVICE_TEST_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_SERVICE_TEST_HELPER_H_ |
6 #define CHROME_BROWSER_SESSIONS_SESSION_SERVICE_TEST_HELPER_H_ | 6 #define CHROME_BROWSER_SESSIONS_SESSION_SERVICE_TEST_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/sessions/session_id.h" | 13 #include "chrome/browser/sessions/session_id.h" |
14 | 14 |
15 class SessionBackend; | 15 class SessionBackend; |
16 class SessionCommand; | 16 class SessionCommand; |
17 class SessionService; | 17 class SessionService; |
18 struct SessionTab; | 18 struct SessionTab; |
19 struct SessionWindow; | 19 struct SessionWindow; |
20 class TabNavigation; | 20 |
| 21 namespace sessions { |
| 22 class SerializedNavigationEntry; |
| 23 } |
21 | 24 |
22 // A simple class that makes writing SessionService related tests easier. | 25 // A simple class that makes writing SessionService related tests easier. |
23 | 26 |
24 class SessionServiceTestHelper { | 27 class SessionServiceTestHelper { |
25 public: | 28 public: |
26 explicit SessionServiceTestHelper(); | 29 explicit SessionServiceTestHelper(); |
27 explicit SessionServiceTestHelper(SessionService* service); | 30 explicit SessionServiceTestHelper(SessionService* service); |
28 ~SessionServiceTestHelper(); | 31 ~SessionServiceTestHelper(); |
29 | 32 |
30 void PrepareTabInWindow(const SessionID& window_id, | 33 void PrepareTabInWindow(const SessionID& window_id, |
(...skipping 21 matching lines...) Expand all Loading... |
52 int visual_index, | 55 int visual_index, |
53 int nav_index, | 56 int nav_index, |
54 size_t nav_count, | 57 size_t nav_count, |
55 const SessionTab& session_tab); | 58 const SessionTab& session_tab); |
56 | 59 |
57 void AssertTabEquals(int visual_index, | 60 void AssertTabEquals(int visual_index, |
58 int nav_index, | 61 int nav_index, |
59 size_t nav_count, | 62 size_t nav_count, |
60 const SessionTab& session_tab); | 63 const SessionTab& session_tab); |
61 | 64 |
62 void AssertNavigationEquals(const TabNavigation& expected, | 65 void AssertNavigationEquals( |
63 const TabNavigation& actual); | 66 const sessions::SerializedNavigationEntry& expected, |
| 67 const sessions::SerializedNavigationEntry& actual); |
64 | 68 |
65 void AssertSingleWindowWithSingleTab( | 69 void AssertSingleWindowWithSingleTab( |
66 const std::vector<SessionWindow*>& windows, | 70 const std::vector<SessionWindow*>& windows, |
67 size_t nav_count); | 71 size_t nav_count); |
68 | 72 |
69 void set_service(SessionService* service) { service_.reset(service); } | 73 void set_service(SessionService* service) { service_.reset(service); } |
70 SessionService* ReleaseService() { return service_.release(); } | 74 SessionService* ReleaseService() { return service_.release(); } |
71 SessionService* service() { return service_.get(); } | 75 SessionService* service() { return service_.get(); } |
72 | 76 |
73 SessionBackend* backend(); | 77 SessionBackend* backend(); |
74 | 78 |
75 private: | 79 private: |
76 scoped_ptr<SessionService> service_; | 80 scoped_ptr<SessionService> service_; |
77 | 81 |
78 DISALLOW_COPY_AND_ASSIGN(SessionServiceTestHelper); | 82 DISALLOW_COPY_AND_ASSIGN(SessionServiceTestHelper); |
79 }; | 83 }; |
80 | 84 |
81 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_TEST_HELPER_H_ | 85 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_TEST_HELPER_H_ |
OLD | NEW |