| 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/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 browser()->profile())->extension_service(); | 553 browser()->profile())->extension_service(); |
| 554 const extensions::Extension* extension = | 554 const extensions::Extension* extension = |
| 555 service->GetExtensionById(last_loaded_extension_id(), false); | 555 service->GetExtensionById(last_loaded_extension_id(), false); |
| 556 GURL url = extension->GetResourceURL("a.html"); | 556 GURL url = extension->GetResourceURL("a.html"); |
| 557 | 557 |
| 558 ui_test_utils::NavigateToURL(browser(), url); | 558 ui_test_utils::NavigateToURL(browser(), url); |
| 559 | 559 |
| 560 // There's a link on a.html. Middle-click on it to open it in a new tab. | 560 // There's a link on a.html. Middle-click on it to open it in a new tab. |
| 561 blink::WebMouseEvent mouse_event; | 561 blink::WebMouseEvent mouse_event; |
| 562 mouse_event.type = blink::WebInputEvent::MouseDown; | 562 mouse_event.type = blink::WebInputEvent::MouseDown; |
| 563 mouse_event.button = blink::WebMouseEvent::ButtonMiddle; | 563 mouse_event.button = blink::WebMouseEvent::Button::Middle; |
| 564 mouse_event.x = 7; | 564 mouse_event.x = 7; |
| 565 mouse_event.y = 7; | 565 mouse_event.y = 7; |
| 566 mouse_event.clickCount = 1; | 566 mouse_event.clickCount = 1; |
| 567 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 567 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 568 mouse_event.type = blink::WebInputEvent::MouseUp; | 568 mouse_event.type = blink::WebInputEvent::MouseUp; |
| 569 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 569 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 570 | 570 |
| 571 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 571 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 572 } | 572 } |
| 573 | 573 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 585 GURL url = embedded_test_server()->GetURL( | 585 GURL url = embedded_test_server()->GetURL( |
| 586 "/extensions/api_test/webnavigation/targetBlank/a.html"); | 586 "/extensions/api_test/webnavigation/targetBlank/a.html"); |
| 587 | 587 |
| 588 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK); | 588 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK); |
| 589 ui_test_utils::NavigateToURL(¶ms); | 589 ui_test_utils::NavigateToURL(¶ms); |
| 590 | 590 |
| 591 // There's a link with target=_blank on a.html. Click on it to open it in a | 591 // There's a link with target=_blank on a.html. Click on it to open it in a |
| 592 // new tab. | 592 // new tab. |
| 593 blink::WebMouseEvent mouse_event; | 593 blink::WebMouseEvent mouse_event; |
| 594 mouse_event.type = blink::WebInputEvent::MouseDown; | 594 mouse_event.type = blink::WebInputEvent::MouseDown; |
| 595 mouse_event.button = blink::WebMouseEvent::ButtonLeft; | 595 mouse_event.button = blink::WebMouseEvent::Button::Left; |
| 596 mouse_event.x = 7; | 596 mouse_event.x = 7; |
| 597 mouse_event.y = 7; | 597 mouse_event.y = 7; |
| 598 mouse_event.clickCount = 1; | 598 mouse_event.clickCount = 1; |
| 599 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 599 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 600 mouse_event.type = blink::WebInputEvent::MouseUp; | 600 mouse_event.type = blink::WebInputEvent::MouseUp; |
| 601 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 601 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 602 | 602 |
| 603 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 603 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 604 } | 604 } |
| 605 | 605 |
| 606 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, TargetBlankIncognito) { | 606 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, TargetBlankIncognito) { |
| 607 ASSERT_TRUE(StartEmbeddedTestServer()); | 607 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 608 | 608 |
| 609 // Wait for the extension to set itself up and return control to us. | 609 // Wait for the extension to set itself up and return control to us. |
| 610 ASSERT_TRUE(RunExtensionTestIncognito("webnavigation/targetBlank")) | 610 ASSERT_TRUE(RunExtensionTestIncognito("webnavigation/targetBlank")) |
| 611 << message_; | 611 << message_; |
| 612 | 612 |
| 613 ResultCatcher catcher; | 613 ResultCatcher catcher; |
| 614 | 614 |
| 615 GURL url = embedded_test_server()->GetURL( | 615 GURL url = embedded_test_server()->GetURL( |
| 616 "/extensions/api_test/webnavigation/targetBlank/a.html"); | 616 "/extensions/api_test/webnavigation/targetBlank/a.html"); |
| 617 | 617 |
| 618 Browser* otr_browser = OpenURLOffTheRecord(browser()->profile(), url); | 618 Browser* otr_browser = OpenURLOffTheRecord(browser()->profile(), url); |
| 619 WebContents* tab = otr_browser->tab_strip_model()->GetActiveWebContents(); | 619 WebContents* tab = otr_browser->tab_strip_model()->GetActiveWebContents(); |
| 620 | 620 |
| 621 // There's a link with target=_blank on a.html. Click on it to open it in a | 621 // There's a link with target=_blank on a.html. Click on it to open it in a |
| 622 // new tab. | 622 // new tab. |
| 623 blink::WebMouseEvent mouse_event; | 623 blink::WebMouseEvent mouse_event; |
| 624 mouse_event.type = blink::WebInputEvent::MouseDown; | 624 mouse_event.type = blink::WebInputEvent::MouseDown; |
| 625 mouse_event.button = blink::WebMouseEvent::ButtonLeft; | 625 mouse_event.button = blink::WebMouseEvent::Button::Left; |
| 626 mouse_event.x = 7; | 626 mouse_event.x = 7; |
| 627 mouse_event.y = 7; | 627 mouse_event.y = 7; |
| 628 mouse_event.clickCount = 1; | 628 mouse_event.clickCount = 1; |
| 629 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 629 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 630 mouse_event.type = blink::WebInputEvent::MouseUp; | 630 mouse_event.type = blink::WebInputEvent::MouseUp; |
| 631 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 631 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
| 632 | 632 |
| 633 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 633 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 634 } | 634 } |
| 635 | 635 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 "extensions/api_test/webnavigation/crash/b.html", | 790 "extensions/api_test/webnavigation/crash/b.html", |
| 791 embedded_test_server()->port())); | 791 embedded_test_server()->port())); |
| 792 ui_test_utils::NavigateToURL(browser(), url); | 792 ui_test_utils::NavigateToURL(browser(), url); |
| 793 | 793 |
| 794 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 794 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 795 } | 795 } |
| 796 | 796 |
| 797 #endif | 797 #endif |
| 798 | 798 |
| 799 } // namespace extensions | 799 } // namespace extensions |
| OLD | NEW |