| 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 "content/public/browser/notification_service.h" | 11 #include "content/public/browser/notification_service.h" |
| 12 #include "content/public/browser/notification_types.h" | 12 #include "content/public/browser/notification_types.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 class OomPriorityManagerTest : public InProcessBrowserTest { | 17 class OomPriorityManagerTest : public InProcessBrowserTest { |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 IN_PROC_BROWSER_TEST_F(OomPriorityManagerTest, OomPriorityManagerBasics) { | 20 IN_PROC_BROWSER_TEST_F(OomPriorityManagerTest, OomPriorityManagerBasics) { |
| 21 using namespace ui_test_utils; | 21 using namespace ui_test_utils; |
| 22 | 22 |
| 23 // Get three tabs open. Load asynchronously to speed up the test. | 23 // Get three tabs open. Load asynchronously to speed up the test. |
| 24 WindowedNotificationObserver load1( | 24 WindowedNotificationObserver load1( |
| 25 content::NOTIFICATION_LOAD_STOP, | 25 content::NOTIFICATION_LOAD_STOP, |
| 26 content::NotificationService::AllSources()); | 26 content::NotificationService::AllSources()); |
| 27 OpenURLParams open1(GURL("chrome://about"), GURL(), | 27 OpenURLParams open1(GURL("chrome://about"), content::Referrer(), |
| 28 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); | 28 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); |
| 29 browser()->OpenURL(open1); | 29 browser()->OpenURL(open1); |
| 30 | 30 |
| 31 WindowedNotificationObserver load2( | 31 WindowedNotificationObserver load2( |
| 32 content::NOTIFICATION_LOAD_STOP, | 32 content::NOTIFICATION_LOAD_STOP, |
| 33 content::NotificationService::AllSources()); | 33 content::NotificationService::AllSources()); |
| 34 OpenURLParams open2(GURL("chrome://credits"), GURL(), | 34 OpenURLParams open2(GURL("chrome://credits"), content::Referrer(), |
| 35 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, | 35 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, |
| 36 false); | 36 false); |
| 37 browser()->OpenURL(open2); | 37 browser()->OpenURL(open2); |
| 38 | 38 |
| 39 WindowedNotificationObserver load3( | 39 WindowedNotificationObserver load3( |
| 40 content::NOTIFICATION_LOAD_STOP, | 40 content::NOTIFICATION_LOAD_STOP, |
| 41 content::NotificationService::AllSources()); | 41 content::NotificationService::AllSources()); |
| 42 OpenURLParams open3(GURL("chrome://terms"), GURL(), | 42 OpenURLParams open3(GURL("chrome://terms"), content::Referrer(), |
| 43 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, | 43 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, |
| 44 false); | 44 false); |
| 45 browser()->OpenURL(open3); | 45 browser()->OpenURL(open3); |
| 46 | 46 |
| 47 load1.Wait(); | 47 load1.Wait(); |
| 48 load2.Wait(); | 48 load2.Wait(); |
| 49 load3.Wait(); | 49 load3.Wait(); |
| 50 | 50 |
| 51 EXPECT_EQ(3, browser()->tab_count()); | 51 EXPECT_EQ(3, browser()->tab_count()); |
| 52 | 52 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 79 content::NOTIFICATION_LOAD_STOP, | 79 content::NOTIFICATION_LOAD_STOP, |
| 80 content::NotificationService::AllSources()); | 80 content::NotificationService::AllSources()); |
| 81 browser()->SelectNumberedTab(0); | 81 browser()->SelectNumberedTab(0); |
| 82 reload1.Wait(); | 82 reload1.Wait(); |
| 83 EXPECT_FALSE(browser()->IsTabDiscarded(0)); | 83 EXPECT_FALSE(browser()->IsTabDiscarded(0)); |
| 84 EXPECT_TRUE(browser()->IsTabDiscarded(1)); | 84 EXPECT_TRUE(browser()->IsTabDiscarded(1)); |
| 85 EXPECT_TRUE(browser()->IsTabDiscarded(2)); | 85 EXPECT_TRUE(browser()->IsTabDiscarded(2)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace | 88 } // namespace |
| OLD | NEW |