Chromium Code Reviews

Side by Side Diff: chrome/browser/printing/printing_layout_uitest.cc

Issue 16490: Add FTP unit test in preparation for portable FTP implementation.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 439 matching lines...)
450 if (dialog_window) { 450 if (dialog_window) {
451 LRESULT res = SendMessage(dialog_window, DM_GETDEFID, 0, 0); 451 LRESULT res = SendMessage(dialog_window, DM_GETDEFID, 0, 0);
452 if (!res) 452 if (!res)
453 return; 453 return;
454 EXPECT_EQ(DC_HASDEFID, HIWORD(res)); 454 EXPECT_EQ(DC_HASDEFID, HIWORD(res));
455 WORD print_button_id = LOWORD(res); 455 WORD print_button_id = LOWORD(res);
456 res = SendMessage( 456 res = SendMessage(
457 dialog_window, 457 dialog_window,
458 WM_COMMAND, 458 WM_COMMAND,
459 print_button_id, 459 print_button_id,
460 reinterpret_cast<LPARAM>(GetDlgItem(dialog_window, print_button_id)) ); 460 reinterpret_cast<LPARAM>(GetDlgItem(dialog_window,
461 print_button_id)));
461 // Try again. 462 // Try again.
462 if (res) 463 if (res)
463 return; 464 return;
464 465
465 // Ok it succeeded. 466 // Ok it succeeded.
466 dialog_window_ = dialog_window; 467 dialog_window_ = dialog_window;
467 dialog_was_found_ = true; 468 dialog_was_found_ = true;
468 return; 469 return;
469 } 470 }
470 if (!dialog_was_found_) 471 if (!dialog_was_found_)
(...skipping 20 matching lines...)
491 }; 492 };
492 493
493 } // namespace 494 } // namespace
494 495
495 // This test is disable because it fails. See bug 1353559. 496 // This test is disable because it fails. See bug 1353559.
496 TEST_F(PrintingLayoutTextTest, DISABLED_Complex) { 497 TEST_F(PrintingLayoutTextTest, DISABLED_Complex) {
497 if (IsTestCaseDisabled()) 498 if (IsTestCaseDisabled())
498 return; 499 return;
499 500
500 // Print a document, check its output. 501 // Print a document, check its output.
501 TestServer server(kDocRoot); 502 scoped_refptr<HTTPTestServer> server =
502 NavigateToURL(server.TestServerPage("files/printing/test1.html")); 503 HTTPTestServer::CreateServer(kDocRoot);
504 ASSERT_TRUE(NULL != server.get());
505
506 NavigateToURL(server->TestServerPage("files/printing/test1.html"));
503 PrintNowTab(); 507 PrintNowTab();
504 EXPECT_EQ(0., CompareWithResult(L"test1")); 508 EXPECT_EQ(0., CompareWithResult(L"test1"));
505 } 509 }
506 510
507 struct TestPool { 511 struct TestPool {
508 const wchar_t* source; 512 const wchar_t* source;
509 const wchar_t* result; 513 const wchar_t* result;
510 }; 514 };
511 515
512 const TestPool kTestPool[] = { 516 const TestPool kTestPool[] = {
513 // ImagesB&W 517 // ImagesB&W
514 L"files/printing/test2.html", L"test2", 518 L"files/printing/test2.html", L"test2",
515 // ImagesTransparent 519 // ImagesTransparent
516 L"files/printing/test3.html", L"test3", 520 L"files/printing/test3.html", L"test3",
517 // ImageColor 521 // ImageColor
518 L"files/printing/test4.html", L"test4", 522 L"files/printing/test4.html", L"test4",
519 // TODO(maruel): http://b/1171450 Transparent overlays are drawn opaque 523 // TODO(maruel): http://b/1171450 Transparent overlays are drawn opaque
520 // L"files/printing/test5.html", L"test5", 524 // L"files/printing/test5.html", L"test5",
521 }; 525 };
522 526
523 TEST_F(PrintingLayoutTestHidden, ManyTimes) { 527 TEST_F(PrintingLayoutTestHidden, ManyTimes) {
524 if (IsTestCaseDisabled()) 528 if (IsTestCaseDisabled())
525 return; 529 return;
526 530
527 TestServer server(kDocRoot); 531 scoped_refptr<HTTPTestServer> server =
532 HTTPTestServer::CreateServer(kDocRoot);
533 ASSERT_TRUE(NULL != server.get());
534
528 ASSERT_GT(arraysize(kTestPool), 0u); 535 ASSERT_GT(arraysize(kTestPool), 0u);
529 for (int i = 0; i < arraysize(kTestPool); ++i) { 536 for (int i = 0; i < arraysize(kTestPool); ++i) {
530 if (i) 537 if (i)
531 CleanupDumpDirectory(); 538 CleanupDumpDirectory();
532 const TestPool& test = kTestPool[i % arraysize(kTestPool)]; 539 const TestPool& test = kTestPool[i % arraysize(kTestPool)];
533 NavigateToURL(server.TestServerPageW(test.source)); 540 NavigateToURL(server->TestServerPageW(test.source));
534 PrintNowTab(); 541 PrintNowTab();
535 EXPECT_EQ(0., CompareWithResult(test.result)) << test.result; 542 EXPECT_EQ(0., CompareWithResult(test.result)) << test.result;
536 CleanupDumpDirectory(); 543 CleanupDumpDirectory();
537 PrintNowTab(); 544 PrintNowTab();
538 EXPECT_EQ(0., CompareWithResult(test.result)) << test.result; 545 EXPECT_EQ(0., CompareWithResult(test.result)) << test.result;
539 CleanupDumpDirectory(); 546 CleanupDumpDirectory();
540 PrintNowTab(); 547 PrintNowTab();
541 EXPECT_EQ(0., CompareWithResult(test.result)) << test.result; 548 EXPECT_EQ(0., CompareWithResult(test.result)) << test.result;
542 CleanupDumpDirectory(); 549 CleanupDumpDirectory();
543 PrintNowTab(); 550 PrintNowTab();
544 EXPECT_EQ(0., CompareWithResult(test.result)) << test.result; 551 EXPECT_EQ(0., CompareWithResult(test.result)) << test.result;
545 } 552 }
546 } 553 }
547 554
548 // Prints a popup and immediately closes it. 555 // Prints a popup and immediately closes it.
549 TEST_F(PrintingLayoutTest, DISABLED_Delayed) { 556 TEST_F(PrintingLayoutTest, DISABLED_Delayed) {
550 if (IsTestCaseDisabled()) 557 if (IsTestCaseDisabled())
551 return; 558 return;
552 // TODO(maruel): This test is failing on Windows 2000. I haven't investigated 559 // TODO(maruel): This test is failing on Windows 2000. I haven't investigated
553 // why. 560 // why.
554 if (win_util::GetWinVersion() < win_util::WINVERSION_XP) 561 if (win_util::GetWinVersion() < win_util::WINVERSION_XP)
555 return; 562 return;
556 563
557 TestServer server(kDocRoot); 564 scoped_refptr<HTTPTestServer> server =
565 HTTPTestServer::CreateServer(kDocRoot);
566 ASSERT_TRUE(NULL != server.get());
558 567
559 { 568 {
560 scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); 569 scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
561 ASSERT_TRUE(tab_proxy.get()); 570 ASSERT_TRUE(tab_proxy.get());
562 bool is_timeout = true; 571 bool is_timeout = true;
563 GURL url = server.TestServerPage("files/printing/popup_delayed_print.htm"); 572 GURL url = server->TestServerPage("files/printing/popup_delayed_print.htm");
564 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 573 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
565 tab_proxy->NavigateToURL(url)); 574 tab_proxy->NavigateToURL(url));
566 575
567 576
568 scoped_ptr<base::Thread> worker( 577 scoped_ptr<base::Thread> worker(
569 new base::Thread("PrintingLayoutTest_worker")); 578 new base::Thread("PrintingLayoutTest_worker"));
570 scoped_refptr<DismissTheWindow> dismiss_task = 579 scoped_refptr<DismissTheWindow> dismiss_task =
571 new DismissTheWindow(base::GetProcId(process())); 580 new DismissTheWindow(base::GetProcId(process()));
572 // We need to start the thread to be able to set the timer. 581 // We need to start the thread to be able to set the timer.
573 worker->Start(); 582 worker->Start();
574 worker->message_loop()->PostTask(FROM_HERE, 583 worker->message_loop()->PostTask(FROM_HERE,
575 NewRunnableMethod(dismiss_task.get(), &DismissTheWindow::Start)); 584 NewRunnableMethod(dismiss_task.get(), &DismissTheWindow::Start));
576 585
577 MessageLoop::current()->Run(); 586 MessageLoop::current()->Run();
578 587
579 worker->Stop(); 588 worker->Stop();
580 589
581 // Force a navigation elsewhere to verify that it's fine with it. 590 // Force a navigation elsewhere to verify that it's fine with it.
582 url = server.TestServerPage("files/printing/test1.html"); 591 url = server->TestServerPage("files/printing/test1.html");
583 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 592 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
584 tab_proxy->NavigateToURL(url)); 593 tab_proxy->NavigateToURL(url));
585 } 594 }
586 CloseBrowserAndServer(); 595 CloseBrowserAndServer();
587 596
588 EXPECT_EQ(0., CompareWithResult(L"popup_delayed_print")) 597 EXPECT_EQ(0., CompareWithResult(L"popup_delayed_print"))
589 << L"popup_delayed_print"; 598 << L"popup_delayed_print";
590 } 599 }
591 600
592 // Prints a popup and immediately closes it. 601 // Prints a popup and immediately closes it.
593 TEST_F(PrintingLayoutTest, DISABLED_IFrame) { 602 TEST_F(PrintingLayoutTest, DISABLED_IFrame) {
594 if (IsTestCaseDisabled()) 603 if (IsTestCaseDisabled())
595 return; 604 return;
596 605
597 TestServer server(kDocRoot); 606 scoped_refptr<HTTPTestServer> server =
607 HTTPTestServer::CreateServer(kDocRoot);
608 ASSERT_TRUE(NULL != server.get());
598 609
599 { 610 {
600 scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); 611 scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
601 ASSERT_TRUE(tab_proxy.get()); 612 ASSERT_TRUE(tab_proxy.get());
602 GURL url = server.TestServerPage("files/printing/iframe.htm"); 613 GURL url = server->TestServerPage("files/printing/iframe.htm");
603 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 614 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
604 tab_proxy->NavigateToURL(url)); 615 tab_proxy->NavigateToURL(url));
605 616
606 scoped_ptr<base::Thread> worker( 617 scoped_ptr<base::Thread> worker(
607 new base::Thread("PrintingLayoutTest_worker")); 618 new base::Thread("PrintingLayoutTest_worker"));
608 scoped_refptr<DismissTheWindow> dismiss_task = 619 scoped_refptr<DismissTheWindow> dismiss_task =
609 new DismissTheWindow(base::GetProcId(process())); 620 new DismissTheWindow(base::GetProcId(process()));
610 // We need to start the thread to be able to set the timer. 621 // We need to start the thread to be able to set the timer.
611 worker->Start(); 622 worker->Start();
612 worker->message_loop()->PostTask(FROM_HERE, 623 worker->message_loop()->PostTask(FROM_HERE,
613 NewRunnableMethod(dismiss_task.get(), &DismissTheWindow::Start)); 624 NewRunnableMethod(dismiss_task.get(), &DismissTheWindow::Start));
614 625
615 MessageLoop::current()->Run(); 626 MessageLoop::current()->Run();
616 627
617 worker->Stop(); 628 worker->Stop();
618 629
619 // Force a navigation elsewhere to verify that it's fine with it. 630 // Force a navigation elsewhere to verify that it's fine with it.
620 url = server.TestServerPage("files/printing/test1.html"); 631 url = server->TestServerPage("files/printing/test1.html");
621 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 632 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
622 tab_proxy->NavigateToURL(url)); 633 tab_proxy->NavigateToURL(url));
623 } 634 }
624 CloseBrowserAndServer(); 635 CloseBrowserAndServer();
625 636
626 EXPECT_EQ(0., CompareWithResult(L"iframe")) 637 EXPECT_EQ(0., CompareWithResult(L"iframe"))
627 << L"iframe"; 638 << L"iframe";
628 } 639 }
629 640
OLDNEW
« no previous file with comments | « chrome/browser/login_prompt_uitest.cc ('k') | chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine