OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/apps/app_browsertest_util.h" | 5 #include "chrome/browser/apps/app_browsertest_util.h" |
6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
7 #include "chrome/browser/extensions/extension_test_message_listener.h" | 7 #include "chrome/browser/extensions/extension_test_message_listener.h" |
8 #include "content/public/browser/notification_service.h" | 8 #include "content/public/browser/notification_service.h" |
9 #include "content/public/test/browser_test.h" | 9 #include "content/public/test/browser_test.h" |
10 #include "content/public/test/test_utils.h" | 10 #include "content/public/test/test_utils.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 ExtensionTestMessageListener launched_listener("launched", false); | 21 ExtensionTestMessageListener launched_listener("launched", false); |
22 const Extension* extension = LoadAndLaunchPlatformApp(app_path); | 22 const Extension* extension = LoadAndLaunchPlatformApp(app_path); |
23 ASSERT_TRUE(extension); | 23 ASSERT_TRUE(extension); |
24 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 24 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
25 | 25 |
26 content::WindowedNotificationObserver event_page_suspended( | 26 content::WindowedNotificationObserver event_page_suspended( |
27 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 27 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
28 content::NotificationService::AllSources()); | 28 content::NotificationService::AllSources()); |
29 | 29 |
30 // Close the app window. | 30 // Close the app window. |
31 EXPECT_EQ(1U, GetShellWindowCount()); | 31 EXPECT_EQ(1U, GetAppWindowCount()); |
32 apps::ShellWindow* shell_window = GetFirstShellWindow(); | 32 apps::AppWindow* app_window = GetFirstAppWindow(); |
33 ASSERT_TRUE(shell_window); | 33 ASSERT_TRUE(app_window); |
34 CloseShellWindow(shell_window); | 34 CloseAppWindow(app_window); |
35 | 35 |
36 // Verify that the event page is destroyed. | 36 // Verify that the event page is destroyed. |
37 event_page_suspended.Wait(); | 37 event_page_suspended.Wait(); |
38 } | 38 } |
39 }; | 39 }; |
40 | 40 |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 // Tests that an app's event page will eventually be unloaded. The onSuspend | 43 // Tests that an app's event page will eventually be unloaded. The onSuspend |
44 // event handler of this app does not make any API calls. | 44 // event handler of this app does not make any API calls. |
45 IN_PROC_BROWSER_TEST_F(AppEventPageTest, OnSuspendNoApiUse) { | 45 IN_PROC_BROWSER_TEST_F(AppEventPageTest, OnSuspendNoApiUse) { |
46 TestUnloadEventPage("event_page/suspend_simple"); | 46 TestUnloadEventPage("event_page/suspend_simple"); |
47 } | 47 } |
48 | 48 |
49 // Tests that an app's event page will eventually be unloaded. The onSuspend | 49 // Tests that an app's event page will eventually be unloaded. The onSuspend |
50 // event handler of this app calls a chrome.storage API function. | 50 // event handler of this app calls a chrome.storage API function. |
51 // See: http://crbug.com/296834 | 51 // See: http://crbug.com/296834 |
52 IN_PROC_BROWSER_TEST_F(AppEventPageTest, OnSuspendUseStorageApi) { | 52 IN_PROC_BROWSER_TEST_F(AppEventPageTest, OnSuspendUseStorageApi) { |
53 TestUnloadEventPage("event_page/suspend_storage_api"); | 53 TestUnloadEventPage("event_page/suspend_storage_api"); |
54 } | 54 } |
OLD | NEW |