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 <list> | 5 #include <list> |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 service->GetExtensionById(last_loaded_extension_id(), false); | 564 service->GetExtensionById(last_loaded_extension_id(), false); |
565 GURL url = extension->GetResourceURL("a.html"); | 565 GURL url = extension->GetResourceURL("a.html"); |
566 | 566 |
567 ui_test_utils::NavigateToURL(browser(), url); | 567 ui_test_utils::NavigateToURL(browser(), url); |
568 | 568 |
569 // There's a link on a.html. Middle-click on it to open it in a new tab. | 569 // There's a link on a.html. Middle-click on it to open it in a new tab. |
570 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 570 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
571 blink::WebInputEvent::NoModifiers, | 571 blink::WebInputEvent::NoModifiers, |
572 blink::WebInputEvent::TimeStampForTesting); | 572 blink::WebInputEvent::TimeStampForTesting); |
573 mouse_event.button = blink::WebMouseEvent::Button::Middle; | 573 mouse_event.button = blink::WebMouseEvent::Button::Middle; |
574 mouse_event.x = 7; | 574 mouse_event.position.x = 7; |
575 mouse_event.y = 7; | 575 mouse_event.position.y = 7; |
576 mouse_event.clickCount = 1; | 576 mouse_event.clickCount = 1; |
577 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 577 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
578 mouse_event.setType(blink::WebInputEvent::MouseUp); | 578 mouse_event.setType(blink::WebInputEvent::MouseUp); |
579 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 579 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
580 | 580 |
581 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 581 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
582 } | 582 } |
583 | 583 |
584 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, TargetBlank) { | 584 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, TargetBlank) { |
585 ASSERT_TRUE(StartEmbeddedTestServer()); | 585 ASSERT_TRUE(StartEmbeddedTestServer()); |
(...skipping 11 matching lines...) Expand all Loading... |
597 | 597 |
598 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK); | 598 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK); |
599 ui_test_utils::NavigateToURL(¶ms); | 599 ui_test_utils::NavigateToURL(¶ms); |
600 | 600 |
601 // There's a link with target=_blank on a.html. Click on it to open it in a | 601 // There's a link with target=_blank on a.html. Click on it to open it in a |
602 // new tab. | 602 // new tab. |
603 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 603 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
604 blink::WebInputEvent::NoModifiers, | 604 blink::WebInputEvent::NoModifiers, |
605 blink::WebInputEvent::TimeStampForTesting); | 605 blink::WebInputEvent::TimeStampForTesting); |
606 mouse_event.button = blink::WebMouseEvent::Button::Left; | 606 mouse_event.button = blink::WebMouseEvent::Button::Left; |
607 mouse_event.x = 7; | 607 mouse_event.position.x = 7; |
608 mouse_event.y = 7; | 608 mouse_event.position.y = 7; |
609 mouse_event.clickCount = 1; | 609 mouse_event.clickCount = 1; |
610 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 610 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
611 mouse_event.setType(blink::WebInputEvent::MouseUp); | 611 mouse_event.setType(blink::WebInputEvent::MouseUp); |
612 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 612 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
613 | 613 |
614 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 614 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
615 } | 615 } |
616 | 616 |
617 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, TargetBlankIncognito) { | 617 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, TargetBlankIncognito) { |
618 ASSERT_TRUE(StartEmbeddedTestServer()); | 618 ASSERT_TRUE(StartEmbeddedTestServer()); |
619 | 619 |
620 // Wait for the extension to set itself up and return control to us. | 620 // Wait for the extension to set itself up and return control to us. |
621 ASSERT_TRUE(RunExtensionTestIncognito("webnavigation/targetBlank")) | 621 ASSERT_TRUE(RunExtensionTestIncognito("webnavigation/targetBlank")) |
622 << message_; | 622 << message_; |
623 | 623 |
624 ResultCatcher catcher; | 624 ResultCatcher catcher; |
625 | 625 |
626 GURL url = embedded_test_server()->GetURL( | 626 GURL url = embedded_test_server()->GetURL( |
627 "/extensions/api_test/webnavigation/targetBlank/a.html"); | 627 "/extensions/api_test/webnavigation/targetBlank/a.html"); |
628 | 628 |
629 Browser* otr_browser = OpenURLOffTheRecord(browser()->profile(), url); | 629 Browser* otr_browser = OpenURLOffTheRecord(browser()->profile(), url); |
630 WebContents* tab = otr_browser->tab_strip_model()->GetActiveWebContents(); | 630 WebContents* tab = otr_browser->tab_strip_model()->GetActiveWebContents(); |
631 | 631 |
632 // There's a link with target=_blank on a.html. Click on it to open it in a | 632 // There's a link with target=_blank on a.html. Click on it to open it in a |
633 // new tab. | 633 // new tab. |
634 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 634 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
635 blink::WebInputEvent::NoModifiers, | 635 blink::WebInputEvent::NoModifiers, |
636 blink::WebInputEvent::TimeStampForTesting); | 636 blink::WebInputEvent::TimeStampForTesting); |
637 mouse_event.button = blink::WebMouseEvent::Button::Left; | 637 mouse_event.button = blink::WebMouseEvent::Button::Left; |
638 mouse_event.x = 7; | 638 mouse_event.position.x = 7; |
639 mouse_event.y = 7; | 639 mouse_event.position.y = 7; |
640 mouse_event.clickCount = 1; | 640 mouse_event.clickCount = 1; |
641 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 641 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
642 mouse_event.setType(blink::WebInputEvent::MouseUp); | 642 mouse_event.setType(blink::WebInputEvent::MouseUp); |
643 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 643 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
644 | 644 |
645 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 645 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
646 } | 646 } |
647 | 647 |
648 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, History) { | 648 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, History) { |
649 ASSERT_TRUE(StartEmbeddedTestServer()); | 649 ASSERT_TRUE(StartEmbeddedTestServer()); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 "extensions/api_test/webnavigation/crash/b.html", | 807 "extensions/api_test/webnavigation/crash/b.html", |
808 embedded_test_server()->port())); | 808 embedded_test_server()->port())); |
809 ui_test_utils::NavigateToURL(browser(), url); | 809 ui_test_utils::NavigateToURL(browser(), url); |
810 | 810 |
811 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 811 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
812 } | 812 } |
813 | 813 |
814 #endif | 814 #endif |
815 | 815 |
816 } // namespace extensions | 816 } // namespace extensions |
OLD | NEW |