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

Unified Diff: chrome/browser/pdf/pdf_extension_test.cc

Issue 2300243004: Links in PDF should open in a new window when shift + left clicked. (Closed)
Patch Set: Links in PDF should open in a new window when shift + left clicked. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/navigator.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d4aa08eb36e3cfe69e10c5db7e3764c175cff50b..d2642f638922cc4e51d996396728f29be62ae6eb 100644
--- a/chrome/browser/pdf/pdf_extension_test.cc
+++ b/chrome/browser/pdf/pdf_extension_test.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/plugins/plugin_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_paths.h"
@@ -857,3 +858,36 @@ IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkShiftMiddleClick) {
const GURL& url = active_web_contents->GetURL();
ASSERT_EQ(std::string("http://www.example.com/"), url.spec());
}
+
+IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkShiftLeftClick) {
+ 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);
+ ASSERT_EQ(1U, chrome::GetTotalBrowserCount());
+
+ // 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_BROWSER_WINDOW_READY,
+ content::NotificationService::AllSources());
+ content::SimulateMouseClickAt(web_contents, blink::WebInputEvent::ShiftKey,
+ blink::WebMouseEvent::Button::Left,
+ link_position);
+ observer.Wait();
+
+ ASSERT_EQ(2U, chrome::GetTotalBrowserCount());
+
+ content::WebContents* active_web_contents =
+ chrome::FindLastActive()->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());
+}
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/navigator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698