Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_TEST_HELPER_H_ | |
| 6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_TEST_HELPER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "chrome/browser/sessions/session_restore.h" | |
| 11 | |
| 12 namespace content { | |
| 13 class MessageLoopRunner; | |
| 14 } | |
| 15 | |
| 16 // This class waits on the SessionRestore notification. It is a replacement for | |
| 17 // content::WindowedNotificationObserver, which uses notification service. This | |
| 18 // class uses the callback-based notification instead. | |
| 19 class SessionRestoreTestHelper { | |
| 20 public: | |
| 21 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.
| |
| 22 | |
| 23 // Blocks until OnSessionRestore() is called. | |
| 24 void Wait(); | |
| 25 | |
| 26 private: | |
| 27 // Indicates whether a session restore notification has been received. | |
| 28 bool restore_notification_seen_; | |
| 29 | |
| 30 // Indicates whether |message_loop_runner_| is running. | |
| 31 bool loop_is_running_; | |
| 32 | |
| 33 // Loop that runs while waiting for notification callback. | |
| 34 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | |
| 35 | |
| 36 // For automatically unsubscribing from callback-based notifications. | |
| 37 SessionRestore::CallbackSubscription callback_subscription_; | |
| 38 | |
| 39 // Callback for session restore notifications. | |
| 40 void OnSessionRestoreDone(); | |
|
sky
2015/01/26 16:50:01
functions before members.
Simon Que
2015/01/26 18:40:50
Done.
| |
| 41 | |
| 42 DISALLOW_COPY_AND_ASSIGN(SessionRestoreTestHelper); | |
| 43 }; | |
| 44 | |
| 45 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_TEST_HELPER_H_ | |
| OLD | NEW |