OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/printing/print_dialog_cloud.h" | 5 #include "chrome/browser/printing/print_dialog_cloud.h" |
6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" | 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" |
7 | 7 |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 if (TestController::GetInstance()->use_delegate()) | 226 if (TestController::GetInstance()->use_delegate()) |
227 request->set_delegate(TestController::GetInstance()->delegate()); | 227 request->set_delegate(TestController::GetInstance()->delegate()); |
228 TestController::GetInstance()->set_result(true); | 228 TestController::GetInstance()->set_result(true); |
229 return new SimpleTestJob(request); | 229 return new SimpleTestJob(request); |
230 } | 230 } |
231 return new net::URLRequestTestJob(request, | 231 return new net::URLRequestTestJob(request, |
232 net::URLRequestTestJob::test_headers(), | 232 net::URLRequestTestJob::test_headers(), |
233 "", true); | 233 "", true); |
234 } | 234 } |
235 | 235 |
236 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, HandlersRegistered) { | 236 #if defined(OS_WIN) |
| 237 #define MAYBE_HandlersRegistered FLAKY_HandlersRegistered |
| 238 #else |
| 239 #define MAYBE_HandlersRegistered HandlersRegistered |
| 240 #endif |
| 241 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, MAYBE_HandlersRegistered) { |
237 BrowserList::SetLastActive(browser()); | 242 BrowserList::SetLastActive(browser()); |
238 ASSERT_TRUE(BrowserList::GetLastActive()); | 243 ASSERT_TRUE(BrowserList::GetLastActive()); |
239 | 244 |
240 AddTestHandlers(); | 245 AddTestHandlers(); |
241 | 246 |
242 TestController::GetInstance()->set_use_delegate(true); | 247 TestController::GetInstance()->set_use_delegate(true); |
243 | 248 |
244 ui_test_utils::RunMessageLoop(); | 249 ui_test_utils::RunMessageLoop(); |
245 | 250 |
246 ASSERT_TRUE(TestController::GetInstance()->result()); | 251 ASSERT_TRUE(TestController::GetInstance()->result()); |
247 | 252 |
248 // Close the dialog before finishing the test. | 253 // Close the dialog before finishing the test. |
249 ui_test_utils::WindowedNotificationObserver tab_closed_observer( | 254 ui_test_utils::WindowedNotificationObserver tab_closed_observer( |
250 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 255 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
251 content::NotificationService::AllSources()); | 256 content::NotificationService::AllSources()); |
252 | 257 |
253 // Can't use ui_test_utils::SendKeyPressSync or | 258 // Can't use ui_test_utils::SendKeyPressSync or |
254 // ui_test_utils::SendKeyPressAndWait due to a race condition with closing | 259 // ui_test_utils::SendKeyPressAndWait due to a race condition with closing |
255 // the window. See http://crbug.com/111269 | 260 // the window. See http://crbug.com/111269 |
256 BrowserWindow* window = browser()->window(); | 261 BrowserWindow* window = browser()->window(); |
257 ASSERT_TRUE(window); | 262 ASSERT_TRUE(window); |
258 gfx::NativeWindow native_window = window->GetNativeHandle(); | 263 gfx::NativeWindow native_window = window->GetNativeHandle(); |
259 ASSERT_TRUE(native_window); | 264 ASSERT_TRUE(native_window); |
260 bool key_sent = ui_controls::SendKeyPress(native_window, ui::VKEY_ESCAPE, | 265 bool key_sent = ui_controls::SendKeyPress(native_window, ui::VKEY_ESCAPE, |
261 false, false, false, false); | 266 false, false, false, false); |
262 EXPECT_TRUE(key_sent); | 267 EXPECT_TRUE(key_sent); |
263 if (key_sent) | 268 if (key_sent) |
264 tab_closed_observer.Wait(); | 269 tab_closed_observer.Wait(); |
265 } | 270 } |
OLD | NEW |