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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2727803004: Replace string by enum in WebParsedFeaturePolicyDeclaration#feature (Closed)
Patch Set: Set upstream Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 671
672 protected: 672 protected:
673 void SetUpCommandLine(base::CommandLine* command_line) override { 673 void SetUpCommandLine(base::CommandLine* command_line) override {
674 SitePerProcessBrowserTest::SetUpCommandLine(command_line); 674 SitePerProcessBrowserTest::SetUpCommandLine(command_line);
675 // TODO(iclelland): Remove this switch when Feature Policy ships. 675 // TODO(iclelland): Remove this switch when Feature Policy ships.
676 // https://crbug.com/623682 676 // https://crbug.com/623682
677 command_line->AppendSwitchASCII(switches::kEnableBlinkFeatures, 677 command_line->AppendSwitchASCII(switches::kEnableBlinkFeatures,
678 "FeaturePolicy"); 678 "FeaturePolicy");
679 } 679 }
680 680
681 ParsedFeaturePolicyHeader CreateFPHeader(const std::string& feature_name, 681 ParsedFeaturePolicyHeader CreateFPHeader(const std::string&.feature,
iclelland 2017/03/06 13:55:59 Looks like there are some extra "." characters in
682 const std::vector<GURL>& origins) { 682 const std::vector<GURL>& origins) {
683 ParsedFeaturePolicyHeader result(1); 683 ParsedFeaturePolicyHeader result(1);
684 result[0].feature_name = feature_name; 684 result[0].feature =.feature;
iclelland 2017/03/06 13:55:59 Here too
685 result[0].matches_all_origins = false; 685 result[0].matches_all_origins = false;
686 DCHECK(!origins.empty()); 686 DCHECK(!origins.empty());
687 for (const GURL& origin : origins) 687 for (const GURL& origin : origins)
688 result[0].origins.push_back(url::Origin(origin)); 688 result[0].origins.push_back(url::Origin(origin));
689 return result; 689 return result;
690 } 690 }
691 691
692 ParsedFeaturePolicyHeader CreateFPHeaderMatchesAll( 692 ParsedFeaturePolicyHeader CreateFPHeaderMatchesAll(
693 const std::string& feature_name) { 693 const std::string&.feature) {
iclelland 2017/03/06 13:55:59 And here
694 ParsedFeaturePolicyHeader result(1); 694 ParsedFeaturePolicyHeader result(1);
695 result[0].feature_name = feature_name; 695 result[0].feature =.feature;
iclelland 2017/03/06 13:55:59 And here.
696 result[0].matches_all_origins = true; 696 result[0].matches_all_origins = true;
697 return result; 697 return result;
698 } 698 }
699 }; 699 };
700 700
701 bool operator==(const ParsedFeaturePolicyDeclaration& first, 701 bool operator==(const ParsedFeaturePolicyDeclaration& first,
702 const ParsedFeaturePolicyDeclaration& second) { 702 const ParsedFeaturePolicyDeclaration& second) {
703 return std::tie(first.feature_name, first.matches_all_origins, 703 return std::tie(first.feature, first.matches_all_origins, first.origins) ==
704 first.origins) == std::tie(second.feature_name, 704 std::tie(second.feature, second.matches_all_origins, second.origins);
705 second.matches_all_origins,
706 second.origins);
707 } 705 }
708 706
709 double GetFrameDeviceScaleFactor(const ToRenderFrameHost& adapter) { 707 double GetFrameDeviceScaleFactor(const ToRenderFrameHost& adapter) {
710 double device_scale_factor; 708 double device_scale_factor;
711 const char kGetFrameDeviceScaleFactor[] = 709 const char kGetFrameDeviceScaleFactor[] =
712 "window.domAutomationController.send(window.devicePixelRatio);"; 710 "window.domAutomationController.send(window.devicePixelRatio);";
713 EXPECT_TRUE(ExecuteScriptAndExtractDouble(adapter, kGetFrameDeviceScaleFactor, 711 EXPECT_TRUE(ExecuteScriptAndExtractDouble(adapter, kGetFrameDeviceScaleFactor,
714 &device_scale_factor)); 712 &device_scale_factor));
715 return device_scale_factor; 713 return device_scale_factor;
716 } 714 }
(...skipping 8861 matching lines...) Expand 10 before | Expand all | Expand 10 after
9578 9576
9579 // Try the same navigation, but use the browser-initiated path. 9577 // Try the same navigation, but use the browser-initiated path.
9580 NavigateFrameToURL(root->child_at(0), frame_url); 9578 NavigateFrameToURL(root->child_at(0), frame_url);
9581 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host()); 9579 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host());
9582 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url); 9580 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url);
9583 EXPECT_EQ(b_site_instance, 9581 EXPECT_EQ(b_site_instance,
9584 root->child_at(0)->current_frame_host()->GetSiteInstance()); 9582 root->child_at(0)->current_frame_host()->GetSiteInstance());
9585 } 9583 }
9586 9584
9587 } // namespace content 9585 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698