OLD | NEW |
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/net/url_request_mock_http_job.h" | 8 #include "chrome/browser/net/url_request_mock_http_job.h" |
9 #include "chrome/browser/view_ids.h" | 9 #include "chrome/browser/view_ids.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 if (strcmp(test_info->name(), | 98 if (strcmp(test_info->name(), |
99 "BrowserCloseTabWhenOtherTabHasListener") == 0) { | 99 "BrowserCloseTabWhenOtherTabHasListener") == 0) { |
100 launch_arguments_.AppendSwitch(switches::kDisablePopupBlocking); | 100 launch_arguments_.AppendSwitch(switches::kDisablePopupBlocking); |
101 } | 101 } |
102 | 102 |
103 UITest::SetUp(); | 103 UITest::SetUp(); |
104 } | 104 } |
105 | 105 |
106 void WaitForBrowserClosed() { | 106 void WaitForBrowserClosed() { |
107 const int kCheckDelayMs = 100; | 107 const int kCheckDelayMs = 100; |
108 int max_wait_time = 5000; | 108 int max_wait_time = action_max_timeout_ms(); |
109 while (max_wait_time > 0) { | 109 while (max_wait_time > 0) { |
110 max_wait_time -= kCheckDelayMs; | 110 max_wait_time -= kCheckDelayMs; |
111 PlatformThread::Sleep(kCheckDelayMs); | 111 PlatformThread::Sleep(kCheckDelayMs); |
112 if (!IsBrowserRunning()) | 112 if (!IsBrowserRunning()) |
113 break; | 113 break; |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 void CheckTitle(const std::wstring& expected_title) { | 117 void CheckTitle(const std::wstring& expected_title) { |
118 const int kCheckDelayMs = 100; | 118 const int kCheckDelayMs = 100; |
119 int max_wait_time = 5000; | 119 int max_wait_time = action_max_timeout_ms(); |
120 while (max_wait_time > 0) { | 120 while (max_wait_time > 0) { |
121 max_wait_time -= kCheckDelayMs; | 121 max_wait_time -= kCheckDelayMs; |
122 PlatformThread::Sleep(kCheckDelayMs); | 122 PlatformThread::Sleep(kCheckDelayMs); |
123 if (expected_title == GetActiveTabTitle()) | 123 if (expected_title == GetActiveTabTitle()) |
124 break; | 124 break; |
125 } | 125 } |
126 | 126 |
127 EXPECT_EQ(expected_title, GetActiveTabTitle()); | 127 EXPECT_EQ(expected_title, GetActiveTabTitle()); |
128 } | 128 } |
129 | 129 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 scoped_refptr<TabProxy> main_tab(main_browser_proxy->GetActiveTab()); | 430 scoped_refptr<TabProxy> main_tab(main_browser_proxy->GetActiveTab()); |
431 ASSERT_TRUE(main_tab.get()); | 431 ASSERT_TRUE(main_tab.get()); |
432 std::wstring main_title; | 432 std::wstring main_title; |
433 ASSERT_TRUE(main_tab.get() != NULL); | 433 ASSERT_TRUE(main_tab.get() != NULL); |
434 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); | 434 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); |
435 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); | 435 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); |
436 } | 436 } |
437 | 437 |
438 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 438 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
439 // and multiple windows. | 439 // and multiple windows. |
OLD | NEW |