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

Side by Side Diff: chrome/browser/extensions/webstore_inline_installer_unittest.cc

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Fix SupervisedUserWhitelistInstaller Created 3 years, 8 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 <vector> 5 #include <vector>
jdoerrie 2017/04/06 14:25:51 #include <utility>
vabr (Chromium) 2017/04/07 20:40:41 Done.
6 6
7 #include "base/memory/ptr_util.h"
7 #include "chrome/browser/extensions/webstore_inline_installer.h" 8 #include "chrome/browser/extensions/webstore_inline_installer.h"
8 #include "chrome/common/extensions/webstore_install_result.h" 9 #include "chrome/common/extensions/webstore_install_result.h"
9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
10 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 namespace extensions { 15 namespace extensions {
15 16
16 namespace { 17 namespace {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 scoped_refptr<TestWebstoreInlineInstaller> installer = 89 scoped_refptr<TestWebstoreInlineInstaller> installer =
89 new TestWebstoreInlineInstaller(web_contents_.get(), requestor_url); 90 new TestWebstoreInlineInstaller(web_contents_.get(), requestor_url);
90 return installer->TestCheckRequestorPermitted(webstore_data); 91 return installer->TestCheckRequestorPermitted(webstore_data);
91 } 92 }
92 93
93 // Simulates a test against a list of verified site strings from a Webstore 94 // Simulates a test against a list of verified site strings from a Webstore
94 // item's "verified_sites" manifest entry. 95 // item's "verified_sites" manifest entry.
95 bool WebstoreInlineInstallerTest::TestMultipleVerifiedSites( 96 bool WebstoreInlineInstallerTest::TestMultipleVerifiedSites(
96 const std::string& requestor_url, 97 const std::string& requestor_url,
97 const std::vector<std::string>& verified_sites) { 98 const std::vector<std::string>& verified_sites) {
98 base::ListValue* sites = new base::ListValue(); 99 auto sites = base::MakeUnique<base::ListValue>();
99 for (std::vector<std::string>::const_iterator it = verified_sites.begin(); 100 for (std::vector<std::string>::const_iterator it = verified_sites.begin();
100 it != verified_sites.end(); ++it) { 101 it != verified_sites.end(); ++it) {
101 sites->AppendString(*it); 102 sites->AppendString(*it);
102 } 103 }
103 base::DictionaryValue webstore_data; 104 base::DictionaryValue webstore_data;
104 webstore_data.Set("verified_sites", sites); 105 webstore_data.Set("verified_sites", std::move(sites));
105 106
106 scoped_refptr<TestWebstoreInlineInstaller> installer = 107 scoped_refptr<TestWebstoreInlineInstaller> installer =
107 new TestWebstoreInlineInstaller(web_contents_.get(), requestor_url); 108 new TestWebstoreInlineInstaller(web_contents_.get(), requestor_url);
108 return installer->TestCheckRequestorPermitted(webstore_data); 109 return installer->TestCheckRequestorPermitted(webstore_data);
109 } 110 }
110 111
111 } // namespace 112 } // namespace
112 113
113 TEST_F(WebstoreInlineInstallerTest, DomainVerification) { 114 TEST_F(WebstoreInlineInstallerTest, DomainVerification) {
114 // Exact domain match. 115 // Exact domain match.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 verified_sites)); 220 verified_sites));
220 221
221 EXPECT_FALSE(TestMultipleVerifiedSites("http://baz.example.com", 222 EXPECT_FALSE(TestMultipleVerifiedSites("http://baz.example.com",
222 verified_sites)); 223 verified_sites));
223 224
224 EXPECT_FALSE(TestMultipleVerifiedSites("http://bar.example.com:456", 225 EXPECT_FALSE(TestMultipleVerifiedSites("http://bar.example.com:456",
225 verified_sites)); 226 verified_sites));
226 } 227 }
227 228
228 } // namespace extensions 229 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698