Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / sessions / session_restore_test_helper.cc
blob016d7ae0d416db0141f9a4426c32eae26ef46d15
1 // Copyright 2015 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 #include "chrome/browser/sessions/session_restore_test_helper.h"
7 #include "content/public/test/test_utils.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 SessionRestoreTestHelper::SessionRestoreTestHelper()
11 : restore_notification_seen_(false),
12 loop_is_running_(false),
13 weak_ptr_factory(this) {
14 callback_subscription_ = SessionRestore::RegisterOnSessionRestoredCallback(
15 base::Bind(&SessionRestoreTestHelper::OnSessionRestoreDone,
16 weak_ptr_factory.GetWeakPtr()));
19 SessionRestoreTestHelper::~SessionRestoreTestHelper() {
22 void SessionRestoreTestHelper::Wait() {
23 if (restore_notification_seen_)
24 return;
26 loop_is_running_ = true;
27 message_loop_runner_ = new content::MessageLoopRunner;
28 message_loop_runner_->Run();
29 EXPECT_TRUE(restore_notification_seen_);
32 void SessionRestoreTestHelper::OnSessionRestoreDone(
33 int /* num_tabs_restored */) {
34 restore_notification_seen_ = true;
35 if (!loop_is_running_)
36 return;
38 message_loop_runner_->Quit();
39 loop_is_running_ = false;