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

Side by Side Diff: trunk/src/chrome/browser/ui/views/constrained_window_views_browsertest.cc

Issue 13966012: Revert 195553 "Allow showing pending URL for new tab navigations..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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
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 "base/memory/weak_ptr.h" 5 #include "base/memory/weak_ptr.h"
6 #include "chrome/browser/platform_util.h" 6 #include "chrome/browser/platform_util.h"
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.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/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
11 #include "chrome/browser/ui/views/constrained_window_views.h" 11 #include "chrome/browser/ui/views/constrained_window_views.h"
12 #include "chrome/browser/ui/views/frame/browser_view.h" 12 #include "chrome/browser/ui/views/frame/browser_view.h"
13 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" 13 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
14 #include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h" 14 #include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h"
15 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" 15 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
16 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
17 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
18 #include "chrome/test/base/ui_test_utils.h" 18 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/public/browser/native_web_keyboard_event.h" 19 #include "content/public/browser/native_web_keyboard_event.h"
20 #include "content/public/browser/navigation_controller.h"
21 #include "content/public/browser/render_view_host.h" 20 #include "content/public/browser/render_view_host.h"
22 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
23 #include "content/public/browser/web_contents_view.h" 22 #include "content/public/browser/web_contents_view.h"
24 #include "ipc/ipc_message.h" 23 #include "ipc/ipc_message.h"
25 #include "ui/base/accelerators/accelerator.h" 24 #include "ui/base/accelerators/accelerator.h"
26 #include "ui/views/controls/textfield/textfield.h" 25 #include "ui/views/controls/textfield/textfield.h"
27 #include "ui/views/focus/focus_manager.h" 26 #include "ui/views/focus/focus_manager.h"
28 #include "ui/views/layout/fill_layout.h" 27 #include "ui/views/layout/fill_layout.h"
29 #include "ui/views/test/test_widget_observer.h" 28 #include "ui/views/test/test_widget_observer.h"
30 #include "ui/views/window/dialog_delegate.h" 29 #include "ui/views/window/dialog_delegate.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 ui_test_utils::NavigateToURL(browser(), new_tab_url); 322 ui_test_utils::NavigateToURL(browser(), new_tab_url);
324 GURL about_url(chrome::kChromeUIAboutURL); 323 GURL about_url(chrome::kChromeUIAboutURL);
325 ui_test_utils::NavigateToURL(browser(), about_url); 324 ui_test_utils::NavigateToURL(browser(), about_url);
326 325
327 ConstrainedWebDialogDelegate* cwdd = CreateConstrainedWebDialog( 326 ConstrainedWebDialogDelegate* cwdd = CreateConstrainedWebDialog(
328 browser()->profile(), 327 browser()->profile(),
329 new ui::test::TestWebDialogDelegate(about_url), 328 new ui::test::TestWebDialogDelegate(about_url),
330 NULL, 329 NULL,
331 web_contents); 330 web_contents);
332 331
333 content::WindowedNotificationObserver back_observer(
334 content::NOTIFICATION_LOAD_STOP,
335 content::Source<content::NavigationController>(
336 &web_contents->GetController()));
337 content::RenderViewHost* render_view_host = 332 content::RenderViewHost* render_view_host =
338 cwdd->GetWebContents()->GetRenderViewHost(); 333 cwdd->GetWebContents()->GetRenderViewHost();
339 ForwardKeyEvent(render_view_host, ui::VKEY_BACK); 334 ForwardKeyEvent(render_view_host, ui::VKEY_BACK);
340 335
341 // Backspace is not processed as accelerator before it's sent to web contents. 336 // Backspace is not processed as accelerator before it's sent to web contents.
342 EXPECT_FALSE(web_contents->GetController().GetPendingEntry());
343 EXPECT_EQ(about_url.spec(), web_contents->GetURL().spec()); 337 EXPECT_EQ(about_url.spec(), web_contents->GetURL().spec());
344 338
339 content::RunAllPendingInMessageLoop();
340
345 // Backspace is processed as accelerator after it's sent to web contents. 341 // Backspace is processed as accelerator after it's sent to web contents.
346 content::RunAllPendingInMessageLoop();
347 EXPECT_TRUE(web_contents->GetController().GetPendingEntry());
348
349 // Wait for the navigation to commit, since the URL will not be visible
350 // until then.
351 back_observer.Wait();
352 EXPECT_EQ(new_tab_url.spec(), web_contents->GetURL().spec()); 342 EXPECT_EQ(new_tab_url.spec(), web_contents->GetURL().spec());
353 } 343 }
354 344
355 // Fails flakily (once per 10-20 runs) on Win Aura only. http://crbug.com/177482 345 // Fails flakily (once per 10-20 runs) on Win Aura only. http://crbug.com/177482
356 // Also fails on CrOS. 346 // Also fails on CrOS.
357 #if defined(OS_WIN) || defined(OS_CHROMEOS) 347 #if defined(OS_WIN) || defined(OS_CHROMEOS)
358 #define MAYBE_EscapeCloseConstrainedWindow DISABLED_EscapeCloseConstrainedWindow 348 #define MAYBE_EscapeCloseConstrainedWindow DISABLED_EscapeCloseConstrainedWindow
359 #else 349 #else
360 #define MAYBE_EscapeCloseConstrainedWindow EscapeCloseConstrainedWindow 350 #define MAYBE_EscapeCloseConstrainedWindow EscapeCloseConstrainedWindow
361 #endif 351 #endif
(...skipping 24 matching lines...) Expand all
386 // Escape is not processed as accelerator before it's sent to web contents. 376 // Escape is not processed as accelerator before it's sent to web contents.
387 EXPECT_FALSE(observer.widget_closed()); 377 EXPECT_FALSE(observer.widget_closed());
388 378
389 content::RunAllPendingInMessageLoop(); 379 content::RunAllPendingInMessageLoop();
390 380
391 // Escape is processed as accelerator after it's sent to web contents. 381 // Escape is processed as accelerator after it's sent to web contents.
392 EXPECT_TRUE(observer.widget_closed()); 382 EXPECT_TRUE(observer.widget_closed());
393 } 383 }
394 384
395 #endif // defined(OS_WIN) || (defined(USE_AURA) && defined(USE_X11)) 385 #endif // defined(OS_WIN) || (defined(USE_AURA) && defined(USE_X11))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698