Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1028)

Side by Side Diff: chrome/browser/oom_priority_manager_browsertest.cc

Issue 10106011: Fixes FindBar crash. The crash appears to be because if you select a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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/browser/ui/find_bar/find_bar_controller.h"
9 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
10 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
11 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
12 #include "content/public/browser/notification_service.h" 13 #include "content/public/browser/notification_service.h"
13 #include "content/public/browser/notification_types.h" 14 #include "content/public/browser/notification_types.h"
14 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
15 16
16 using content::OpenURLParams; 17 using content::OpenURLParams;
17 18
18 namespace { 19 namespace {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 92
92 // Kill the third tab 93 // Kill the third tab
93 EXPECT_TRUE(g_browser_process->oom_priority_manager()->DiscardTab()); 94 EXPECT_TRUE(g_browser_process->oom_priority_manager()->DiscardTab());
94 EXPECT_TRUE(browser()->IsTabDiscarded(0)); 95 EXPECT_TRUE(browser()->IsTabDiscarded(0));
95 EXPECT_TRUE(browser()->IsTabDiscarded(1)); 96 EXPECT_TRUE(browser()->IsTabDiscarded(1));
96 EXPECT_TRUE(browser()->IsTabDiscarded(2)); 97 EXPECT_TRUE(browser()->IsTabDiscarded(2));
97 98
98 // Running when all tabs are discarded should do nothing. 99 // Running when all tabs are discarded should do nothing.
99 EXPECT_FALSE(g_browser_process->oom_priority_manager()->DiscardTab()); 100 EXPECT_FALSE(g_browser_process->oom_priority_manager()->DiscardTab());
100 101
102 // Force creation of the FindBarController.
103 browser()->GetFindBarController();
104
101 // Select the first tab. It should reload. 105 // Select the first tab. It should reload.
102 WindowedNotificationObserver reload1( 106 WindowedNotificationObserver reload1(
103 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 107 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
104 content::NotificationService::AllSources()); 108 content::NotificationService::AllSources());
105 browser()->SelectNumberedTab(0); 109 browser()->SelectNumberedTab(0);
106 reload1.Wait(); 110 reload1.Wait();
111 // Make sure the FindBarController gets the right TabContentsWrapper.
112 EXPECT_EQ(browser()->GetFindBarController()->tab_contents(),
113 browser()->GetSelectedTabContentsWrapper());
107 EXPECT_EQ(0, browser()->active_index()); 114 EXPECT_EQ(0, browser()->active_index());
108 EXPECT_FALSE(browser()->IsTabDiscarded(0)); 115 EXPECT_FALSE(browser()->IsTabDiscarded(0));
109 EXPECT_TRUE(browser()->IsTabDiscarded(1)); 116 EXPECT_TRUE(browser()->IsTabDiscarded(1));
110 EXPECT_TRUE(browser()->IsTabDiscarded(2)); 117 EXPECT_TRUE(browser()->IsTabDiscarded(2));
111 118
112 // Select the third tab. It should reload. 119 // Select the third tab. It should reload.
113 WindowedNotificationObserver reload2( 120 WindowedNotificationObserver reload2(
114 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 121 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
115 content::NotificationService::AllSources()); 122 content::NotificationService::AllSources());
116 browser()->SelectNumberedTab(2); 123 browser()->SelectNumberedTab(2);
(...skipping 17 matching lines...) Expand all
134 WindowedNotificationObserver back2( 141 WindowedNotificationObserver back2(
135 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 142 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
136 content::NotificationService::AllSources()); 143 content::NotificationService::AllSources());
137 browser()->GoBack(CURRENT_TAB); 144 browser()->GoBack(CURRENT_TAB);
138 back2.Wait(); 145 back2.Wait();
139 EXPECT_FALSE(browser()->CanGoBack()); 146 EXPECT_FALSE(browser()->CanGoBack());
140 EXPECT_TRUE(browser()->CanGoForward()); 147 EXPECT_TRUE(browser()->CanGoForward());
141 } 148 }
142 149
143 } // namespace 150 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698