Index: chrome/browser/pdf/pdf_extension_test.cc |
diff --git a/chrome/browser/pdf/pdf_extension_test.cc b/chrome/browser/pdf/pdf_extension_test.cc |
index 3a67f71b247de15eeafb35654945dcc1375265ac..8d66a96c95bd03cf39d33997184a4ab8e684b0f2 100644 |
--- a/chrome/browser/pdf/pdf_extension_test.cc |
+++ b/chrome/browser/pdf/pdf_extension_test.cc |
@@ -780,3 +780,75 @@ IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkMiddleClick) { |
const GURL& url = new_web_contents->GetURL(); |
ASSERT_EQ(std::string("http://www.example.com/"), url.spec()); |
} |
+ |
+IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkCtrlShiftLeftClick) { |
+ host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
+ GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test-link.pdf")); |
+ content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); |
+ ASSERT_TRUE(guest_contents); |
+ |
+ // The link position of the test-link.pdf in page coordinates is (110, 110). |
+ // Convert the link position from page coordinates to screen coordinates. |
+ gfx::Point link_position(110, 110); |
+ ConvertPageCoordToScreenCoord(guest_contents, &link_position); |
+ |
+ content::WebContents* web_contents = |
+ browser()->tab_strip_model()->GetActiveWebContents(); |
+ |
+#if defined(OS_MACOSX) |
+ int modifiers = |
+ blink::WebInputEvent::MetaKey | blink::WebInputEvent::ShiftKey; |
+#else |
+ int modifiers = |
+ blink::WebInputEvent::ControlKey | blink::WebInputEvent::ShiftKey; |
+#endif |
+ |
+ content::WindowedNotificationObserver observer( |
+ chrome::NOTIFICATION_TAB_ADDED, |
+ content::NotificationService::AllSources()); |
+ content::SimulateMouseClickAt(web_contents, modifiers, |
+ blink::WebMouseEvent::ButtonLeft, link_position); |
+ observer.Wait(); |
+ |
+ int tab_count = browser()->tab_strip_model()->count(); |
+ ASSERT_EQ(2, tab_count); |
+ |
+ content::WebContents* active_web_contents = |
+ browser()->tab_strip_model()->GetActiveWebContents(); |
+ ASSERT_NE(web_contents, active_web_contents); |
+ |
+ const GURL& url = active_web_contents->GetURL(); |
+ ASSERT_EQ(std::string("http://www.example.com/"), url.spec()); |
+} |
+ |
+IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkShiftMiddleClick) { |
+ host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
+ GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test-link.pdf")); |
+ content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); |
+ ASSERT_TRUE(guest_contents); |
+ |
+ // The link position of the test-link.pdf in page coordinates is (110, 110). |
+ // Convert the link position from page coordinates to screen coordinates. |
+ gfx::Point link_position(110, 110); |
+ ConvertPageCoordToScreenCoord(guest_contents, &link_position); |
+ |
+ content::WebContents* web_contents = |
+ browser()->tab_strip_model()->GetActiveWebContents(); |
+ |
+ content::WindowedNotificationObserver observer( |
+ chrome::NOTIFICATION_TAB_ADDED, |
+ content::NotificationService::AllSources()); |
+ content::SimulateMouseClickAt(web_contents, blink::WebInputEvent::ShiftKey, |
+ blink::WebMouseEvent::ButtonMiddle, link_position); |
+ observer.Wait(); |
+ |
+ int tab_count = browser()->tab_strip_model()->count(); |
+ ASSERT_EQ(2, tab_count); |
+ |
+ content::WebContents* active_web_contents = |
+ browser()->tab_strip_model()->GetActiveWebContents(); |
+ ASSERT_NE(web_contents, active_web_contents); |
+ |
+ const GURL& url = active_web_contents->GetURL(); |
+ ASSERT_EQ(std::string("http://www.example.com/"), url.spec()); |
+} |