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_UI_TOOLBAR_RECENT_TABS_BUILDER_TEST_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_BUILDER_TEST_HELPER_H_ |
6 #define CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_BUILDER_TEST_HELPER_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_BUILDER_TEST_HELPER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "components/sessions/core/session_id.h" | 13 #include "components/sessions/core/session_id.h" |
14 | 14 |
15 namespace browser_sync { | |
16 class SessionsSyncManager; | |
17 } | |
18 | |
19 namespace sync_driver { | |
20 class OpenTabsUIDelegate; | |
21 } | |
22 | |
23 namespace sync_pb { | 15 namespace sync_pb { |
24 class SessionSpecifics; | 16 class SessionSpecifics; |
25 } | 17 } |
26 | 18 |
| 19 namespace sync_sessions { |
| 20 class OpenTabsUIDelegate; |
| 21 class SessionsSyncManager; |
| 22 } |
| 23 |
27 // Utility class to help add recent tabs for testing. | 24 // Utility class to help add recent tabs for testing. |
28 class RecentTabsBuilderTestHelper { | 25 class RecentTabsBuilderTestHelper { |
29 public: | 26 public: |
30 RecentTabsBuilderTestHelper(); | 27 RecentTabsBuilderTestHelper(); |
31 ~RecentTabsBuilderTestHelper(); | 28 ~RecentTabsBuilderTestHelper(); |
32 | 29 |
33 void AddSession(); | 30 void AddSession(); |
34 int GetSessionCount(); | 31 int GetSessionCount(); |
35 SessionID::id_type GetSessionID(int session_index); | 32 SessionID::id_type GetSessionID(int session_index); |
36 base::Time GetSessionTimestamp(int session_index); | 33 base::Time GetSessionTimestamp(int session_index); |
(...skipping 11 matching lines...) Expand all Loading... |
48 SessionID::id_type GetTabID(int session_index, | 45 SessionID::id_type GetTabID(int session_index, |
49 int window_index, | 46 int window_index, |
50 int tab_index); | 47 int tab_index); |
51 base::Time GetTabTimestamp(int session_index, | 48 base::Time GetTabTimestamp(int session_index, |
52 int window_index, | 49 int window_index, |
53 int tab_index); | 50 int tab_index); |
54 base::string16 GetTabTitle(int session_index, | 51 base::string16 GetTabTitle(int session_index, |
55 int window_index, | 52 int window_index, |
56 int tab_index); | 53 int tab_index); |
57 | 54 |
58 void ExportToSessionsSyncManager( | 55 void ExportToSessionsSyncManager(sync_sessions::SessionsSyncManager* manager); |
59 browser_sync::SessionsSyncManager* manager); | |
60 | 56 |
61 std::vector<base::string16> GetTabTitlesSortedByRecency(); | 57 std::vector<base::string16> GetTabTitlesSortedByRecency(); |
62 | 58 |
63 private: | 59 private: |
64 void BuildSessionSpecifics(int session_index, | 60 void BuildSessionSpecifics(int session_index, |
65 sync_pb::SessionSpecifics* meta); | 61 sync_pb::SessionSpecifics* meta); |
66 void BuildWindowSpecifics(int session_index, | 62 void BuildWindowSpecifics(int session_index, |
67 int window_index, | 63 int window_index, |
68 sync_pb::SessionSpecifics* meta); | 64 sync_pb::SessionSpecifics* meta); |
69 void BuildTabSpecifics(int session_index, | 65 void BuildTabSpecifics(int session_index, |
70 int window_index, | 66 int window_index, |
71 int tab_index, | 67 int tab_index, |
72 sync_pb::SessionSpecifics* tab_base); | 68 sync_pb::SessionSpecifics* tab_base); |
73 void VerifyExport(sync_driver::OpenTabsUIDelegate* delegate); | 69 void VerifyExport(sync_sessions::OpenTabsUIDelegate* delegate); |
74 | 70 |
75 struct TabInfo; | 71 struct TabInfo; |
76 struct WindowInfo; | 72 struct WindowInfo; |
77 struct SessionInfo; | 73 struct SessionInfo; |
78 | 74 |
79 std::vector<SessionInfo> sessions_; | 75 std::vector<SessionInfo> sessions_; |
80 base::Time start_time_; | 76 base::Time start_time_; |
81 | 77 |
82 int max_tab_node_id_; | 78 int max_tab_node_id_; |
83 | 79 |
84 DISALLOW_COPY_AND_ASSIGN(RecentTabsBuilderTestHelper); | 80 DISALLOW_COPY_AND_ASSIGN(RecentTabsBuilderTestHelper); |
85 }; | 81 }; |
86 | 82 |
87 #endif // CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_BUILDER_TEST_HELPER_H_ | 83 #endif // CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_BUILDER_TEST_HELPER_H_ |
OLD | NEW |