OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/hash.h" | 12 #include "base/hash.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
20 #include "chrome/browser/extensions/component_loader.h" | 20 #include "chrome/browser/extensions/component_loader.h" |
21 #include "chrome/browser/extensions/extension_apitest.h" | 21 #include "chrome/browser/extensions/extension_apitest.h" |
22 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
23 #include "chrome/browser/pdf/pdf_extension_test_util.h" | 23 #include "chrome/browser/pdf/pdf_extension_test_util.h" |
24 #include "chrome/browser/pdf/pdf_extension_util.h" | 24 #include "chrome/browser/pdf/pdf_extension_util.h" |
25 #include "chrome/browser/plugins/plugin_prefs.h" | 25 #include "chrome/browser/plugins/plugin_prefs.h" |
26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
| 28 #include "chrome/browser/ui/browser_finder.h" |
28 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 29 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
29 #include "chrome/common/chrome_content_client.h" | 30 #include "chrome/common/chrome_content_client.h" |
30 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
31 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/test/base/ui_test_utils.h" | 33 #include "chrome/test/base/ui_test_utils.h" |
33 #include "components/zoom/page_zoom.h" | 34 #include "components/zoom/page_zoom.h" |
34 #include "components/zoom/test/zoom_test_utils.h" | 35 #include "components/zoom/test/zoom_test_utils.h" |
35 #include "components/zoom/zoom_controller.h" | 36 #include "components/zoom/zoom_controller.h" |
36 #include "content/public/browser/browser_accessibility_state.h" | 37 #include "content/public/browser/browser_accessibility_state.h" |
37 #include "content/public/browser/browser_plugin_guest_manager.h" | 38 #include "content/public/browser/browser_plugin_guest_manager.h" |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 int tab_count = browser()->tab_strip_model()->count(); | 851 int tab_count = browser()->tab_strip_model()->count(); |
851 ASSERT_EQ(2, tab_count); | 852 ASSERT_EQ(2, tab_count); |
852 | 853 |
853 content::WebContents* active_web_contents = | 854 content::WebContents* active_web_contents = |
854 browser()->tab_strip_model()->GetActiveWebContents(); | 855 browser()->tab_strip_model()->GetActiveWebContents(); |
855 ASSERT_NE(web_contents, active_web_contents); | 856 ASSERT_NE(web_contents, active_web_contents); |
856 | 857 |
857 const GURL& url = active_web_contents->GetURL(); | 858 const GURL& url = active_web_contents->GetURL(); |
858 ASSERT_EQ(std::string("http://www.example.com/"), url.spec()); | 859 ASSERT_EQ(std::string("http://www.example.com/"), url.spec()); |
859 } | 860 } |
| 861 |
| 862 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkShiftLeftClick) { |
| 863 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
| 864 GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test-link.pdf")); |
| 865 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); |
| 866 ASSERT_TRUE(guest_contents); |
| 867 ASSERT_EQ(1U, chrome::GetTotalBrowserCount()); |
| 868 |
| 869 // The link position of the test-link.pdf in page coordinates is (110, 110). |
| 870 // Convert the link position from page coordinates to screen coordinates. |
| 871 gfx::Point link_position(110, 110); |
| 872 ConvertPageCoordToScreenCoord(guest_contents, &link_position); |
| 873 |
| 874 content::WebContents* web_contents = |
| 875 browser()->tab_strip_model()->GetActiveWebContents(); |
| 876 |
| 877 content::WindowedNotificationObserver observer( |
| 878 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 879 content::NotificationService::AllSources()); |
| 880 content::SimulateMouseClickAt(web_contents, blink::WebInputEvent::ShiftKey, |
| 881 blink::WebMouseEvent::Button::Left, |
| 882 link_position); |
| 883 observer.Wait(); |
| 884 |
| 885 ASSERT_EQ(2U, chrome::GetTotalBrowserCount()); |
| 886 |
| 887 content::WebContents* active_web_contents = |
| 888 chrome::FindLastActive()->tab_strip_model()->GetActiveWebContents(); |
| 889 ASSERT_NE(web_contents, active_web_contents); |
| 890 |
| 891 const GURL& url = active_web_contents->GetURL(); |
| 892 ASSERT_EQ(std::string("http://www.example.com/"), url.spec()); |
| 893 } |
OLD | NEW |