| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 service->GetExtensionById(last_loaded_extension_id(), false); | 566 service->GetExtensionById(last_loaded_extension_id(), false); |
| 567 GURL url = extension->GetResourceURL("a.html"); | 567 GURL url = extension->GetResourceURL("a.html"); |
| 568 | 568 |
| 569 ui_test_utils::NavigateToURL(browser(), url); | 569 ui_test_utils::NavigateToURL(browser(), url); |
| 570 | 570 |
| 571 // There's a link on a.html. Middle-click on it to open it in a new tab. | 571 // There's a link on a.html. Middle-click on it to open it in a new tab. |
| 572 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 572 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
| 573 blink::WebInputEvent::NoModifiers, | 573 blink::WebInputEvent::NoModifiers, |
| 574 blink::WebInputEvent::TimeStampForTesting); | 574 blink::WebInputEvent::TimeStampForTesting); |
| 575 mouse_event.button = blink::WebMouseEvent::Button::Middle; | 575 mouse_event.button = blink::WebMouseEvent::Button::Middle; |
| 576 mouse_event.x = 7; | 576 mouse_event.setPositionInWidget(7, 7); |
| 577 mouse_event.y = 7; | |
| 578 mouse_event.clickCount = 1; | 577 mouse_event.clickCount = 1; |
| 579 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 578 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 580 mouse_event.setType(blink::WebInputEvent::MouseUp); | 579 mouse_event.setType(blink::WebInputEvent::MouseUp); |
| 581 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 580 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 582 | 581 |
| 583 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 582 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 584 } | 583 } |
| 585 | 584 |
| 586 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, TargetBlank) { | 585 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, TargetBlank) { |
| 587 ASSERT_TRUE(StartEmbeddedTestServer()); | 586 ASSERT_TRUE(StartEmbeddedTestServer()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 599 | 598 |
| 600 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK); | 599 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK); |
| 601 ui_test_utils::NavigateToURL(¶ms); | 600 ui_test_utils::NavigateToURL(¶ms); |
| 602 | 601 |
| 603 // There's a link with target=_blank on a.html. Click on it to open it in a | 602 // There's a link with target=_blank on a.html. Click on it to open it in a |
| 604 // new tab. | 603 // new tab. |
| 605 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 604 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
| 606 blink::WebInputEvent::NoModifiers, | 605 blink::WebInputEvent::NoModifiers, |
| 607 blink::WebInputEvent::TimeStampForTesting); | 606 blink::WebInputEvent::TimeStampForTesting); |
| 608 mouse_event.button = blink::WebMouseEvent::Button::Left; | 607 mouse_event.button = blink::WebMouseEvent::Button::Left; |
| 609 mouse_event.x = 7; | 608 mouse_event.setPositionInWidget(7, 7); |
| 610 mouse_event.y = 7; | |
| 611 mouse_event.clickCount = 1; | 609 mouse_event.clickCount = 1; |
| 612 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 610 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 613 mouse_event.setType(blink::WebInputEvent::MouseUp); | 611 mouse_event.setType(blink::WebInputEvent::MouseUp); |
| 614 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 612 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 615 | 613 |
| 616 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 614 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 617 } | 615 } |
| 618 | 616 |
| 619 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, TargetBlankIncognito) { | 617 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, TargetBlankIncognito) { |
| 620 ASSERT_TRUE(StartEmbeddedTestServer()); | 618 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 621 | 619 |
| 622 // 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. |
| 623 ASSERT_TRUE(RunExtensionTestIncognito("webnavigation/targetBlank")) | 621 ASSERT_TRUE(RunExtensionTestIncognito("webnavigation/targetBlank")) |
| 624 << message_; | 622 << message_; |
| 625 | 623 |
| 626 ResultCatcher catcher; | 624 ResultCatcher catcher; |
| 627 | 625 |
| 628 GURL url = embedded_test_server()->GetURL( | 626 GURL url = embedded_test_server()->GetURL( |
| 629 "/extensions/api_test/webnavigation/targetBlank/a.html"); | 627 "/extensions/api_test/webnavigation/targetBlank/a.html"); |
| 630 | 628 |
| 631 Browser* otr_browser = OpenURLOffTheRecord(browser()->profile(), url); | 629 Browser* otr_browser = OpenURLOffTheRecord(browser()->profile(), url); |
| 632 WebContents* tab = otr_browser->tab_strip_model()->GetActiveWebContents(); | 630 WebContents* tab = otr_browser->tab_strip_model()->GetActiveWebContents(); |
| 633 | 631 |
| 634 // 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 |
| 635 // new tab. | 633 // new tab. |
| 636 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 634 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
| 637 blink::WebInputEvent::NoModifiers, | 635 blink::WebInputEvent::NoModifiers, |
| 638 blink::WebInputEvent::TimeStampForTesting); | 636 blink::WebInputEvent::TimeStampForTesting); |
| 639 mouse_event.button = blink::WebMouseEvent::Button::Left; | 637 mouse_event.button = blink::WebMouseEvent::Button::Left; |
| 640 mouse_event.x = 7; | 638 mouse_event.setPositionInWidget(7, 7); |
| 641 mouse_event.y = 7; | |
| 642 mouse_event.clickCount = 1; | 639 mouse_event.clickCount = 1; |
| 643 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 640 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 644 mouse_event.setType(blink::WebInputEvent::MouseUp); | 641 mouse_event.setType(blink::WebInputEvent::MouseUp); |
| 645 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 642 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 646 | 643 |
| 647 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 644 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 648 } | 645 } |
| 649 | 646 |
| 650 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, History) { | 647 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, History) { |
| 651 ASSERT_TRUE(StartEmbeddedTestServer()); | 648 ASSERT_TRUE(StartEmbeddedTestServer()); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 "extensions/api_test/webnavigation/crash/b.html", | 814 "extensions/api_test/webnavigation/crash/b.html", |
| 818 embedded_test_server()->port())); | 815 embedded_test_server()->port())); |
| 819 ui_test_utils::NavigateToURL(browser(), url); | 816 ui_test_utils::NavigateToURL(browser(), url); |
| 820 | 817 |
| 821 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 818 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 822 } | 819 } |
| 823 | 820 |
| 824 #endif | 821 #endif |
| 825 | 822 |
| 826 } // namespace extensions | 823 } // namespace extensions |
| OLD | NEW |