Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / toolbar / recent_tabs_builder_test_helper.h
blobcef9d0f1443c2037e956ab5cbb8dc41d3d9760b4
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_BUILDER_TEST_HELPER_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_BUILDER_TEST_HELPER_H_
8 #include <vector>
10 #include "base/strings/string16.h"
11 #include "base/time/time.h"
12 #include "components/sessions/session_id.h"
14 namespace browser_sync {
15 class SessionsSyncManager;
18 namespace sync_driver {
19 class OpenTabsUIDelegate;
22 namespace sync_pb {
23 class SessionSpecifics;
26 // Utility class to help add recent tabs for testing.
27 class RecentTabsBuilderTestHelper {
28 public:
29 RecentTabsBuilderTestHelper();
30 ~RecentTabsBuilderTestHelper();
32 void AddSession();
33 int GetSessionCount();
34 SessionID::id_type GetSessionID(int session_index);
35 base::Time GetSessionTimestamp(int session_index);
37 void AddWindow(int session_index);
38 int GetWindowCount(int session_index);
39 SessionID::id_type GetWindowID(int session_index, int window_index);
41 void AddTab(int session_index, int window_index);
42 void AddTabWithInfo(int session_index,
43 int window_index,
44 base::Time timestamp,
45 const base::string16& title);
46 int GetTabCount(int session_index, int window_index);
47 SessionID::id_type GetTabID(int session_index,
48 int window_index,
49 int tab_index);
50 base::Time GetTabTimestamp(int session_index,
51 int window_index,
52 int tab_index);
53 base::string16 GetTabTitle(int session_index,
54 int window_index,
55 int tab_index);
57 void ExportToSessionsSyncManager(
58 browser_sync::SessionsSyncManager* manager);
60 std::vector<base::string16> GetTabTitlesSortedByRecency();
62 private:
63 void BuildSessionSpecifics(int session_index,
64 sync_pb::SessionSpecifics* meta);
65 void BuildWindowSpecifics(int session_index,
66 int window_index,
67 sync_pb::SessionSpecifics* meta);
68 void BuildTabSpecifics(int session_index,
69 int window_index,
70 int tab_index,
71 sync_pb::SessionSpecifics* tab_base);
72 void VerifyExport(sync_driver::OpenTabsUIDelegate* delegate);
74 struct TabInfo;
75 struct WindowInfo;
76 struct SessionInfo;
78 std::vector<SessionInfo> sessions_;
79 base::Time start_time_;
81 int max_tab_node_id_;
83 DISALLOW_COPY_AND_ASSIGN(RecentTabsBuilderTestHelper);
86 #endif // CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_BUILDER_TEST_HELPER_H_