| 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 | 655 |
| 656 protected: | 656 protected: |
| 657 void SetUpCommandLine(base::CommandLine* command_line) override { | 657 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 658 SitePerProcessBrowserTest::SetUpCommandLine(command_line); | 658 SitePerProcessBrowserTest::SetUpCommandLine(command_line); |
| 659 // TODO(iclelland): Remove this switch when Feature Policy ships. | 659 // TODO(iclelland): Remove this switch when Feature Policy ships. |
| 660 // https://crbug.com/623682 | 660 // https://crbug.com/623682 |
| 661 command_line->AppendSwitchASCII(switches::kEnableBlinkFeatures, | 661 command_line->AppendSwitchASCII(switches::kEnableBlinkFeatures, |
| 662 "FeaturePolicy"); | 662 "FeaturePolicy"); |
| 663 } | 663 } |
| 664 | 664 |
| 665 ParsedFeaturePolicy CreateFPHeader(const std::string& feature_name, | 665 FeaturePolicyHeader CreateFPHeader(const std::string& feature_name, |
| 666 const std::vector<GURL>& origins) { | 666 const std::vector<GURL>& origins) { |
| 667 ParsedFeaturePolicy result(1); | 667 FeaturePolicyHeader result(1); |
| 668 result[0].feature_name = feature_name; | 668 result[0].feature_name = feature_name; |
| 669 result[0].matches_all_origins = false; | 669 result[0].matches_all_origins = false; |
| 670 DCHECK(!origins.empty()); | 670 DCHECK(!origins.empty()); |
| 671 for (const GURL& origin : origins) | 671 for (const GURL& origin : origins) |
| 672 result[0].origins.push_back(url::Origin(origin)); | 672 result[0].origins.push_back(url::Origin(origin)); |
| 673 return result; | 673 return result; |
| 674 } | 674 } |
| 675 | 675 |
| 676 ParsedFeaturePolicy CreateFPHeaderMatchesAll( | 676 FeaturePolicyHeader CreateFPHeaderMatchesAll( |
| 677 const std::string& feature_name) { | 677 const std::string& feature_name) { |
| 678 ParsedFeaturePolicy result(1); | 678 FeaturePolicyHeader result(1); |
| 679 result[0].feature_name = feature_name; | 679 result[0].feature_name = feature_name; |
| 680 result[0].matches_all_origins = true; | 680 result[0].matches_all_origins = true; |
| 681 return result; | 681 return result; |
| 682 } | 682 } |
| 683 }; | 683 }; |
| 684 | 684 |
| 685 bool operator==(const FeaturePolicyParsedWhitelist& first, | 685 bool operator==(const FeaturePolicyParsedDeclaration& first, |
| 686 const FeaturePolicyParsedWhitelist& second) { | 686 const FeaturePolicyParsedDeclaration& second) { |
| 687 return std::tie(first.feature_name, first.matches_all_origins, | 687 return std::tie(first.feature_name, first.matches_all_origins, |
| 688 first.origins) == std::tie(second.feature_name, | 688 first.origins) == std::tie(second.feature_name, |
| 689 second.matches_all_origins, | 689 second.matches_all_origins, |
| 690 second.origins); | 690 second.origins); |
| 691 } | 691 } |
| 692 | 692 |
| 693 double GetFrameDeviceScaleFactor(const ToRenderFrameHost& adapter) { | 693 double GetFrameDeviceScaleFactor(const ToRenderFrameHost& adapter) { |
| 694 double device_scale_factor; | 694 double device_scale_factor; |
| 695 const char kGetFrameDeviceScaleFactor[] = | 695 const char kGetFrameDeviceScaleFactor[] = |
| 696 "window.domAutomationController.send(window.devicePixelRatio);"; | 696 "window.domAutomationController.send(window.devicePixelRatio);"; |
| (...skipping 8395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9092 shell(), embedded_test_server()->GetURL("b.com", "/title3.html"))); | 9092 shell(), embedded_test_server()->GetURL("b.com", "/title3.html"))); |
| 9093 | 9093 |
| 9094 // Pretend that a.com just requested a context menu. This used to cause a | 9094 // Pretend that a.com just requested a context menu. This used to cause a |
| 9095 // because the RenderWidgetHostView is destroyed when the frame is swapped and | 9095 // because the RenderWidgetHostView is destroyed when the frame is swapped and |
| 9096 // added to pending delete list. | 9096 // added to pending delete list. |
| 9097 rfh->OnMessageReceived( | 9097 rfh->OnMessageReceived( |
| 9098 FrameHostMsg_ContextMenu(rfh->GetRoutingID(), ContextMenuParams())); | 9098 FrameHostMsg_ContextMenu(rfh->GetRoutingID(), ContextMenuParams())); |
| 9099 } | 9099 } |
| 9100 | 9100 |
| 9101 } // namespace content | 9101 } // namespace content |
| OLD | NEW |