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

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

Issue 6544015: Call method CheckTitle to verify title of the active tab.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | no next file » | 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/test/test_timeouts.h" 6 #include "base/test/test_timeouts.h"
7 #include "chrome/browser/net/url_request_mock_http_job.h" 7 #include "chrome/browser/net/url_request_mock_http_job.h"
8 #include "chrome/browser/ui/view_ids.h" 8 #include "chrome/browser/ui/view_ids.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/test/automation/browser_proxy.h" 10 #include "chrome/test/automation/browser_proxy.h"
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 407
408 #if defined(OS_MACOSX) 408 #if defined(OS_MACOSX)
409 // http://crbug.com/45162 409 // http://crbug.com/45162
410 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \ 410 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \
411 DISABLED_BrowserCloseTabWhenOtherTabHasListener 411 DISABLED_BrowserCloseTabWhenOtherTabHasListener
412 #elif defined(OS_WIN) 412 #elif defined(OS_WIN)
413 // http://crbug.com/45281 413 // http://crbug.com/45281
414 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \ 414 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \
415 DISABLED_BrowserCloseTabWhenOtherTabHasListener 415 DISABLED_BrowserCloseTabWhenOtherTabHasListener
416 #else 416 #else
417 // Flaky on Linux under valgrind. http://crbug.com/46781
418 // TODO(stuartmorgan): Switch to just disabling for valgrind.
419 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \ 417 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \
420 FLAKY_BrowserCloseTabWhenOtherTabHasListener 418 BrowserCloseTabWhenOtherTabHasListener
421 #endif 419 #endif
422 420
423 // Tests that if there's a renderer process with two tabs, one of which has an 421 // Tests that if there's a renderer process with two tabs, one of which has an
424 // unload handler, and the other doesn't, the tab that doesn't have an unload 422 // unload handler, and the other doesn't, the tab that doesn't have an unload
425 // handler can be closed. 423 // handler can be closed.
426 TEST_F(UnloadTest, MAYBE_BrowserCloseTabWhenOtherTabHasListener) { 424 TEST_F(UnloadTest, MAYBE_BrowserCloseTabWhenOtherTabHasListener) {
427 NavigateToDataURL(CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER, L"only_one_unload"); 425 NavigateToDataURL(CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER, L"only_one_unload");
428 426
429 scoped_refptr<BrowserProxy> browser = automation()->GetBrowserWindow(0); 427 scoped_refptr<BrowserProxy> browser = automation()->GetBrowserWindow(0);
430 ASSERT_TRUE(browser.get()); 428 ASSERT_TRUE(browser.get());
431 scoped_refptr<WindowProxy> window = browser->GetWindow(); 429 scoped_refptr<WindowProxy> window = browser->GetWindow();
432 ASSERT_TRUE(window.get()); 430 ASSERT_TRUE(window.get());
433 431
434 gfx::Rect tab_view_bounds; 432 gfx::Rect tab_view_bounds;
435 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, 433 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER,
436 &tab_view_bounds, true)); 434 &tab_view_bounds, true));
437 // Simulate a click to force user_gesture to true; if we don't, the resulting 435 // Simulate a click to force user_gesture to true; if we don't, the resulting
438 // popup will be constrained, which isn't what we want to test. 436 // popup will be constrained, which isn't what we want to test.
439 ASSERT_TRUE(window->SimulateOSClick(tab_view_bounds.CenterPoint(), 437 ASSERT_TRUE(window->SimulateOSClick(tab_view_bounds.CenterPoint(),
440 ui::EF_LEFT_BUTTON_DOWN)); 438 ui::EF_LEFT_BUTTON_DOWN));
441 ASSERT_TRUE(browser->WaitForTabCountToBecome(2)); 439 ASSERT_TRUE(browser->WaitForTabCountToBecome(2));
442 440
441 CheckTitle(L"popup");
443 scoped_refptr<TabProxy> popup_tab(browser->GetActiveTab()); 442 scoped_refptr<TabProxy> popup_tab(browser->GetActiveTab());
444 ASSERT_TRUE(popup_tab.get()); 443 ASSERT_TRUE(popup_tab.get());
445 std::wstring popup_title;
446 EXPECT_TRUE(popup_tab->GetTabTitle(&popup_title));
447 EXPECT_EQ(std::wstring(L"popup"), popup_title);
448 EXPECT_TRUE(popup_tab->Close(true)); 444 EXPECT_TRUE(popup_tab->Close(true));
449 445
450 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); 446 ASSERT_TRUE(browser->WaitForTabCountToBecome(1));
451 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); 447 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab());
452 ASSERT_TRUE(main_tab.get()); 448 ASSERT_TRUE(main_tab.get());
453 std::wstring main_title; 449 std::wstring main_title;
454 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); 450 EXPECT_TRUE(main_tab->GetTabTitle(&main_title));
455 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); 451 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title);
456 } 452 }
457 453
458 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs 454 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs
459 // and multiple windows. 455 // and multiple windows.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698