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

Side by Side Diff: chrome/browser/printing/print_preview_dialog_controller_browsertest.cc

Issue 2740783003: Revert "Revert of Reland: Switch WindowedNotificationObserver to use base::RunLoop. (patchset #3 id… (Closed)
Patch Set: Fix comment. Created 3 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
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/printing/print_preview_dialog_controller.h" 5 #include "chrome/browser/printing/print_preview_dialog_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // Check a new print preview dialog got created. 259 // Check a new print preview dialog got created.
260 ASSERT_TRUE(preview_dialog); 260 ASSERT_TRUE(preview_dialog);
261 ASSERT_NE(initiator(), preview_dialog); 261 ASSERT_NE(initiator(), preview_dialog);
262 262
263 // Reload the initiator. Make sure reloading destroys the print preview 263 // Reload the initiator. Make sure reloading destroys the print preview
264 // dialog. 264 // dialog.
265 PrintPreviewDialogDestroyedObserver dialog_destroyed_observer(preview_dialog); 265 PrintPreviewDialogDestroyedObserver dialog_destroyed_observer(preview_dialog);
266 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); 266 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB);
267 content::WaitForLoadStop( 267 content::WaitForLoadStop(
268 browser()->tab_strip_model()->GetActiveWebContents()); 268 browser()->tab_strip_model()->GetActiveWebContents());
269 // When Widget::Close is called, a task is posted that will destroy the
270 // widget. Here the widget is closed when the navigation commits. Load stop
271 // may occur right after the commit, before the widget is destroyed.
272 // Execute pending tasks to account for this.
273 base::RunLoop().RunUntilIdle();
269 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); 274 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed());
270 275
271 // Try printing again. 276 // Try printing again.
272 PrintPreview(); 277 PrintPreview();
273 278
274 // Create a preview dialog for the initiator tab. 279 // Create a preview dialog for the initiator tab.
275 WebContents* new_preview_dialog = GetPrintPreviewDialog(); 280 WebContents* new_preview_dialog = GetPrintPreviewDialog();
276 EXPECT_TRUE(new_preview_dialog); 281 EXPECT_TRUE(new_preview_dialog);
277 } 282 }
278 283
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility(); 395 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility();
391 ui_test_utils::NavigateToURL(browser(), GURL("data:text/html,HelloWorld")); 396 ui_test_utils::NavigateToURL(browser(), GURL("data:text/html,HelloWorld"));
392 PrintPreview(); 397 PrintPreview();
393 WebContents* preview_dialog = GetPrintPreviewDialog(); 398 WebContents* preview_dialog = GetPrintPreviewDialog();
394 WaitForAccessibilityTreeToContainNodeWithName(preview_dialog, "HelloWorld"); 399 WaitForAccessibilityTreeToContainNodeWithName(preview_dialog, "HelloWorld");
395 } 400 }
396 401
397 } // namespace 402 } // namespace
398 403
399 #endif // !defined(OS_ANDROID) 404 #endif // !defined(OS_ANDROID)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698