Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / sessions / session_service_test_helper.h
blob38b9a648788a18df3fd20e2201a4d1e60d4bd7a0
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_SESSIONS_SESSION_SERVICE_TEST_HELPER_H_
6 #define CHROME_BROWSER_SESSIONS_SESSION_SERVICE_TEST_HELPER_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h"
14 #include "components/sessions/session_id.h"
16 class SessionService;
18 namespace base {
19 class RunLoop;
22 namespace sessions {
23 class SerializedNavigationEntry;
24 class SessionCommand;
25 struct SessionTab;
26 struct SessionWindow;
29 // A simple class that makes writing SessionService related tests easier.
31 class SessionServiceTestHelper {
32 public:
33 SessionServiceTestHelper();
34 explicit SessionServiceTestHelper(SessionService* service);
35 ~SessionServiceTestHelper();
37 void PrepareTabInWindow(const SessionID& window_id,
38 const SessionID& tab_id,
39 int visual_index,
40 bool select);
42 void SetTabExtensionAppID(const SessionID& window_id,
43 const SessionID& tab_id,
44 const std::string& extension_app_id);
46 void SetTabUserAgentOverride(const SessionID& window_id,
47 const SessionID& tab_id,
48 const std::string& user_agent_override);
50 void SetForceBrowserNotAliveWithNoWindows(
51 bool force_browser_not_alive_with_no_windows);
53 // Reads the contents of the last session.
54 void ReadWindows(std::vector<sessions::SessionWindow*>* windows,
55 SessionID::id_type* active_window_id);
57 void AssertTabEquals(const SessionID& window_id,
58 const SessionID& tab_id,
59 int visual_index,
60 int nav_index,
61 size_t nav_count,
62 const sessions::SessionTab& session_tab);
64 void AssertTabEquals(int visual_index,
65 int nav_index,
66 size_t nav_count,
67 const sessions::SessionTab& session_tab);
69 void AssertNavigationEquals(
70 const sessions::SerializedNavigationEntry& expected,
71 const sessions::SerializedNavigationEntry& actual);
73 void AssertSingleWindowWithSingleTab(
74 const std::vector<sessions::SessionWindow*>& windows,
75 size_t nav_count);
77 void SetService(SessionService* service);
78 SessionService* ReleaseService();
79 SessionService* service() { return service_.get(); }
81 void RunTaskOnBackendThread(const tracked_objects::Location& from_here,
82 const base::Closure& task);
84 private:
85 scoped_ptr<SessionService> service_;
87 DISALLOW_COPY_AND_ASSIGN(SessionServiceTestHelper);
90 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_TEST_HELPER_H_