| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/gfx/gdi_util.h" | 7 #include "base/gfx/gdi_util.h" |
| 8 #include "skia/ext/platform_device.h" | 8 #include "skia/ext/platform_device.h" |
| 9 #include "base/gfx/png_decoder.h" | 9 #include "base/gfx/png_decoder.h" |
| 10 #include "base/gfx/png_encoder.h" | 10 #include "base/gfx/png_encoder.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 UITest::SetUp(); | 212 UITest::SetUp(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 virtual void TearDown() { | 215 virtual void TearDown() { |
| 216 UITest::TearDown(); | 216 UITest::TearDown(); |
| 217 file_util::Delete(emf_path_, true); | 217 file_util::Delete(emf_path_, true); |
| 218 } | 218 } |
| 219 | 219 |
| 220 protected: | 220 protected: |
| 221 void PrintNowTab() { | 221 void PrintNowTab() { |
| 222 scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); | 222 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 223 ASSERT_TRUE(tab_proxy.get()); | 223 ASSERT_TRUE(tab_proxy.get()); |
| 224 if (!tab_proxy.get()) | 224 if (!tab_proxy.get()) |
| 225 return; | 225 return; |
| 226 | 226 |
| 227 ASSERT_TRUE(tab_proxy->PrintNow()); | 227 ASSERT_TRUE(tab_proxy->PrintNow()); |
| 228 } | 228 } |
| 229 | 229 |
| 230 // Finds the dump for the last print job and compares it to the data named | 230 // Finds the dump for the last print job and compares it to the data named |
| 231 // |verification_name|. Compares the saved printed job pixels with the test | 231 // |verification_name|. Compares the saved printed job pixels with the test |
| 232 // data pixels and returns the percentage of different pixels; 0 for success, | 232 // data pixels and returns the percentage of different pixels; 0 for success, |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // TODO(maruel): Reenable it, it causes crashes. | 559 // TODO(maruel): Reenable it, it causes crashes. |
| 560 TEST_F(PrintingLayoutTest, DISABLED_Delayed) { | 560 TEST_F(PrintingLayoutTest, DISABLED_Delayed) { |
| 561 if (IsTestCaseDisabled()) | 561 if (IsTestCaseDisabled()) |
| 562 return; | 562 return; |
| 563 | 563 |
| 564 scoped_refptr<HTTPTestServer> server( | 564 scoped_refptr<HTTPTestServer> server( |
| 565 HTTPTestServer::CreateServer(kDocRoot, NULL)); | 565 HTTPTestServer::CreateServer(kDocRoot, NULL)); |
| 566 ASSERT_TRUE(NULL != server.get()); | 566 ASSERT_TRUE(NULL != server.get()); |
| 567 | 567 |
| 568 { | 568 { |
| 569 scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); | 569 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 570 ASSERT_TRUE(tab_proxy.get()); | 570 ASSERT_TRUE(tab_proxy.get()); |
| 571 bool is_timeout = true; | 571 bool is_timeout = true; |
| 572 GURL url = server->TestServerPage("files/printing/popup_delayed_print.htm"); | 572 GURL url = server->TestServerPage("files/printing/popup_delayed_print.htm"); |
| 573 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, | 573 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
| 574 tab_proxy->NavigateToURL(url)); | 574 tab_proxy->NavigateToURL(url)); |
| 575 | 575 |
| 576 DismissTheWindow dismisser(base::GetProcId(process())); | 576 DismissTheWindow dismisser(base::GetProcId(process())); |
| 577 base::DelegateSimpleThread close_printdlg_thread(&dismisser, | 577 base::DelegateSimpleThread close_printdlg_thread(&dismisser, |
| 578 "close_printdlg_thread"); | 578 "close_printdlg_thread"); |
| 579 close_printdlg_thread.Start(); | 579 close_printdlg_thread.Start(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 594 // TODO(maruel:) http://code.google.com/p/chromium/issues/detail?id=7721 | 594 // TODO(maruel:) http://code.google.com/p/chromium/issues/detail?id=7721 |
| 595 TEST_F(PrintingLayoutTest, DISABLED_IFrame) { | 595 TEST_F(PrintingLayoutTest, DISABLED_IFrame) { |
| 596 if (IsTestCaseDisabled()) | 596 if (IsTestCaseDisabled()) |
| 597 return; | 597 return; |
| 598 | 598 |
| 599 scoped_refptr<HTTPTestServer> server( | 599 scoped_refptr<HTTPTestServer> server( |
| 600 HTTPTestServer::CreateServer(kDocRoot, NULL)); | 600 HTTPTestServer::CreateServer(kDocRoot, NULL)); |
| 601 ASSERT_TRUE(NULL != server.get()); | 601 ASSERT_TRUE(NULL != server.get()); |
| 602 | 602 |
| 603 { | 603 { |
| 604 scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); | 604 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 605 ASSERT_TRUE(tab_proxy.get()); | 605 ASSERT_TRUE(tab_proxy.get()); |
| 606 GURL url = server->TestServerPage("files/printing/iframe.htm"); | 606 GURL url = server->TestServerPage("files/printing/iframe.htm"); |
| 607 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, | 607 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
| 608 tab_proxy->NavigateToURL(url)); | 608 tab_proxy->NavigateToURL(url)); |
| 609 | 609 |
| 610 DismissTheWindow dismisser(base::GetProcId(process())); | 610 DismissTheWindow dismisser(base::GetProcId(process())); |
| 611 base::DelegateSimpleThread close_printdlg_thread(&dismisser, | 611 base::DelegateSimpleThread close_printdlg_thread(&dismisser, |
| 612 "close_printdlg_thread"); | 612 "close_printdlg_thread"); |
| 613 close_printdlg_thread.Start(); | 613 close_printdlg_thread.Start(); |
| 614 close_printdlg_thread.Join(); | 614 close_printdlg_thread.Join(); |
| 615 | 615 |
| 616 // Force a navigation elsewhere to verify that it's fine with it. | 616 // Force a navigation elsewhere to verify that it's fine with it. |
| 617 url = server->TestServerPage("files/printing/test1.html"); | 617 url = server->TestServerPage("files/printing/test1.html"); |
| 618 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, | 618 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
| 619 tab_proxy->NavigateToURL(url)); | 619 tab_proxy->NavigateToURL(url)); |
| 620 } | 620 } |
| 621 CloseBrowserAndServer(); | 621 CloseBrowserAndServer(); |
| 622 | 622 |
| 623 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; | 623 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; |
| 624 } | 624 } |
| OLD | NEW |