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

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

Issue 149281: Sprinkle some defensiveness into the UI tests so that they don't explode if t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « chrome/browser/tab_restore_uitest.cc ('k') | chrome/browser/views/find_bar_win_uitest.cc » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "app/message_box_flags.h" 5 #include "app/message_box_flags.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/platform_thread.h" 7 #include "base/platform_thread.h"
8 #include "chrome/browser/automation/url_request_mock_http_job.h" 8 #include "chrome/browser/automation/url_request_mock_http_job.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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 // TODO(brettw) bug 12913 this test was broken by WebKit merge 42202:44252. 330 // TODO(brettw) bug 12913 this test was broken by WebKit merge 42202:44252.
331 // Apparently popup titles are broken somehow. 331 // Apparently popup titles are broken somehow.
332 332
333 // Tests that if there's a renderer process with two tabs, one of which has an 333 // Tests that if there's a renderer process with two tabs, one of which has an
334 // unload handler, and the other doesn't, the tab that doesn't have an unload 334 // unload handler, and the other doesn't, the tab that doesn't have an unload
335 // handler can be closed. If this test fails, the Close() call will hang. 335 // handler can be closed. If this test fails, the Close() call will hang.
336 TEST_F(UnloadTest, DISABLED_BrowserCloseTabWhenOtherTabHasListener) { 336 TEST_F(UnloadTest, DISABLED_BrowserCloseTabWhenOtherTabHasListener) {
337 NavigateToDataURL(CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER, L"only_one_unload"); 337 NavigateToDataURL(CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER, L"only_one_unload");
338 int window_count; 338 int window_count;
339 automation()->GetBrowserWindowCount(&window_count); 339 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count));
340 ASSERT_EQ(2, window_count); 340 ASSERT_EQ(2, window_count);
341 341
342 scoped_refptr<BrowserProxy> popup_browser_proxy( 342 scoped_refptr<BrowserProxy> popup_browser_proxy(
343 automation()->GetBrowserWindow(1)); 343 automation()->GetBrowserWindow(1));
344 ASSERT_TRUE(popup_browser_proxy.get()); 344 ASSERT_TRUE(popup_browser_proxy.get());
345 int popup_tab_count; 345 int popup_tab_count;
346 EXPECT_TRUE(popup_browser_proxy->GetTabCount(&popup_tab_count)); 346 EXPECT_TRUE(popup_browser_proxy->GetTabCount(&popup_tab_count));
347 EXPECT_EQ(1, popup_tab_count); 347 EXPECT_EQ(1, popup_tab_count);
348 scoped_refptr<TabProxy> popup_tab(popup_browser_proxy->GetActiveTab()); 348 scoped_refptr<TabProxy> popup_tab(popup_browser_proxy->GetActiveTab());
349 ASSERT_TRUE(popup_tab.get());
349 std::wstring popup_title; 350 std::wstring popup_title;
350 ASSERT_TRUE(popup_tab.get() != NULL); 351 ASSERT_TRUE(popup_tab.get() != NULL);
351 EXPECT_TRUE(popup_tab->GetTabTitle(&popup_title)); 352 EXPECT_TRUE(popup_tab->GetTabTitle(&popup_title));
352 EXPECT_EQ(std::wstring(L"popup"), popup_title); 353 EXPECT_EQ(std::wstring(L"popup"), popup_title);
353 EXPECT_TRUE(popup_tab->Close(true)); 354 EXPECT_TRUE(popup_tab->Close(true));
354 355
355 scoped_refptr<BrowserProxy> main_browser_proxy( 356 scoped_refptr<BrowserProxy> main_browser_proxy(
356 automation()->GetBrowserWindow(0)); 357 automation()->GetBrowserWindow(0));
357 ASSERT_TRUE(main_browser_proxy.get()); 358 ASSERT_TRUE(main_browser_proxy.get());
358 int main_tab_count; 359 int main_tab_count;
359 EXPECT_TRUE(main_browser_proxy->GetTabCount(&main_tab_count)); 360 EXPECT_TRUE(main_browser_proxy->GetTabCount(&main_tab_count));
360 EXPECT_EQ(1, main_tab_count); 361 EXPECT_EQ(1, main_tab_count);
361 scoped_refptr<TabProxy> main_tab(main_browser_proxy->GetActiveTab()); 362 scoped_refptr<TabProxy> main_tab(main_browser_proxy->GetActiveTab());
363 ASSERT_TRUE(main_tab.get());
362 std::wstring main_title; 364 std::wstring main_title;
363 ASSERT_TRUE(main_tab.get() != NULL); 365 ASSERT_TRUE(main_tab.get() != NULL);
364 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); 366 EXPECT_TRUE(main_tab->GetTabTitle(&main_title));
365 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); 367 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title);
366 } 368 }
367 369
368 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs 370 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs
369 // and multiple windows. 371 // and multiple windows.
OLDNEW
« no previous file with comments | « chrome/browser/tab_restore_uitest.cc ('k') | chrome/browser/views/find_bar_win_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698