1 // Copyright (c) 2012 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 // TODO(jamescook): Why does this test run on all Aura platforms, instead of
6 // only Chrome OS or Ash?
9 #include "chrome/browser/sessions/persistent_tab_restore_service.h"
11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/sessions/tab_restore_service_factory.h"
14 #include "chrome/browser/ui/browser_window.h"
15 #include "chrome/test/base/in_process_browser_test.h"
16 #include "content/public/browser/notification_source.h"
17 #include "content/public/browser/notification_types.h"
18 #include "content/public/test/test_utils.h"
19 #include "testing/gtest/include/gtest/gtest.h"
21 typedef TabRestoreService::Window Window
;
23 typedef InProcessBrowserTest PersistentTabRestoreServiceBrowserTest
;
25 IN_PROC_BROWSER_TEST_F(PersistentTabRestoreServiceBrowserTest
, RestoreApp
) {
26 Profile
* profile
= browser()->profile();
27 TabRestoreService
* trs
= TabRestoreServiceFactory::GetForProfile(profile
);
28 const char* app_name
= "TestApp";
30 Browser
* app_browser
= CreateBrowserForApp(app_name
, profile
);
31 app_browser
->window()->Close();
32 content::WindowedNotificationObserver
observer(
33 chrome::NOTIFICATION_BROWSER_CLOSED
,
34 content::Source
<Browser
>(app_browser
));
37 // One entry should be created.
38 ASSERT_EQ(1U, trs
->entries().size());
39 const TabRestoreService::Entry
* restored_entry
= trs
->entries().front();
41 // It should be a window with an app.
42 ASSERT_EQ(TabRestoreService::WINDOW
, restored_entry
->type
);
43 const Window
* restored_window
=
44 static_cast<const Window
*>(restored_entry
);
45 EXPECT_EQ(app_name
, restored_window
->app_name
);
48 #endif // defined(USE_AURA)