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__
10 #include "base/ref_counted.h"
20 // A simple class that makes writing SessionService related tests easier.
22 class SessionServiceTestHelper
{
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
,
37 // Reads the contents of the last session.
38 void ReadWindows(std::vector
<SessionWindow
*>* windows
);
40 void AssertTabEquals(SessionID
& window_id
,
45 const SessionTab
& session_tab
);
47 void AssertTabEquals(int visual_index
,
50 const SessionTab
& session_tab
);
52 void AssertNavigationEquals(const TabNavigation
& expected
,
53 const TabNavigation
& actual
);
55 void AssertSingleWindowWithSingleTab(
56 const std::vector
<SessionWindow
*>& windows
,
59 void set_service(SessionService
* service
) { service_
= service
; }
60 SessionService
* service() { return service_
.get(); }
62 SessionBackend
* backend();
65 scoped_refptr
<SessionService
> service_
;
67 DISALLOW_EVIL_CONSTRUCTORS(SessionServiceTestHelper
);
70 #endif // CHROME_BROWSER_SESSION_SERVICE_TEST_HELPER_H__