| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, MAYBE_HandlersRegistered) { | 242 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, MAYBE_HandlersRegistered) { |
| 243 AddTestHandlers(); | 243 AddTestHandlers(); |
| 244 | 244 |
| 245 TestController::GetInstance()->set_use_delegate(true); | 245 TestController::GetInstance()->set_use_delegate(true); |
| 246 | 246 |
| 247 ui_test_utils::RunMessageLoop(); | 247 ui_test_utils::RunMessageLoop(); |
| 248 | 248 |
| 249 ASSERT_TRUE(TestController::GetInstance()->result()); | 249 ASSERT_TRUE(TestController::GetInstance()->result()); |
| 250 | 250 |
| 251 // Close the dialog before finishing the test. | 251 // Close the dialog before finishing the test. |
| 252 ui_test_utils::WindowedNotificationObserver tab_closed_observer( | 252 content::WindowedNotificationObserver tab_closed_observer( |
| 253 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 253 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 254 content::NotificationService::AllSources()); | 254 content::NotificationService::AllSources()); |
| 255 | 255 |
| 256 // Can't use ui_test_utils::SendKeyPressSync or | 256 // Can't use ui_test_utils::SendKeyPressSync or |
| 257 // ui_test_utils::SendKeyPressAndWait due to a race condition with closing | 257 // ui_test_utils::SendKeyPressAndWait due to a race condition with closing |
| 258 // the window. See http://crbug.com/111269 | 258 // the window. See http://crbug.com/111269 |
| 259 BrowserWindow* window = browser()->window(); | 259 BrowserWindow* window = browser()->window(); |
| 260 ASSERT_TRUE(window); | 260 ASSERT_TRUE(window); |
| 261 gfx::NativeWindow native_window = window->GetNativeWindow(); | 261 gfx::NativeWindow native_window = window->GetNativeWindow(); |
| 262 ASSERT_TRUE(native_window); | 262 ASSERT_TRUE(native_window); |
| 263 bool key_sent = ui_controls::SendKeyPress(native_window, ui::VKEY_ESCAPE, | 263 bool key_sent = ui_controls::SendKeyPress(native_window, ui::VKEY_ESCAPE, |
| 264 false, false, false, false); | 264 false, false, false, false); |
| 265 EXPECT_TRUE(key_sent); | 265 EXPECT_TRUE(key_sent); |
| 266 if (key_sent) | 266 if (key_sent) |
| 267 tab_closed_observer.Wait(); | 267 tab_closed_observer.Wait(); |
| 268 } | 268 } |
| OLD | NEW |