Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc

Issue 16268017: GTTF: convert some tests in chrome to use EmbeddedTestServer patch nr 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <list> 5 #include <list>
6 #include <set> 6 #include <set>
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 19 matching lines...) Expand all
30 #include "content/public/browser/render_process_host.h" 30 #include "content/public/browser/render_process_host.h"
31 #include "content/public/browser/render_view_host.h" 31 #include "content/public/browser/render_view_host.h"
32 #include "content/public/browser/resource_controller.h" 32 #include "content/public/browser/resource_controller.h"
33 #include "content/public/browser/resource_dispatcher_host.h" 33 #include "content/public/browser/resource_dispatcher_host.h"
34 #include "content/public/browser/resource_throttle.h" 34 #include "content/public/browser/resource_throttle.h"
35 #include "content/public/browser/web_contents.h" 35 #include "content/public/browser/web_contents.h"
36 #include "content/public/common/context_menu_params.h" 36 #include "content/public/common/context_menu_params.h"
37 #include "content/public/common/url_constants.h" 37 #include "content/public/common/url_constants.h"
38 #include "content/public/test/browser_test_utils.h" 38 #include "content/public/test/browser_test_utils.h"
39 #include "net/dns/mock_host_resolver.h" 39 #include "net/dns/mock_host_resolver.h"
40 #include "net/test/embedded_test_server/embedded_test_server.h"
40 #include "third_party/WebKit/public/web/WebContextMenuData.h" 41 #include "third_party/WebKit/public/web/WebContextMenuData.h"
41 #include "third_party/WebKit/public/web/WebInputEvent.h" 42 #include "third_party/WebKit/public/web/WebInputEvent.h"
42 #include "webkit/glue/resource_type.h" 43 #include "webkit/glue/resource_type.h"
43 44
44 using content::WebContents; 45 using content::WebContents;
45 46
46 namespace extensions { 47 namespace extensions {
47 48
48 namespace { 49 namespace {
49 50
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 new TestContentBrowserClient(test_navigation_listener_.get())); 354 new TestContentBrowserClient(test_navigation_listener_.get()));
354 original_content_browser_client_ = content::SetBrowserClientForTesting( 355 original_content_browser_client_ = content::SetBrowserClientForTesting(
355 content_browser_client_.get()); 356 content_browser_client_.get());
356 357
357 FrameNavigationState::set_allow_extension_scheme(true); 358 FrameNavigationState::set_allow_extension_scheme(true);
358 359
359 CommandLine::ForCurrentProcess()->AppendSwitch( 360 CommandLine::ForCurrentProcess()->AppendSwitch(
360 switches::kAllowLegacyExtensionManifests); 361 switches::kAllowLegacyExtensionManifests);
361 362
362 host_resolver()->AddRule("*", "127.0.0.1"); 363 host_resolver()->AddRule("*", "127.0.0.1");
363 ASSERT_TRUE(StartTestServer());
364 } 364 }
365 365
366 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { 366 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE {
367 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); 367 ExtensionApiTest::TearDownInProcessBrowserTestFixture();
368 content::SetBrowserClientForTesting(original_content_browser_client_); 368 content::SetBrowserClientForTesting(original_content_browser_client_);
369 } 369 }
370 370
371 TestNavigationListener* test_navigation_listener() { 371 TestNavigationListener* test_navigation_listener() {
372 return test_navigation_listener_.get(); 372 return test_navigation_listener_.get();
373 } 373 }
374 374
375 private: 375 private:
376 scoped_refptr<TestNavigationListener> test_navigation_listener_; 376 scoped_refptr<TestNavigationListener> test_navigation_listener_;
377 scoped_ptr<TestContentBrowserClient> content_browser_client_; 377 scoped_ptr<TestContentBrowserClient> content_browser_client_;
378 content::ContentBrowserClient* original_content_browser_client_; 378 content::ContentBrowserClient* original_content_browser_client_;
379 379
380 DISALLOW_COPY_AND_ASSIGN(WebNavigationApiTest); 380 DISALLOW_COPY_AND_ASSIGN(WebNavigationApiTest);
381 }; 381 };
382 382
383 // Fails often on Windows dbg bots. http://crbug.com/177163 383 // Fails often on Windows dbg bots. http://crbug.com/177163
384 #if defined(OS_WIN) 384 #if defined(OS_WIN)
385 #define MAYBE_Api DISABLED_Api 385 #define MAYBE_Api DISABLED_Api
386 #else 386 #else
387 #define MAYBE_Api Api 387 #define MAYBE_Api Api
388 #endif // defined(OS_WIN) 388 #endif // defined(OS_WIN)
389 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_Api) { 389 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_Api) {
390 ASSERT_TRUE(StartEmbeddedTestServer());
390 ASSERT_TRUE( 391 ASSERT_TRUE(
391 RunExtensionSubtest("webnavigation", "test_api.html")) << message_; 392 RunExtensionSubtest("webnavigation", "test_api.html")) << message_;
392 } 393 }
393 394
394 // Fails often on Windows dbg bots. http://crbug.com/177163 395 // Fails often on Windows dbg bots. http://crbug.com/177163
395 #if defined(OS_WIN) 396 #if defined(OS_WIN)
396 #define MAYBE_GetFrame DISABLED_GetFrame 397 #define MAYBE_GetFrame DISABLED_GetFrame
397 #else 398 #else
398 #define MAYBE_GetFrame GetFrame 399 #define MAYBE_GetFrame GetFrame
399 #endif // defined(OS_WIN) 400 #endif // defined(OS_WIN)
400 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_GetFrame) { 401 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_GetFrame) {
402 ASSERT_TRUE(StartEmbeddedTestServer());
401 ASSERT_TRUE( 403 ASSERT_TRUE(
402 RunExtensionSubtest("webnavigation", "test_getFrame.html")) << message_; 404 RunExtensionSubtest("webnavigation", "test_getFrame.html")) << message_;
403 } 405 }
404 406
405 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ClientRedirect) { 407 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ClientRedirect) {
408 ASSERT_TRUE(StartEmbeddedTestServer());
406 ASSERT_TRUE( 409 ASSERT_TRUE(
407 RunExtensionSubtest("webnavigation", "test_clientRedirect.html")) 410 RunExtensionSubtest("webnavigation", "test_clientRedirect.html"))
408 << message_; 411 << message_;
409 } 412 }
410 413
411 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ServerRedirect) { 414 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ServerRedirect) {
415 ASSERT_TRUE(StartEmbeddedTestServer());
412 ASSERT_TRUE( 416 ASSERT_TRUE(
413 RunExtensionSubtest("webnavigation", "test_serverRedirect.html")) 417 RunExtensionSubtest("webnavigation", "test_serverRedirect.html"))
414 << message_; 418 << message_;
415 } 419 }
416 420
417 // http://crbug.com/235171 and http://crbug.com/177163 421 // http://crbug.com/235171 and http://crbug.com/177163
418 #if (defined(OS_WIN) && !defined(NDEBUG)) || \ 422 #if (defined(OS_WIN) && !defined(NDEBUG)) || \
419 (defined(OS_CHROMEOS) || (defined(OS_LINUX) && defined(USE_AURA))) 423 (defined(OS_CHROMEOS) || (defined(OS_LINUX) && defined(USE_AURA)))
420 #define MAYBE_ServerRedirectSingleProcess DISABLED_ServerRedirectSingleProcess 424 #define MAYBE_ServerRedirectSingleProcess DISABLED_ServerRedirectSingleProcess
421 #else 425 #else
422 #define MAYBE_ServerRedirectSingleProcess ServerRedirectSingleProcess 426 #define MAYBE_ServerRedirectSingleProcess ServerRedirectSingleProcess
423 #endif 427 #endif
424 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, 428 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest,
425 MAYBE_ServerRedirectSingleProcess) { 429 MAYBE_ServerRedirectSingleProcess) {
430 ASSERT_TRUE(StartEmbeddedTestServer());
431
426 // Set max renderers to 1 to force running out of processes. 432 // Set max renderers to 1 to force running out of processes.
427 content::RenderProcessHost::SetMaxRendererProcessCount(1); 433 content::RenderProcessHost::SetMaxRendererProcessCount(1);
428 434
429 // Wait for the extension to set itself up and return control to us. 435 // Wait for the extension to set itself up and return control to us.
430 ASSERT_TRUE(RunExtensionSubtest( 436 ASSERT_TRUE(RunExtensionSubtest(
431 "webnavigation", "test_serverRedirectSingleProcess.html")) 437 "webnavigation", "test_serverRedirectSingleProcess.html"))
432 << message_; 438 << message_;
433 439
434 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 440 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
435 content::WaitForLoadStop(tab); 441 content::WaitForLoadStop(tab);
436 442
437 ResultCatcher catcher; 443 ResultCatcher catcher;
438 GURL url(base::StringPrintf( 444 GURL url(base::StringPrintf(
439 "http://www.a.com:%d/" 445 "http://www.a.com:%d/"
440 "files/extensions/api_test/webnavigation/serverRedirect/a.html", 446 "extensions/api_test/webnavigation/serverRedirect/a.html",
441 test_server()->host_port_pair().port())); 447 embedded_test_server()->port()));
442 448
443 ui_test_utils::NavigateToURL(browser(), url); 449 ui_test_utils::NavigateToURL(browser(), url);
444 450
445 url = GURL(base::StringPrintf( 451 url = GURL(base::StringPrintf(
446 "http://www.b.com:%d/server-redirect?http://www.b.com:%d/", 452 "http://www.b.com:%d/server-redirect?http://www.b.com:%d/",
447 test_server()->host_port_pair().port(), 453 embedded_test_server()->port(),
448 test_server()->host_port_pair().port())); 454 embedded_test_server()->port()));
449 455
450 ui_test_utils::NavigateToURL(browser(), url); 456 ui_test_utils::NavigateToURL(browser(), url);
451 457
452 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 458 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
453 } 459 }
454 460
455 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ForwardBack) { 461 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ForwardBack) {
462 ASSERT_TRUE(StartEmbeddedTestServer());
456 ASSERT_TRUE( 463 ASSERT_TRUE(
457 RunExtensionSubtest("webnavigation", "test_forwardBack.html")) 464 RunExtensionSubtest("webnavigation", "test_forwardBack.html"))
458 << message_; 465 << message_;
459 } 466 }
460 467
461 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, IFrame) { 468 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, IFrame) {
469 ASSERT_TRUE(StartEmbeddedTestServer());
462 ASSERT_TRUE( 470 ASSERT_TRUE(
463 RunExtensionSubtest("webnavigation", "test_iframe.html")) << message_; 471 RunExtensionSubtest("webnavigation", "test_iframe.html")) << message_;
464 } 472 }
465 473
466 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, SrcDoc) { 474 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, SrcDoc) {
475 ASSERT_TRUE(StartEmbeddedTestServer());
467 ASSERT_TRUE( 476 ASSERT_TRUE(
468 RunExtensionSubtest("webnavigation", "test_srcdoc.html")) << message_; 477 RunExtensionSubtest("webnavigation", "test_srcdoc.html")) << message_;
469 } 478 }
470 479
471 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, OpenTab) { 480 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, OpenTab) {
481 ASSERT_TRUE(StartEmbeddedTestServer());
472 ASSERT_TRUE( 482 ASSERT_TRUE(
473 RunExtensionSubtest("webnavigation", "test_openTab.html")) << message_; 483 RunExtensionSubtest("webnavigation", "test_openTab.html")) << message_;
474 } 484 }
475 485
476 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ReferenceFragment) { 486 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ReferenceFragment) {
487 ASSERT_TRUE(StartEmbeddedTestServer());
477 ASSERT_TRUE( 488 ASSERT_TRUE(
478 RunExtensionSubtest("webnavigation", "test_referenceFragment.html")) 489 RunExtensionSubtest("webnavigation", "test_referenceFragment.html"))
479 << message_; 490 << message_;
480 } 491 }
481 492
482 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, SimpleLoad) { 493 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, SimpleLoad) {
494 ASSERT_TRUE(StartEmbeddedTestServer());
483 ASSERT_TRUE( 495 ASSERT_TRUE(
484 RunExtensionSubtest("webnavigation", "test_simpleLoad.html")) << message_; 496 RunExtensionSubtest("webnavigation", "test_simpleLoad.html")) << message_;
485 } 497 }
486 498
487 // Fails often on Windows dbg bots. http://crbug.com/177163 499 // Fails often on Windows dbg bots. http://crbug.com/177163
488 #if defined(OS_WIN) 500 #if defined(OS_WIN)
489 #define MAYBE_Failures DISABLED_Failures 501 #define MAYBE_Failures DISABLED_Failures
490 #else 502 #else
491 #define MAYBE_Failures Failures 503 #define MAYBE_Failures Failures
492 #endif // defined(OS_WIN) 504 #endif // defined(OS_WIN)
493 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_Failures) { 505 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_Failures) {
506 ASSERT_TRUE(StartEmbeddedTestServer());
494 ASSERT_TRUE( 507 ASSERT_TRUE(
495 RunExtensionSubtest("webnavigation", "test_failures.html")) << message_; 508 RunExtensionSubtest("webnavigation", "test_failures.html")) << message_;
496 } 509 }
497 510
498 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, FilteredTest) { 511 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, FilteredTest) {
512 ASSERT_TRUE(StartEmbeddedTestServer());
499 ASSERT_TRUE( 513 ASSERT_TRUE(
500 RunExtensionSubtest("webnavigation", "test_filtered.html")) << message_; 514 RunExtensionSubtest("webnavigation", "test_filtered.html")) << message_;
501 } 515 }
502 516
503 // Fails often on Windows dbg bots. http://crbug.com/177163 517 // Fails often on Windows dbg bots. http://crbug.com/177163
504 #if defined(OS_WIN) 518 #if defined(OS_WIN)
505 #define MAYBE_UserAction DISABLED_UserAction 519 #define MAYBE_UserAction DISABLED_UserAction
506 #else 520 #else
507 #define MAYBE_UserAction UserAction 521 #define MAYBE_UserAction UserAction
508 #endif // defined(OS_WIN) 522 #endif // defined(OS_WIN)
509 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_UserAction) { 523 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_UserAction) {
524 ASSERT_TRUE(StartEmbeddedTestServer());
525
510 // Wait for the extension to set itself up and return control to us. 526 // Wait for the extension to set itself up and return control to us.
511 ASSERT_TRUE( 527 ASSERT_TRUE(
512 RunExtensionSubtest("webnavigation", "test_userAction.html")) << message_; 528 RunExtensionSubtest("webnavigation", "test_userAction.html")) << message_;
513 529
514 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 530 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
515 content::WaitForLoadStop(tab); 531 content::WaitForLoadStop(tab);
516 532
517 ResultCatcher catcher; 533 ResultCatcher catcher;
518 534
519 ExtensionService* service = extensions::ExtensionSystem::Get( 535 ExtensionService* service = extensions::ExtensionSystem::Get(
(...skipping 20 matching lines...) Expand all
540 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 556 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
541 } 557 }
542 558
543 // http://crbug.com/177163 559 // http://crbug.com/177163
544 #if defined(OS_WIN) && !defined(NDEBUG) 560 #if defined(OS_WIN) && !defined(NDEBUG)
545 #define MAYBE_RequestOpenTab DISABLED_RequestOpenTab 561 #define MAYBE_RequestOpenTab DISABLED_RequestOpenTab
546 #else 562 #else
547 #define MAYBE_RequestOpenTab RequestOpenTab 563 #define MAYBE_RequestOpenTab RequestOpenTab
548 #endif 564 #endif
549 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_RequestOpenTab) { 565 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_RequestOpenTab) {
566 ASSERT_TRUE(StartEmbeddedTestServer());
567
550 // Wait for the extension to set itself up and return control to us. 568 // Wait for the extension to set itself up and return control to us.
551 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html")) 569 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html"))
552 << message_; 570 << message_;
553 571
554 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 572 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
555 content::WaitForLoadStop(tab); 573 content::WaitForLoadStop(tab);
556 574
557 ResultCatcher catcher; 575 ResultCatcher catcher;
558 576
559 ExtensionService* service = extensions::ExtensionSystem::Get( 577 ExtensionService* service = extensions::ExtensionSystem::Get(
(...skipping 18 matching lines...) Expand all
578 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 596 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
579 } 597 }
580 598
581 // Fails often on Windows dbg bots. http://crbug.com/177163 599 // Fails often on Windows dbg bots. http://crbug.com/177163
582 #if defined(OS_WIN) 600 #if defined(OS_WIN)
583 #define MAYBE_TargetBlank DISABLED_TargetBlank 601 #define MAYBE_TargetBlank DISABLED_TargetBlank
584 #else 602 #else
585 #define MAYBE_TargetBlank TargetBlank 603 #define MAYBE_TargetBlank TargetBlank
586 #endif // defined(OS_WIN) 604 #endif // defined(OS_WIN)
587 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_TargetBlank) { 605 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_TargetBlank) {
606 ASSERT_TRUE(StartEmbeddedTestServer());
607
588 // Wait for the extension to set itself up and return control to us. 608 // Wait for the extension to set itself up and return control to us.
589 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_targetBlank.html")) 609 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_targetBlank.html"))
590 << message_; 610 << message_;
591 611
592 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 612 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
593 content::WaitForLoadStop(tab); 613 content::WaitForLoadStop(tab);
594 614
595 ResultCatcher catcher; 615 ResultCatcher catcher;
596 616
597 GURL url = test_server()->GetURL( 617 GURL url = embedded_test_server()->GetURL(
598 "files/extensions/api_test/webnavigation/targetBlank/a.html"); 618 "/extensions/api_test/webnavigation/targetBlank/a.html");
599 619
600 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_LINK); 620 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_LINK);
601 ui_test_utils::NavigateToURL(&params); 621 ui_test_utils::NavigateToURL(&params);
602 622
603 // There's a link with target=_blank on a.html. Click on it to open it in a 623 // There's a link with target=_blank on a.html. Click on it to open it in a
604 // new tab. 624 // new tab.
605 WebKit::WebMouseEvent mouse_event; 625 WebKit::WebMouseEvent mouse_event;
606 mouse_event.type = WebKit::WebInputEvent::MouseDown; 626 mouse_event.type = WebKit::WebInputEvent::MouseDown;
607 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; 627 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
608 mouse_event.x = 7; 628 mouse_event.x = 7;
609 mouse_event.y = 7; 629 mouse_event.y = 7;
610 mouse_event.clickCount = 1; 630 mouse_event.clickCount = 1;
611 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 631 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
612 mouse_event.type = WebKit::WebInputEvent::MouseUp; 632 mouse_event.type = WebKit::WebInputEvent::MouseUp;
613 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 633 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
614 634
615 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 635 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
616 } 636 }
617 637
618 // http://crbug.com/177163 638 // http://crbug.com/177163
619 #if defined(OS_WIN) && !defined(NDEBUG) 639 #if defined(OS_WIN) && !defined(NDEBUG)
620 #define MAYBE_TargetBlankIncognito DISABLED_TargetBlankIncognito 640 #define MAYBE_TargetBlankIncognito DISABLED_TargetBlankIncognito
621 #else 641 #else
622 #define MAYBE_TargetBlankIncognito TargetBlankIncognito 642 #define MAYBE_TargetBlankIncognito TargetBlankIncognito
623 #endif 643 #endif
624 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_TargetBlankIncognito) { 644 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_TargetBlankIncognito) {
645 ASSERT_TRUE(StartEmbeddedTestServer());
646
625 // Wait for the extension to set itself up and return control to us. 647 // Wait for the extension to set itself up and return control to us.
626 ASSERT_TRUE(RunExtensionSubtest( 648 ASSERT_TRUE(RunExtensionSubtest(
627 "webnavigation", "test_targetBlank.html", 649 "webnavigation", "test_targetBlank.html",
628 ExtensionApiTest::kFlagEnableIncognito)) << message_; 650 ExtensionApiTest::kFlagEnableIncognito)) << message_;
629 651
630 ResultCatcher catcher; 652 ResultCatcher catcher;
631 653
632 GURL url = test_server()->GetURL( 654 GURL url = embedded_test_server()->GetURL(
633 "files/extensions/api_test/webnavigation/targetBlank/a.html"); 655 "/extensions/api_test/webnavigation/targetBlank/a.html");
634 656
635 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( 657 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord(
636 browser()->profile(), url); 658 browser()->profile(), url);
637 WebContents* tab = otr_browser->tab_strip_model()->GetActiveWebContents(); 659 WebContents* tab = otr_browser->tab_strip_model()->GetActiveWebContents();
638 660
639 // There's a link with target=_blank on a.html. Click on it to open it in a 661 // There's a link with target=_blank on a.html. Click on it to open it in a
640 // new tab. 662 // new tab.
641 WebKit::WebMouseEvent mouse_event; 663 WebKit::WebMouseEvent mouse_event;
642 mouse_event.type = WebKit::WebInputEvent::MouseDown; 664 mouse_event.type = WebKit::WebInputEvent::MouseDown;
643 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; 665 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
644 mouse_event.x = 7; 666 mouse_event.x = 7;
645 mouse_event.y = 7; 667 mouse_event.y = 7;
646 mouse_event.clickCount = 1; 668 mouse_event.clickCount = 1;
647 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 669 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
648 mouse_event.type = WebKit::WebInputEvent::MouseUp; 670 mouse_event.type = WebKit::WebInputEvent::MouseUp;
649 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 671 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
650 672
651 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 673 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
652 } 674 }
653 675
654 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, History) { 676 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, History) {
677 ASSERT_TRUE(StartEmbeddedTestServer());
655 ASSERT_TRUE( 678 ASSERT_TRUE(
656 RunExtensionSubtest("webnavigation", "test_history.html")) 679 RunExtensionSubtest("webnavigation", "test_history.html"))
657 << message_; 680 << message_;
658 } 681 }
659 682
660 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcess) { 683 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcess) {
684 ASSERT_TRUE(StartEmbeddedTestServer());
685
661 LoadExtension(test_data_dir_.AppendASCII("webnavigation").AppendASCII("app")); 686 LoadExtension(test_data_dir_.AppendASCII("webnavigation").AppendASCII("app"));
662 LoadExtension(test_data_dir_.AppendASCII("webnavigation")); 687 LoadExtension(test_data_dir_.AppendASCII("webnavigation"));
663 688
664 ExtensionService* service = extensions::ExtensionSystem::Get( 689 ExtensionService* service = extensions::ExtensionSystem::Get(
665 browser()->profile())->extension_service(); 690 browser()->profile())->extension_service();
666 const extensions::Extension* extension = 691 const extensions::Extension* extension =
667 service->GetExtensionById(last_loaded_extension_id_, false); 692 service->GetExtensionById(last_loaded_extension_id_, false);
668 693
669 // See crossProcess/d.html. 694 // See crossProcess/d.html.
670 DelayLoadStartAndExecuteJavascript call_script( 695 DelayLoadStartAndExecuteJavascript call_script(
671 test_navigation_listener(), 696 test_navigation_listener(),
672 test_server()->GetURL("test1"), 697 embedded_test_server()->GetURL("/test1"),
673 "navigate2()", 698 "navigate2()",
674 extension->GetResourceURL("crossProcess/empty.html")); 699 extension->GetResourceURL("crossProcess/empty.html"));
675 700
676 ASSERT_TRUE(RunPageTest( 701 ASSERT_TRUE(RunPageTest(
677 extension->GetResourceURL("test_crossProcess.html").spec())) 702 extension->GetResourceURL("test_crossProcess.html").spec()))
678 << message_; 703 << message_;
679 } 704 }
680 705
681 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessFragment) { 706 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessFragment) {
707 ASSERT_TRUE(StartEmbeddedTestServer());
708
682 LoadExtension(test_data_dir_.AppendASCII("webnavigation")); 709 LoadExtension(test_data_dir_.AppendASCII("webnavigation"));
683 710
684 ExtensionService* service = extensions::ExtensionSystem::Get( 711 ExtensionService* service = extensions::ExtensionSystem::Get(
685 browser()->profile())->extension_service(); 712 browser()->profile())->extension_service();
686 const extensions::Extension* extension = 713 const extensions::Extension* extension =
687 service->GetExtensionById(last_loaded_extension_id_, false); 714 service->GetExtensionById(last_loaded_extension_id_, false);
688 715
689 // See crossProcess/f.html. 716 // See crossProcess/f.html.
690 DelayLoadStartAndExecuteJavascript call_script3( 717 DelayLoadStartAndExecuteJavascript call_script3(
691 test_navigation_listener(), 718 test_navigation_listener(),
692 test_server()->GetURL("test3"), 719 embedded_test_server()->GetURL("/test3"),
693 "updateFragment()", 720 "updateFragment()",
694 extension->GetResourceURL(base::StringPrintf( 721 extension->GetResourceURL(base::StringPrintf(
695 "crossProcess/f.html?%d#foo", 722 "crossProcess/f.html?%d#foo",
696 test_server()->host_port_pair().port()))); 723 embedded_test_server()->port())));
697 724
698 // See crossProcess/g.html. 725 // See crossProcess/g.html.
699 DelayLoadStartAndExecuteJavascript call_script4( 726 DelayLoadStartAndExecuteJavascript call_script4(
700 test_navigation_listener(), 727 test_navigation_listener(),
701 test_server()->GetURL("test4"), 728 embedded_test_server()->GetURL("/test4"),
702 "updateFragment()", 729 "updateFragment()",
703 extension->GetResourceURL(base::StringPrintf( 730 extension->GetResourceURL(base::StringPrintf(
704 "crossProcess/g.html?%d#foo", 731 "crossProcess/g.html?%d#foo",
705 test_server()->host_port_pair().port()))); 732 embedded_test_server()->port())));
706 733
707 ASSERT_TRUE(RunPageTest( 734 ASSERT_TRUE(RunPageTest(
708 extension->GetResourceURL("test_crossProcessFragment.html").spec())) 735 extension->GetResourceURL("test_crossProcessFragment.html").spec()))
709 << message_; 736 << message_;
710 } 737 }
711 738
712 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessHistory) { 739 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessHistory) {
740 ASSERT_TRUE(StartEmbeddedTestServer());
741
713 LoadExtension(test_data_dir_.AppendASCII("webnavigation")); 742 LoadExtension(test_data_dir_.AppendASCII("webnavigation"));
714 743
715 ExtensionService* service = extensions::ExtensionSystem::Get( 744 ExtensionService* service = extensions::ExtensionSystem::Get(
716 browser()->profile())->extension_service(); 745 browser()->profile())->extension_service();
717 const extensions::Extension* extension = 746 const extensions::Extension* extension =
718 service->GetExtensionById(last_loaded_extension_id_, false); 747 service->GetExtensionById(last_loaded_extension_id_, false);
719 748
720 // See crossProcess/e.html. 749 // See crossProcess/e.html.
721 DelayLoadStartAndExecuteJavascript call_script2( 750 DelayLoadStartAndExecuteJavascript call_script2(
722 test_navigation_listener(), 751 test_navigation_listener(),
723 test_server()->GetURL("test2"), 752 embedded_test_server()->GetURL("/test2"),
724 "updateHistory()", 753 "updateHistory()",
725 extension->GetResourceURL("crossProcess/empty.html")); 754 extension->GetResourceURL("crossProcess/empty.html"));
726 755
727 // See crossProcess/h.html. 756 // See crossProcess/h.html.
728 DelayLoadStartAndExecuteJavascript call_script5( 757 DelayLoadStartAndExecuteJavascript call_script5(
729 test_navigation_listener(), 758 test_navigation_listener(),
730 test_server()->GetURL("test5"), 759 embedded_test_server()->GetURL("/test5"),
731 "updateHistory()", 760 "updateHistory()",
732 extension->GetResourceURL("crossProcess/empty.html")); 761 extension->GetResourceURL("crossProcess/empty.html"));
733 762
734 // See crossProcess/i.html. 763 // See crossProcess/i.html.
735 DelayLoadStartAndExecuteJavascript call_script6( 764 DelayLoadStartAndExecuteJavascript call_script6(
736 test_navigation_listener(), 765 test_navigation_listener(),
737 test_server()->GetURL("test6"), 766 embedded_test_server()->GetURL("/test6"),
738 "updateHistory()", 767 "updateHistory()",
739 extension->GetResourceURL("crossProcess/empty.html")); 768 extension->GetResourceURL("crossProcess/empty.html"));
740 769
741 ASSERT_TRUE(RunPageTest( 770 ASSERT_TRUE(RunPageTest(
742 extension->GetResourceURL("test_crossProcessHistory.html").spec())) 771 extension->GetResourceURL("test_crossProcessHistory.html").spec()))
743 << message_; 772 << message_;
744 } 773 }
745 774
746 // http://crbug.com/177163 775 // http://crbug.com/177163
747 #if defined(OS_WIN) && !defined(NDEBUG) 776 #if defined(OS_WIN) && !defined(NDEBUG)
748 #define MAYBE_Crash DISABLED_Crash 777 #define MAYBE_Crash DISABLED_Crash
749 #else 778 #else
750 #define MAYBE_Crash Crash 779 #define MAYBE_Crash Crash
751 #endif 780 #endif
752 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_Crash) { 781 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_Crash) {
782 ASSERT_TRUE(StartEmbeddedTestServer());
783
753 // Wait for the extension to set itself up and return control to us. 784 // Wait for the extension to set itself up and return control to us.
754 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_crash.html")) 785 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_crash.html"))
755 << message_; 786 << message_;
756 787
757 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 788 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
758 content::WaitForLoadStop(tab); 789 content::WaitForLoadStop(tab);
759 790
760 ResultCatcher catcher; 791 ResultCatcher catcher;
761 792
762 GURL url(base::StringPrintf( 793 GURL url(base::StringPrintf(
763 "http://www.a.com:%d/" 794 "http://www.a.com:%d/"
764 "files/extensions/api_test/webnavigation/crash/a.html", 795 "extensions/api_test/webnavigation/crash/a.html",
765 test_server()->host_port_pair().port())); 796 embedded_test_server()->port()));
766 ui_test_utils::NavigateToURL(browser(), url); 797 ui_test_utils::NavigateToURL(browser(), url);
767 798
768 ui_test_utils::NavigateToURL(browser(), GURL(content::kChromeUICrashURL)); 799 ui_test_utils::NavigateToURL(browser(), GURL(content::kChromeUICrashURL));
769 800
770 url = GURL(base::StringPrintf( 801 url = GURL(base::StringPrintf(
771 "http://www.a.com:%d/" 802 "http://www.a.com:%d/"
772 "files/extensions/api_test/webnavigation/crash/b.html", 803 "extensions/api_test/webnavigation/crash/b.html",
773 test_server()->host_port_pair().port())); 804 embedded_test_server()->port()));
774 ui_test_utils::NavigateToURL(browser(), url); 805 ui_test_utils::NavigateToURL(browser(), url);
775 806
776 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 807 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
777 } 808 }
778 809
779 } // namespace extensions 810 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698