Chromium Code Reviews| Index: chrome/browser/sessions/session_restore_test_helper.h |
| diff --git a/chrome/browser/sessions/session_restore_test_helper.h b/chrome/browser/sessions/session_restore_test_helper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..68776ab17fdd83e3c32f63b5b0de828f4cce4879 |
| --- /dev/null |
| +++ b/chrome/browser/sessions/session_restore_test_helper.h |
| @@ -0,0 +1,45 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
|
sky
2015/01/26 16:50:01
2015 and no copyright.
Simon Que
2015/01/26 18:40:50
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_TEST_HELPER_H_ |
| +#define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_TEST_HELPER_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/sessions/session_restore.h" |
| + |
| +namespace content { |
| +class MessageLoopRunner; |
| +} |
| + |
| +// This class waits on the SessionRestore notification. It is a replacement for |
| +// content::WindowedNotificationObserver, which uses notification service. This |
| +// class uses the callback-based notification instead. |
| +class SessionRestoreTestHelper { |
| + public: |
| + SessionRestoreTestHelper(); |
|
sky
2015/01/26 16:50:01
Add destructor.
Simon Que
2015/01/26 18:40:49
Why is it necessary?
sky
2015/01/26 20:07:08
So that it doesn't get inlined in all call sites.
|
| + |
| + // Blocks until OnSessionRestore() is called. |
| + void Wait(); |
| + |
| + private: |
| + // Indicates whether a session restore notification has been received. |
| + bool restore_notification_seen_; |
| + |
| + // Indicates whether |message_loop_runner_| is running. |
| + bool loop_is_running_; |
| + |
| + // Loop that runs while waiting for notification callback. |
| + scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
| + |
| + // For automatically unsubscribing from callback-based notifications. |
| + SessionRestore::CallbackSubscription callback_subscription_; |
| + |
| + // Callback for session restore notifications. |
| + void OnSessionRestoreDone(); |
|
sky
2015/01/26 16:50:01
functions before members.
Simon Que
2015/01/26 18:40:50
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(SessionRestoreTestHelper); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_TEST_HELPER_H_ |