OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 BrowserList::SetLastActive(browser()); | 229 BrowserList::SetLastActive(browser()); |
230 ASSERT_TRUE(BrowserList::GetLastActive()); | 230 ASSERT_TRUE(BrowserList::GetLastActive()); |
231 | 231 |
232 AddTestHandlers(); | 232 AddTestHandlers(); |
233 | 233 |
234 TestController::GetInstance()->set_use_delegate(true); | 234 TestController::GetInstance()->set_use_delegate(true); |
235 | 235 |
236 ui_test_utils::RunMessageLoop(); | 236 ui_test_utils::RunMessageLoop(); |
237 | 237 |
238 ASSERT_TRUE(TestController::GetInstance()->result()); | 238 ASSERT_TRUE(TestController::GetInstance()->result()); |
| 239 |
| 240 // Close the dialog before finishing the test. |
| 241 ui_test_utils::WindowedNotificationObserver signal( |
| 242 content::NOTIFICATION_TAB_CLOSED, NotificationService::AllSources()); |
| 243 EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE, |
| 244 false, false, false, false)); |
| 245 signal.Wait(); |
239 } | 246 } |
240 | 247 |
241 #if defined(OS_CHROMEOS) | 248 #if defined(OS_CHROMEOS) |
242 // Disabled until the extern URL is live so that the Print menu item | 249 // Disabled until the extern URL is live so that the Print menu item |
243 // can be enabled for Chromium OS. | 250 // can be enabled for Chromium OS. |
244 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, DISABLED_DialogGrabbed) { | 251 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, DISABLED_DialogGrabbed) { |
245 BrowserList::SetLastActive(browser()); | 252 BrowserList::SetLastActive(browser()); |
246 ASSERT_TRUE(BrowserList::GetLastActive()); | 253 ASSERT_TRUE(BrowserList::GetLastActive()); |
247 | 254 |
248 AddTestHandlers(); | 255 AddTestHandlers(); |
249 | 256 |
250 // This goes back one step further for the Chrome OS case, to making | 257 // This goes back one step further for the Chrome OS case, to making |
251 // sure 'window.print()' gets to the right place. | 258 // sure 'window.print()' gets to the right place. |
252 ASSERT_TRUE(browser()->GetSelectedTabContents()); | 259 ASSERT_TRUE(browser()->GetSelectedTabContents()); |
253 ASSERT_TRUE(browser()->GetSelectedTabContents()->render_view_host()); | 260 ASSERT_TRUE(browser()->GetSelectedTabContents()->render_view_host()); |
254 | 261 |
255 string16 window_print = ASCIIToUTF16("window.print()"); | 262 string16 window_print = ASCIIToUTF16("window.print()"); |
256 browser()->GetSelectedTabContents()->render_view_host()-> | 263 browser()->GetSelectedTabContents()->render_view_host()-> |
257 ExecuteJavascriptInWebFrame(string16(), window_print); | 264 ExecuteJavascriptInWebFrame(string16(), window_print); |
258 | 265 |
259 ui_test_utils::RunMessageLoop(); | 266 ui_test_utils::RunMessageLoop(); |
260 | 267 |
261 ASSERT_TRUE(TestController::GetInstance()->result()); | 268 ASSERT_TRUE(TestController::GetInstance()->result()); |
262 } | 269 } |
263 #endif | 270 #endif |
OLD | NEW |