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

Side by Side Diff: chrome/browser/extensions/extension_protocols_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 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 <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
jdoerrie 2017/04/06 14:25:51 #include <utility>
vabr (Chromium) 2017/04/07 20:40:41 Done.
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/run_loop.h" 14 #include "base/run_loop.h"
14 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
16 #include "base/test/test_file_util.h" 17 #include "base/test/test_file_util.h"
17 #include "base/values.h" 18 #include "base/values.h"
18 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h" 19 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h"
19 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
20 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
21 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
22 #include "components/crx_file/id_util.h" 23 #include "components/crx_file/id_util.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 Extension::NO_FLAGS, &error)); 96 Extension::NO_FLAGS, &error));
96 EXPECT_TRUE(extension.get()) << error; 97 EXPECT_TRUE(extension.get()) << error;
97 return extension; 98 return extension;
98 } 99 }
99 100
100 scoped_refptr<Extension> CreateTestResponseHeaderExtension() { 101 scoped_refptr<Extension> CreateTestResponseHeaderExtension() {
101 base::DictionaryValue manifest; 102 base::DictionaryValue manifest;
102 manifest.SetString("name", "An extension with web-accessible resources"); 103 manifest.SetString("name", "An extension with web-accessible resources");
103 manifest.SetString("version", "2"); 104 manifest.SetString("version", "2");
104 105
105 base::ListValue* web_accessible_list = new base::ListValue(); 106 auto web_accessible_list = base::MakeUnique<base::ListValue>();
106 web_accessible_list->AppendString("test.dat"); 107 web_accessible_list->AppendString("test.dat");
107 manifest.Set("web_accessible_resources", web_accessible_list); 108 manifest.Set("web_accessible_resources", std::move(web_accessible_list));
108 109
109 base::FilePath path = GetTestPath("response_headers"); 110 base::FilePath path = GetTestPath("response_headers");
110 111
111 std::string error; 112 std::string error;
112 scoped_refptr<Extension> extension( 113 scoped_refptr<Extension> extension(
113 Extension::Create(path, Manifest::UNPACKED, manifest, 114 Extension::Create(path, Manifest::UNPACKED, manifest,
114 Extension::NO_FLAGS, &error)); 115 Extension::NO_FLAGS, &error));
115 EXPECT_TRUE(extension.get()) << error; 116 EXPECT_TRUE(extension.get()) << error;
116 return extension; 117 return extension;
117 } 118 }
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 content_verifier_->OnExtensionLoaded(testing_profile_.get(), extension.get()); 594 content_verifier_->OnExtensionLoaded(testing_profile_.get(), extension.get());
594 // Wait for PostTask to ContentVerifierIOData::AddData() to finish. 595 // Wait for PostTask to ContentVerifierIOData::AddData() to finish.
595 content::RunAllPendingInMessageLoop(); 596 content::RunAllPendingInMessageLoop();
596 597
597 // Request foo.js. 598 // Request foo.js.
598 EXPECT_EQ(net::OK, DoRequest(*extension, kFooJs)); 599 EXPECT_EQ(net::OK, DoRequest(*extension, kFooJs));
599 test_job_delegate.WaitForDoneReading(extension->id()); 600 test_job_delegate.WaitForDoneReading(extension->id());
600 } 601 }
601 602
602 } // namespace extensions 603 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698