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

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

Issue 6354005: Remove action_max_timeout_ms and fix all the callers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 11 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/ui/tests/browser_uitest.cc ('k') | chrome/renderer/external_extension_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) 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 "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/test/test_timeouts.h"
7 #include "chrome/browser/net/url_request_mock_http_job.h" 8 #include "chrome/browser/net/url_request_mock_http_job.h"
8 #include "chrome/browser/ui/view_ids.h" 9 #include "chrome/browser/ui/view_ids.h"
9 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
10 #include "chrome/test/automation/browser_proxy.h" 11 #include "chrome/test/automation/browser_proxy.h"
11 #include "chrome/test/automation/tab_proxy.h" 12 #include "chrome/test/automation/tab_proxy.h"
12 #include "chrome/test/automation/window_proxy.h" 13 #include "chrome/test/automation/window_proxy.h"
13 #include "chrome/test/ui/ui_test.h" 14 #include "chrome/test/ui/ui_test.h"
14 #include "net/url_request/url_request_unittest.h" 15 #include "net/url_request/url_request_unittest.h"
15 #include "views/event.h" 16 #include "views/event.h"
16 17
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 if (strcmp(test_info->name(), 98 if (strcmp(test_info->name(),
98 "BrowserCloseTabWhenOtherTabHasListener") == 0) { 99 "BrowserCloseTabWhenOtherTabHasListener") == 0) {
99 launch_arguments_.AppendSwitch(switches::kDisablePopupBlocking); 100 launch_arguments_.AppendSwitch(switches::kDisablePopupBlocking);
100 } 101 }
101 102
102 UITest::SetUp(); 103 UITest::SetUp();
103 } 104 }
104 105
105 void WaitForBrowserClosed() { 106 void WaitForBrowserClosed() {
106 const int kCheckDelayMs = 100; 107 const int kCheckDelayMs = 100;
107 for (int max_wait_time = action_max_timeout_ms(); 108 for (int max_wait_time = TestTimeouts::action_max_timeout_ms();
108 max_wait_time > 0; max_wait_time -= kCheckDelayMs) { 109 max_wait_time > 0; max_wait_time -= kCheckDelayMs) {
109 CrashAwareSleep(kCheckDelayMs); 110 CrashAwareSleep(kCheckDelayMs);
110 if (!IsBrowserRunning()) 111 if (!IsBrowserRunning())
111 break; 112 break;
112 } 113 }
113 114
114 EXPECT_FALSE(IsBrowserRunning()); 115 EXPECT_FALSE(IsBrowserRunning());
115 } 116 }
116 117
117 void CheckTitle(const std::wstring& expected_title) { 118 void CheckTitle(const std::wstring& expected_title) {
118 const int kCheckDelayMs = 100; 119 const int kCheckDelayMs = 100;
119 for (int max_wait_time = action_max_timeout_ms(); 120 for (int max_wait_time = TestTimeouts::action_max_timeout_ms();
120 max_wait_time > 0; max_wait_time -= kCheckDelayMs) { 121 max_wait_time > 0; max_wait_time -= kCheckDelayMs) {
121 CrashAwareSleep(kCheckDelayMs); 122 CrashAwareSleep(kCheckDelayMs);
122 if (expected_title == GetActiveTabTitle()) 123 if (expected_title == GetActiveTabTitle())
123 break; 124 break;
124 } 125 }
125 126
126 EXPECT_EQ(expected_title, GetActiveTabTitle()); 127 EXPECT_EQ(expected_title, GetActiveTabTitle());
127 } 128 }
128 129
129 void NavigateToDataURL(const std::string& html_content, 130 void NavigateToDataURL(const std::string& html_content,
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); 450 ASSERT_TRUE(browser->WaitForTabCountToBecome(1));
450 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); 451 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab());
451 ASSERT_TRUE(main_tab.get()); 452 ASSERT_TRUE(main_tab.get());
452 std::wstring main_title; 453 std::wstring main_title;
453 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); 454 EXPECT_TRUE(main_tab->GetTabTitle(&main_title));
454 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); 455 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title);
455 } 456 }
456 457
457 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs 458 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs
458 // and multiple windows. 459 // and multiple windows.
OLDNEW
« no previous file with comments | « chrome/browser/ui/tests/browser_uitest.cc ('k') | chrome/renderer/external_extension_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698