| 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 #include "chrome/browser/browser_process.h" | 5 #include "chrome/browser/browser_process.h" |
| 6 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 6 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 7 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" | 7 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
| 10 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 10 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 chromeos::OomPriorityManager* oom_priority_manager = | 28 chromeos::OomPriorityManager* oom_priority_manager = |
| 29 g_browser_process->platform_part()->oom_priority_manager(); | 29 g_browser_process->platform_part()->oom_priority_manager(); |
| 30 EXPECT_FALSE(oom_priority_manager->recent_tab_discard()); | 30 EXPECT_FALSE(oom_priority_manager->recent_tab_discard()); |
| 31 | 31 |
| 32 // Get three tabs open. | 32 // Get three tabs open. |
| 33 WindowedNotificationObserver load1( | 33 WindowedNotificationObserver load1( |
| 34 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 34 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 35 content::NotificationService::AllSources()); | 35 content::NotificationService::AllSources()); |
| 36 OpenURLParams open1(GURL(chrome::kChromeUIAboutURL), content::Referrer(), | 36 OpenURLParams open1(GURL(chrome::kChromeUIAboutURL), content::Referrer(), |
| 37 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); | 37 CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false); |
| 38 browser()->OpenURL(open1); | 38 browser()->OpenURL(open1); |
| 39 load1.Wait(); | 39 load1.Wait(); |
| 40 | 40 |
| 41 WindowedNotificationObserver load2( | 41 WindowedNotificationObserver load2( |
| 42 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 42 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 43 content::NotificationService::AllSources()); | 43 content::NotificationService::AllSources()); |
| 44 OpenURLParams open2(GURL(chrome::kChromeUICreditsURL), content::Referrer(), | 44 OpenURLParams open2(GURL(chrome::kChromeUICreditsURL), content::Referrer(), |
| 45 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, | 45 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_TYPED, |
| 46 false); | 46 false); |
| 47 browser()->OpenURL(open2); | 47 browser()->OpenURL(open2); |
| 48 load2.Wait(); | 48 load2.Wait(); |
| 49 | 49 |
| 50 WindowedNotificationObserver load3( | 50 WindowedNotificationObserver load3( |
| 51 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 51 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 52 content::NotificationService::AllSources()); | 52 content::NotificationService::AllSources()); |
| 53 OpenURLParams open3(GURL(chrome::kChromeUITermsURL), content::Referrer(), | 53 OpenURLParams open3(GURL(chrome::kChromeUITermsURL), content::Referrer(), |
| 54 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, | 54 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_TYPED, |
| 55 false); | 55 false); |
| 56 browser()->OpenURL(open3); | 56 browser()->OpenURL(open3); |
| 57 load3.Wait(); | 57 load3.Wait(); |
| 58 | 58 |
| 59 EXPECT_EQ(3, browser()->tab_strip_model()->count()); | 59 EXPECT_EQ(3, browser()->tab_strip_model()->count()); |
| 60 | 60 |
| 61 // Navigate the current (third) tab to a different URL, so we can test | 61 // Navigate the current (third) tab to a different URL, so we can test |
| 62 // back/forward later. | 62 // back/forward later. |
| 63 WindowedNotificationObserver load4( | 63 WindowedNotificationObserver load4( |
| 64 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 64 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 65 content::NotificationService::AllSources()); | 65 content::NotificationService::AllSources()); |
| 66 OpenURLParams open4(GURL(chrome::kChromeUIVersionURL), content::Referrer(), | 66 OpenURLParams open4(GURL(chrome::kChromeUIVersionURL), content::Referrer(), |
| 67 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, | 67 CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, |
| 68 false); | 68 false); |
| 69 browser()->OpenURL(open4); | 69 browser()->OpenURL(open4); |
| 70 load4.Wait(); | 70 load4.Wait(); |
| 71 | 71 |
| 72 // Navigate the third tab again, such that we have three navigation entries. | 72 // Navigate the third tab again, such that we have three navigation entries. |
| 73 WindowedNotificationObserver load5( | 73 WindowedNotificationObserver load5( |
| 74 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 74 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 75 content::NotificationService::AllSources()); | 75 content::NotificationService::AllSources()); |
| 76 OpenURLParams open5(GURL("chrome://dns"), content::Referrer(), | 76 OpenURLParams open5(GURL("chrome://dns"), content::Referrer(), |
| 77 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, | 77 CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, |
| 78 false); | 78 false); |
| 79 browser()->OpenURL(open5); | 79 browser()->OpenURL(open5); |
| 80 load5.Wait(); | 80 load5.Wait(); |
| 81 | 81 |
| 82 EXPECT_EQ(3, browser()->tab_strip_model()->count()); | 82 EXPECT_EQ(3, browser()->tab_strip_model()->count()); |
| 83 | 83 |
| 84 // Discard a tab. It should kill the first tab, since it was the oldest | 84 // Discard a tab. It should kill the first tab, since it was the oldest |
| 85 // and was not selected. | 85 // and was not selected. |
| 86 EXPECT_TRUE(oom_priority_manager->DiscardTab()); | 86 EXPECT_TRUE(oom_priority_manager->DiscardTab()); |
| 87 EXPECT_EQ(3, browser()->tab_strip_model()->count()); | 87 EXPECT_EQ(3, browser()->tab_strip_model()->count()); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 WindowedNotificationObserver back2( | 153 WindowedNotificationObserver back2( |
| 154 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 154 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 155 content::NotificationService::AllSources()); | 155 content::NotificationService::AllSources()); |
| 156 chrome::GoBack(browser(), CURRENT_TAB); | 156 chrome::GoBack(browser(), CURRENT_TAB); |
| 157 back2.Wait(); | 157 back2.Wait(); |
| 158 EXPECT_FALSE(chrome::CanGoBack(browser())); | 158 EXPECT_FALSE(chrome::CanGoBack(browser())); |
| 159 EXPECT_TRUE(chrome::CanGoForward(browser())); | 159 EXPECT_TRUE(chrome::CanGoForward(browser())); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace | 162 } // namespace |
| OLD | NEW |