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

Side by Side Diff: chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc

Issue 7274033: Fixes race condition that could lead to premature shutdown. When (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove FLAKY_ from test Created 9 years, 5 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/sessions/session_restore.h » ('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) 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/chromeos/tab_closeable_state_watcher.h" 5 #include "chrome/browser/chromeos/tab_closeable_state_watcher.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/tabs/tab_strip_model.h" 9 #include "chrome/browser/tabs/tab_strip_model.h"
10 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" 10 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // Close incognito browser. 240 // Close incognito browser.
241 incognito_browser->CloseWindow(); 241 incognito_browser->CloseWindow();
242 ui_test_utils::RunAllPendingInMessageLoop(); 242 ui_test_utils::RunAllPendingInMessageLoop();
243 EXPECT_EQ(1u, BrowserList::size()); 243 EXPECT_EQ(1u, BrowserList::size());
244 EXPECT_EQ(browser(), *(BrowserList::begin())); 244 EXPECT_EQ(browser(), *(BrowserList::begin()));
245 EXPECT_FALSE(CanCloseTab(browser())); 245 EXPECT_FALSE(CanCloseTab(browser()));
246 } 246 }
247 247
248 // Tests closing an incognito browser - the incognito browser should close, 248 // Tests closing an incognito browser - the incognito browser should close,
249 // and a new normal browser opened with a NewTabPage (which is not closeable). 249 // and a new normal browser opened with a NewTabPage (which is not closeable).
250 // Test is flaky: 250 IN_PROC_BROWSER_TEST_F(TabCloseableStateWatcherTest, CloseIncognitoBrowser) {
251 // EXPECT_EQ(1u, BrowserList::size()) in the "Close incognito browser." block
252 // currently fails in ~13% of all runs. See http://crbug.com/83861
253 IN_PROC_BROWSER_TEST_F(TabCloseableStateWatcherTest,
254 FLAKY_CloseIncognitoBrowser) {
255 NavigateToURL(ntp_url_); 251 NavigateToURL(ntp_url_);
256 252
257 // Open an incognito browser. 253 // Open an incognito browser.
258 Browser* incognito_browser = CreateIncognitoBrowser(); 254 Browser* incognito_browser = CreateIncognitoBrowser();
259 EXPECT_TRUE(incognito_browser->profile()->IsOffTheRecord()); 255 EXPECT_TRUE(incognito_browser->profile()->IsOffTheRecord());
260 EXPECT_EQ(2u, BrowserList::size()); 256 EXPECT_EQ(2u, BrowserList::size());
261 257
262 // Close 1st normal browser. 258 // Close 1st normal browser.
263 browser()->CloseWindow(); 259 browser()->CloseWindow();
264 ui_test_utils::RunAllPendingInMessageLoop(); 260 ui_test_utils::RunAllPendingInMessageLoop();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 AppModalDialog* confirm = ui_test_utils::WaitForAppModalDialog(); 313 AppModalDialog* confirm = ui_test_utils::WaitForAppModalDialog();
318 confirm->native_dialog()->AcceptAppModalDialog(); 314 confirm->native_dialog()->AcceptAppModalDialog();
319 NewTabObserver new_tab_observer(browser()); 315 NewTabObserver new_tab_observer(browser());
320 EXPECT_EQ(1u, BrowserList::size()); 316 EXPECT_EQ(1u, BrowserList::size());
321 EXPECT_EQ(browser(), *(BrowserList::begin())); 317 EXPECT_EQ(browser(), *(BrowserList::begin()));
322 EXPECT_EQ(1, browser()->tab_count()); 318 EXPECT_EQ(1, browser()->tab_count());
323 EXPECT_EQ(ntp_url_, browser()->GetSelectedTabContents()->GetURL()); 319 EXPECT_EQ(ntp_url_, browser()->GetSelectedTabContents()->GetURL());
324 } 320 }
325 321
326 } // namespace chromeos 322 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sessions/session_restore.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698