summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-03 19:59:20 +0000
committerscottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-03 19:59:20 +0000
commit328f2b662cc1fc069c55b6300b9abde16d0b9836 (patch)
treeebd66731a5178a4bf975b18a8f6740eb8aac7ac3
parentace755e41c672f58d34c72503460618037e8344b (diff)
downloadchromium_src-328f2b662cc1fc069c55b6300b9abde16d0b9836.zip
chromium_src-328f2b662cc1fc069c55b6300b9abde16d0b9836.tar.gz
chromium_src-328f2b662cc1fc069c55b6300b9abde16d0b9836.tar.bz2
Re-enable newly de-flaked test.
This test was disabled because it became flaky and eventually continually timed out. After investigation, including being able to repro the original problem in an XP VM, I tracked the problem back to a race condition where the ESC that closes the dialog can sometimes cause that dialog to be closed before the ESC event ACK is sent back, thus the test was hanging until timeout. That is filed as http://code.google.com/p/chromium/issues/detail?id=111269 but it's low priority since it's really a test-only issue (and only for this test AFAICT). This test will still fail on Windows if the browser isn't the front window (there are a number of browser and interactive tests with this issue; see http://code.google.com/p/chromium/issues/detail?id=106498). For this test part of it is that the SendKeyPress on Windows doesn't target a window with the event - the event always goes to the front window, even if that's not the correct place. BUG=94864, 111269 TEST=Crank up a slow XP VM, load up the CPU (I used HeavyLoad), run the test lots (I used a repeat of 100). Before clobber, problem almost right away. After, no problem. Review URL: http://codereview.chromium.org/9310016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120374 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/printing/print_dialog_cloud_uitest.cc37
1 files changed, 22 insertions, 15 deletions
diff --git a/chrome/browser/printing/print_dialog_cloud_uitest.cc b/chrome/browser/printing/print_dialog_cloud_uitest.cc
index 9b405c5..7d38201 100644
--- a/chrome/browser/printing/print_dialog_cloud_uitest.cc
+++ b/chrome/browser/printing/print_dialog_cloud_uitest.cc
@@ -17,6 +17,7 @@
#include "base/values.h"
#include "chrome/browser/printing/cloud_print/cloud_print_url.h"
#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
@@ -218,22 +219,19 @@ class PrintDialogCloudTest : public InProcessBrowserTest {
net::URLRequestJob* PrintDialogCloudTest::Factory(net::URLRequest* request,
const std::string& scheme) {
- if (TestController::GetInstance()->use_delegate())
- request->set_delegate(TestController::GetInstance()->delegate());
if (request &&
(request->url() == TestController::GetInstance()->expected_url())) {
+ if (TestController::GetInstance()->use_delegate())
+ request->set_delegate(TestController::GetInstance()->delegate());
TestController::GetInstance()->set_result(true);
+ return new SimpleTestJob(request);
}
- return new SimpleTestJob(request);
+ return new net::URLRequestTestJob(request,
+ net::URLRequestTestJob::test_headers(),
+ "", true);
}
-#if defined(OS_WIN)
-// http://crbug.com/94864 for OS_WIN issue
-#define MAYBE_HandlersRegistered DISABLED_HandlersRegistered
-#else
-#define MAYBE_HandlersRegistered HandlersRegistered
-#endif
-IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, MAYBE_HandlersRegistered) {
+IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, HandlersRegistered) {
BrowserList::SetLastActive(browser());
ASSERT_TRUE(BrowserList::GetLastActive());
@@ -246,11 +244,20 @@ IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, MAYBE_HandlersRegistered) {
ASSERT_TRUE(TestController::GetInstance()->result());
// Close the dialog before finishing the test.
- ui_test_utils::WindowedNotificationObserver signal(
+ ui_test_utils::WindowedNotificationObserver tab_closed_observer(
content::NOTIFICATION_TAB_CLOSED,
content::NotificationService::AllSources());
- EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE,
- false, false, false, false));
- signal.Wait();
-}
+ // Can't use ui_test_utils::SendKeyPressSync or
+ // ui_test_utils::SendKeyPressAndWait due to a race condition with closing
+ // the window. See http://crbug.com/111269
+ BrowserWindow* window = browser()->window();
+ ASSERT_TRUE(window);
+ gfx::NativeWindow native_window = window->GetNativeHandle();
+ ASSERT_TRUE(native_window);
+ bool key_sent = ui_controls::SendKeyPress(native_window, ui::VKEY_ESCAPE,
+ false, false, false, false);
+ EXPECT_TRUE(key_sent);
+ if (key_sent)
+ tab_closed_observer.Wait();
+}