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

Side by Side Diff: chrome/browser/ui/views/constrained_window_views_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 <memory> 5 #include <memory>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/test/scoped_feature_list.h" 8 #include "base/test/scoped_feature_list.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Finch flag enabled. 204 // Finch flag enabled.
205 base::test::ScopedFeatureList scoped_feature_list; 205 base::test::ScopedFeatureList scoped_feature_list;
206 scoped_feature_list.InitAndEnableFeature(features::kBackspaceGoesBackFeature); 206 scoped_feature_list.InitAndEnableFeature(features::kBackspaceGoesBackFeature);
207 207
208 EXPECT_TRUE(chrome::CanGoBack(browser())); 208 EXPECT_TRUE(chrome::CanGoBack(browser()));
209 EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_BACK, 209 EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_BACK,
210 false, false, false, false)); 210 false, false, false, false));
211 content::RunAllPendingInMessageLoop(); 211 content::RunAllPendingInMessageLoop();
212 content::WaitForLoadStop(web_contents); 212 content::WaitForLoadStop(web_contents);
213 213
214 // When Widget::Close is called, a task is posted that will destroy the
215 // widget. Here the widget is closed when the navigation commits. Load stop
216 // may occur right after the commit, before the widget is destroyed.
217 // Execute pending tasks to account for this.
218 base::RunLoop().RunUntilIdle();
219
214 EXPECT_EQ(nullptr, dialog->GetWidget()); 220 EXPECT_EQ(nullptr, dialog->GetWidget());
215 EXPECT_EQ(original_url, web_contents->GetURL()); 221 EXPECT_EQ(original_url, web_contents->GetURL());
216 } 222 }
217 223
218 // Tests that the dialog closes when the escape key is pressed. 224 // Tests that the dialog closes when the escape key is pressed.
219 IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, ClosesOnEscape) { 225 IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, ClosesOnEscape) {
220 #if defined(OS_WIN) 226 #if defined(OS_WIN)
221 // TODO(msw): The widget is not made NULL on XP. http://crbug.com/177482 227 // TODO(msw): The widget is not made NULL on XP. http://crbug.com/177482
222 if (base::win::GetVersion() < base::win::VERSION_VISTA) 228 if (base::win::GetVersion() < base::win::VERSION_VISTA)
223 return; 229 return;
224 #endif 230 #endif
225 231
226 std::unique_ptr<TestDialog> dialog = 232 std::unique_ptr<TestDialog> dialog =
227 ShowModalDialog(browser()->tab_strip_model()->GetActiveWebContents()); 233 ShowModalDialog(browser()->tab_strip_model()->GetActiveWebContents());
228 EXPECT_TRUE(dialog->GetWidget()->IsVisible()); 234 EXPECT_TRUE(dialog->GetWidget()->IsVisible());
229 EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE, 235 EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE,
230 false, false, false, false)); 236 false, false, false, false));
231 content::RunAllPendingInMessageLoop(); 237 content::RunAllPendingInMessageLoop();
232 EXPECT_EQ(NULL, dialog->GetWidget()); 238 EXPECT_EQ(NULL, dialog->GetWidget());
233 } 239 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/login/login_handler_test_utils.cc ('k') | chrome/browser/ui/views/find_bar_views_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698