Chromium Code Reviews| 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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 events_received_.push_back(event.type()); | 228 events_received_.push_back(event.type()); |
| 229 }; | 229 }; |
| 230 | 230 |
| 231 private: | 231 private: |
| 232 RenderWidgetHost* host_; | 232 RenderWidgetHost* host_; |
| 233 std::vector<blink::WebInputEvent::Type> events_received_; | 233 std::vector<blink::WebInputEvent::Type> events_received_; |
| 234 | 234 |
| 235 DISALLOW_COPY_AND_ASSIGN(TestInputEventObserver); | 235 DISALLOW_COPY_AND_ASSIGN(TestInputEventObserver); |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 double GetFrameDeviceScaleFactor(const ToRenderFrameHost& adapter) { | |
| 239 double device_scale_factor; | |
| 240 const char kGetFrameDeviceScaleFactor[] = | |
| 241 "window.domAutomationController.send(window.devicePixelRatio);"; | |
| 242 EXPECT_TRUE(ExecuteScriptAndExtractDouble(adapter, kGetFrameDeviceScaleFactor, | |
| 243 &device_scale_factor)); | |
| 244 return device_scale_factor; | |
| 245 } | |
| 246 | |
| 247 // This method returns the scale factor on Android and 1.0 on other | 238 // This method returns the scale factor on Android and 1.0 on other |
| 248 // platforms in order to adjust coordinates appropriately. | 239 // platforms in order to adjust coordinates appropriately. |
| 249 double GetAdjustmentScaleFactorForAndroid(Shell* shell) { | 240 double GetAdjustmentScaleFactorForAndroid(Shell* shell) { |
| 250 #if defined(OS_ANDROID) | 241 #if defined(OS_ANDROID) |
| 251 return GetFrameDeviceScaleFactor(shell->web_contents()); | 242 return GetFrameDeviceScaleFactor(shell->web_contents()); |
| 252 #else | 243 #else |
| 253 return 1.0; | 244 return 1.0; |
| 254 #endif | 245 #endif |
| 255 } | 246 } |
| 256 | 247 |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 736 return result; | 727 return result; |
| 737 } | 728 } |
| 738 }; | 729 }; |
| 739 | 730 |
| 740 bool operator==(const ParsedFeaturePolicyDeclaration& first, | 731 bool operator==(const ParsedFeaturePolicyDeclaration& first, |
| 741 const ParsedFeaturePolicyDeclaration& second) { | 732 const ParsedFeaturePolicyDeclaration& second) { |
| 742 return std::tie(first.feature, first.matches_all_origins, first.origins) == | 733 return std::tie(first.feature, first.matches_all_origins, first.origins) == |
| 743 std::tie(second.feature, second.matches_all_origins, second.origins); | 734 std::tie(second.feature, second.matches_all_origins, second.origins); |
| 744 } | 735 } |
| 745 | 736 |
| 737 double GetFrameDeviceScaleFactor(const ToRenderFrameHost& adapter) { | |
|
jochen (gone - plz use gerrit)
2017/03/20 07:22:37
why did you move this?
| |
| 738 double device_scale_factor; | |
| 739 const char kGetFrameDeviceScaleFactor[] = | |
| 740 "window.domAutomationController.send(window.devicePixelRatio);"; | |
| 741 EXPECT_TRUE(ExecuteScriptAndExtractDouble(adapter, kGetFrameDeviceScaleFactor, | |
| 742 &device_scale_factor)); | |
| 743 return device_scale_factor; | |
| 744 } | |
| 745 | |
| 746 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, | 746 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, |
| 747 SubframeLoadsWithCorrectDeviceScaleFactor) { | 747 SubframeLoadsWithCorrectDeviceScaleFactor) { |
| 748 GURL main_url(embedded_test_server()->GetURL( | 748 GURL main_url(embedded_test_server()->GetURL( |
| 749 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 749 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 750 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 750 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 751 | 751 |
| 752 // On Android forcing device scale factor does not work for tests, therefore | 752 // On Android forcing device scale factor does not work for tests, therefore |
| 753 // we ensure that make frame and iframe have the same DIP scale there, but | 753 // we ensure that make frame and iframe have the same DIP scale there, but |
| 754 // not necessarily kDeviceScaleFactor. | 754 // not necessarily kDeviceScaleFactor. |
| 755 const double expected_dip_scale = | 755 const double expected_dip_scale = |
| (...skipping 9144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9900 | 9900 |
| 9901 // Try the same navigation, but use the browser-initiated path. | 9901 // Try the same navigation, but use the browser-initiated path. |
| 9902 NavigateFrameToURL(root->child_at(0), frame_url); | 9902 NavigateFrameToURL(root->child_at(0), frame_url); |
| 9903 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host()); | 9903 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host()); |
| 9904 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url); | 9904 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url); |
| 9905 EXPECT_EQ(b_site_instance, | 9905 EXPECT_EQ(b_site_instance, |
| 9906 root->child_at(0)->current_frame_host()->GetSiteInstance()); | 9906 root->child_at(0)->current_frame_host()->GetSiteInstance()); |
| 9907 } | 9907 } |
| 9908 | 9908 |
| 9909 } // namespace content | 9909 } // namespace content |
| OLD | NEW |