OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/oom_priority_manager.h" | 5 #include "chrome/browser/oom_priority_manager.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 class OomPriorityManagerTest : public InProcessBrowserTest { | 15 class OomPriorityManagerTest : public InProcessBrowserTest { |
16 }; | 16 }; |
17 | 17 |
18 IN_PROC_BROWSER_TEST_F(OomPriorityManagerTest, OomPriorityManagerBasics) { | 18 IN_PROC_BROWSER_TEST_F(OomPriorityManagerTest, OomPriorityManagerBasics) { |
19 using namespace ui_test_utils; | 19 using namespace ui_test_utils; |
20 | 20 |
21 // Get three tabs open. Load asynchronously to speed up the test. | 21 // Get three tabs open. Load asynchronously to speed up the test. |
22 WindowedNotificationObserver load1(content::NOTIFICATION_LOAD_STOP, | 22 WindowedNotificationObserver load1(content::NOTIFICATION_LOAD_STOP, |
23 NotificationService::AllSources()); | 23 NotificationService::AllSources()); |
24 OpenURLParams open1(GURL("chrome://about"), GURL(), | 24 OpenURLParams open1(GURL("chrome://about"), GURL(), |
25 CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | 25 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); |
26 browser()->OpenURL(open1); | 26 browser()->OpenURL(open1); |
27 | 27 |
28 WindowedNotificationObserver load2(content::NOTIFICATION_LOAD_STOP, | 28 WindowedNotificationObserver load2(content::NOTIFICATION_LOAD_STOP, |
29 NotificationService::AllSources()); | 29 NotificationService::AllSources()); |
30 OpenURLParams open2(GURL("chrome://credits"), GURL(), | 30 OpenURLParams open2(GURL("chrome://credits"), GURL(), |
31 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED); | 31 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, |
| 32 false); |
32 browser()->OpenURL(open2); | 33 browser()->OpenURL(open2); |
33 | 34 |
34 WindowedNotificationObserver load3(content::NOTIFICATION_LOAD_STOP, | 35 WindowedNotificationObserver load3(content::NOTIFICATION_LOAD_STOP, |
35 NotificationService::AllSources()); | 36 NotificationService::AllSources()); |
36 OpenURLParams open3(GURL("chrome://terms"), GURL(), | 37 OpenURLParams open3(GURL("chrome://terms"), GURL(), |
37 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED); | 38 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, |
| 39 false); |
38 browser()->OpenURL(open3); | 40 browser()->OpenURL(open3); |
39 | 41 |
40 load1.Wait(); | 42 load1.Wait(); |
41 load2.Wait(); | 43 load2.Wait(); |
42 load3.Wait(); | 44 load3.Wait(); |
43 | 45 |
44 EXPECT_EQ(3, browser()->tab_count()); | 46 EXPECT_EQ(3, browser()->tab_count()); |
45 | 47 |
46 // Discard a tab. It should kill the first tab, since it was the oldest | 48 // Discard a tab. It should kill the first tab, since it was the oldest |
47 // and was not selected. | 49 // and was not selected. |
(...skipping 23 matching lines...) Expand all Loading... |
71 WindowedNotificationObserver reload1(content::NOTIFICATION_LOAD_STOP, | 73 WindowedNotificationObserver reload1(content::NOTIFICATION_LOAD_STOP, |
72 NotificationService::AllSources()); | 74 NotificationService::AllSources()); |
73 browser()->SelectNumberedTab(0); | 75 browser()->SelectNumberedTab(0); |
74 reload1.Wait(); | 76 reload1.Wait(); |
75 EXPECT_FALSE(browser()->IsTabDiscarded(0)); | 77 EXPECT_FALSE(browser()->IsTabDiscarded(0)); |
76 EXPECT_TRUE(browser()->IsTabDiscarded(1)); | 78 EXPECT_TRUE(browser()->IsTabDiscarded(1)); |
77 EXPECT_TRUE(browser()->IsTabDiscarded(2)); | 79 EXPECT_TRUE(browser()->IsTabDiscarded(2)); |
78 } | 80 } |
79 | 81 |
80 } // namespace | 82 } // namespace |
OLD | NEW |