Fixing build: GetViewContainer changed name from under me. :)
[chromium-blink-merge.git] / chrome / browser / session_service_test_helper.h
blob80b9bb4eb31c7abef9f7a1c04d9181e121102b0f
1 // Copyright (c) 2006-2008 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_SESSION_SERVICE_TEST_HELPER_H__
6 #define CHROME_BROWSER_SESSION_SERVICE_TEST_HELPER_H__
8 #include <vector>
10 #include "base/ref_counted.h"
12 class SessionBackend;
13 class SessionCommand;
14 class SessionID;
15 class SessionService;
16 struct SessionTab;
17 struct SessionWindow;
18 struct TabNavigation;
20 // A simple class that makes writing SessionService related tests easier.
22 class SessionServiceTestHelper {
23 public:
24 explicit SessionServiceTestHelper() {}
26 explicit SessionServiceTestHelper(SessionService* service)
27 : service_(service) {}
29 void RestoreSessionFromCommands(const std::vector<SessionCommand*>& commands,
30 std::vector<SessionWindow*>* valid_windows);
32 void PrepareTabInWindow(const SessionID& window_id,
33 const SessionID& tab_id,
34 int visual_index,
35 bool select);
37 // Reads the contents of the last session.
38 void ReadWindows(std::vector<SessionWindow*>* windows);
40 void AssertTabEquals(SessionID& window_id,
41 SessionID& tab_id,
42 int visual_index,
43 int nav_index,
44 int nav_count,
45 const SessionTab& session_tab);
47 void AssertTabEquals(int visual_index,
48 int nav_index,
49 int nav_count,
50 const SessionTab& session_tab);
52 void AssertNavigationEquals(const TabNavigation& expected,
53 const TabNavigation& actual);
55 void AssertSingleWindowWithSingleTab(
56 const std::vector<SessionWindow*>& windows,
57 int nav_count);
59 void set_service(SessionService* service) { service_ = service; }
60 SessionService* service() { return service_.get(); }
62 SessionBackend* backend();
64 private:
65 scoped_refptr<SessionService> service_;
67 DISALLOW_EVIL_CONSTRUCTORS(SessionServiceTestHelper);
70 #endif // CHROME_BROWSER_SESSION_SERVICE_TEST_HELPER_H__