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

Unified Diff: chrome/browser/unload_uitest.cc

Issue 99008: Port unload_uitest.cc and enable some of the tests on linux.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process_util_posix.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/unload_uitest.cc
===================================================================
--- chrome/browser/unload_uitest.cc (revision 14443)
+++ chrome/browser/unload_uitest.cc (working copy)
@@ -3,12 +3,12 @@
// found in the LICENSE file.
#include "base/file_util.h"
-
+#include "base/platform_thread.h"
#include "chrome/browser/automation/url_request_mock_http_job.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/message_box_flags.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/ui/ui_test.h"
-#include "chrome/views/window/dialog_delegate.h"
#include "net/url_request/url_request_unittest.h"
const std::string NOLISTENERS_HTML =
@@ -78,7 +78,7 @@
int max_wait_time = 5000;
while (max_wait_time > 0) {
max_wait_time -= kCheckDelayMs;
- Sleep(kCheckDelayMs);
+ PlatformThread::Sleep(kCheckDelayMs);
if (!IsBrowserRunning())
break;
}
@@ -89,7 +89,7 @@
int max_wait_time = 5000;
while (max_wait_time > 0) {
max_wait_time -= kCheckDelayMs;
- Sleep(kCheckDelayMs);
+ PlatformThread::Sleep(kCheckDelayMs);
if (expected_title == GetActiveTabTitle())
break;
}
@@ -118,10 +118,10 @@
void NavigateToNolistenersFileTwiceAsync() {
// TODO(ojan): We hit a DCHECK in RenderViewHost::OnMsgShouldCloseACK
// if we don't sleep here.
- Sleep(400);
+ PlatformThread::Sleep(400);
NavigateToURLAsync(
URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
- Sleep(400);
+ PlatformThread::Sleep(400);
NavigateToURL(
URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
@@ -137,17 +137,26 @@
}
void ClickModalDialogButton(MessageBoxFlags::DialogButton button) {
+#if defined(OS_WIN)
bool modal_dialog_showing = false;
MessageBoxFlags::DialogButton available_buttons;
EXPECT_TRUE(automation()->WaitForAppModalDialog(3000));
EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing,
&available_buttons));
ASSERT_TRUE(modal_dialog_showing);
- EXPECT_TRUE((button & available_buttons) != NULL);
+ EXPECT_TRUE((button & available_buttons) != 0);
EXPECT_TRUE(automation()->ClickAppModalDialogButton(button));
+#else
+ // TODO(port): port this function if and when the tests that use it are
+ // enabled (currently they are not being run even on windows).
+ NOTIMPLEMENTED();
+#endif
}
};
+// TODO(port): these tests fail on linux because they leave a renderer process
+// lying around which holds onto the user data directory.
+#if defined(OS_WIN)
// Navigate to a page with an infinite unload handler.
// Then two two async crosssite requests to ensure
// we don't get confused and think we're closing the tab.
@@ -203,6 +212,7 @@
NavigateToNolistenersFileTwice();
ASSERT_TRUE(IsBrowserRunning());
}
+#endif
// Tests closing the browser on a page with no unload listeners registered.
TEST_F(UnloadTest, BrowserCloseNoUnloadListeners) {
« no previous file with comments | « base/process_util_posix.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698