OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // TODO(jamescook): Why does this test run on all Aura platforms, instead of | 5 // TODO(jamescook): Why does this test run on all Aura platforms, instead of |
6 // only Chrome OS or Ash? | 6 // only Chrome OS or Ash? |
7 #if defined(USE_AURA) | 7 #if defined(USE_AURA) |
8 | 8 |
9 #include "components/sessions/core/persistent_tab_restore_service.h" | 9 #include "components/sessions/core/persistent_tab_restore_service.h" |
10 | 10 |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 13 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
17 #include "content/public/browser/notification_types.h" | 17 #include "content/public/browser/notification_types.h" |
18 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 typedef TabRestoreService::Window Window; | 21 typedef sessions::TabRestoreService::Window Window; |
22 | 22 |
23 typedef InProcessBrowserTest PersistentTabRestoreServiceBrowserTest; | 23 typedef InProcessBrowserTest PersistentTabRestoreServiceBrowserTest; |
24 | 24 |
25 IN_PROC_BROWSER_TEST_F(PersistentTabRestoreServiceBrowserTest, RestoreApp) { | 25 IN_PROC_BROWSER_TEST_F(PersistentTabRestoreServiceBrowserTest, RestoreApp) { |
26 Profile* profile = browser()->profile(); | 26 Profile* profile = browser()->profile(); |
27 TabRestoreService* trs = TabRestoreServiceFactory::GetForProfile(profile); | 27 sessions::TabRestoreService* trs = |
| 28 TabRestoreServiceFactory::GetForProfile(profile); |
28 const char* app_name = "TestApp"; | 29 const char* app_name = "TestApp"; |
29 | 30 |
30 Browser* app_browser = CreateBrowserForApp(app_name, profile); | 31 Browser* app_browser = CreateBrowserForApp(app_name, profile); |
31 app_browser->window()->Close(); | 32 app_browser->window()->Close(); |
32 content::WindowedNotificationObserver observer( | 33 content::WindowedNotificationObserver observer( |
33 chrome::NOTIFICATION_BROWSER_CLOSED, | 34 chrome::NOTIFICATION_BROWSER_CLOSED, |
34 content::Source<Browser>(app_browser)); | 35 content::Source<Browser>(app_browser)); |
35 observer.Wait(); | 36 observer.Wait(); |
36 | 37 |
37 // One entry should be created. | 38 // One entry should be created. |
38 ASSERT_EQ(1U, trs->entries().size()); | 39 ASSERT_EQ(1U, trs->entries().size()); |
39 const TabRestoreService::Entry* restored_entry = trs->entries().front(); | 40 const sessions::TabRestoreService::Entry* restored_entry = |
| 41 trs->entries().front(); |
40 | 42 |
41 // It should be a window with an app. | 43 // It should be a window with an app. |
42 ASSERT_EQ(TabRestoreService::WINDOW, restored_entry->type); | 44 ASSERT_EQ(sessions::TabRestoreService::WINDOW, restored_entry->type); |
43 const Window* restored_window = | 45 const Window* restored_window = |
44 static_cast<const Window*>(restored_entry); | 46 static_cast<const Window*>(restored_entry); |
45 EXPECT_EQ(app_name, restored_window->app_name); | 47 EXPECT_EQ(app_name, restored_window->app_name); |
46 } | 48 } |
47 | 49 |
48 #endif // defined(USE_AURA) | 50 #endif // defined(USE_AURA) |
OLD | NEW |