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

Side by Side Diff: extensions/common/file_util_unittest.cc

Issue 2899743002: Remove raw base::DictionaryValue::Set in //extensions (Closed)
Patch Set: Addressed nit Created 3 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/common/file_util.h" 5 #include "extensions/common/file_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/json/json_string_value_serializer.h" 13 #include "base/json/json_string_value_serializer.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h"
15 #include "base/path_service.h" 16 #include "base/path_service.h"
16 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "base/values.h"
18 #include "build/build_config.h" 20 #include "build/build_config.h"
19 #include "extensions/common/constants.h" 21 #include "extensions/common/constants.h"
20 #include "extensions/common/extension.h" 22 #include "extensions/common/extension.h"
21 #include "extensions/common/extension_paths.h" 23 #include "extensions/common/extension_paths.h"
22 #include "extensions/common/manifest.h" 24 #include "extensions/common/manifest.h"
23 #include "extensions/common/manifest_constants.h" 25 #include "extensions/common/manifest_constants.h"
24 #include "extensions/strings/grit/extensions_strings.h" 26 #include "extensions/strings/grit/extensions_strings.h"
25 #include "testing/gmock/include/gmock/gmock.h" 27 #include "testing/gmock/include/gmock/gmock.h"
26 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
27 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 285
284 TEST_F(FileUtilTest, BackgroundScriptsMustExist) { 286 TEST_F(FileUtilTest, BackgroundScriptsMustExist) {
285 base::ScopedTempDir temp; 287 base::ScopedTempDir temp;
286 ASSERT_TRUE(temp.CreateUniqueTempDir()); 288 ASSERT_TRUE(temp.CreateUniqueTempDir());
287 289
288 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); 290 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
289 value->SetString("name", "test"); 291 value->SetString("name", "test");
290 value->SetString("version", "1"); 292 value->SetString("version", "1");
291 value->SetInteger("manifest_version", 1); 293 value->SetInteger("manifest_version", 1);
292 294
293 base::ListValue* scripts = new base::ListValue(); 295 base::ListValue* scripts =
296 value->SetList("background.scripts", base::MakeUnique<base::ListValue>());
294 scripts->AppendString("foo.js"); 297 scripts->AppendString("foo.js");
295 value->Set("background.scripts", scripts);
296 298
297 std::string error; 299 std::string error;
298 std::vector<extensions::InstallWarning> warnings; 300 std::vector<extensions::InstallWarning> warnings;
299 scoped_refptr<Extension> extension = LoadExtensionManifest( 301 scoped_refptr<Extension> extension = LoadExtensionManifest(
300 *value, temp.GetPath(), Manifest::UNPACKED, 0, &error); 302 *value, temp.GetPath(), Manifest::UNPACKED, 0, &error);
301 ASSERT_TRUE(extension.get()) << error; 303 ASSERT_TRUE(extension.get()) << error;
302 304
303 EXPECT_FALSE( 305 EXPECT_FALSE(
304 file_util::ValidateExtension(extension.get(), &error, &warnings)); 306 file_util::ValidateExtension(extension.get(), &error, &warnings));
305 EXPECT_EQ( 307 EXPECT_EQ(
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 base::FilePath actual_path = 484 base::FilePath actual_path =
483 extensions::file_util::ExtensionURLToRelativeFilePath(url); 485 extensions::file_util::ExtensionURLToRelativeFilePath(url);
484 EXPECT_FALSE(actual_path.IsAbsolute()) << 486 EXPECT_FALSE(actual_path.IsAbsolute()) <<
485 " For the path " << actual_path.value(); 487 " For the path " << actual_path.value();
486 EXPECT_EQ(expected_path.value(), actual_path.value()) << 488 EXPECT_EQ(expected_path.value(), actual_path.value()) <<
487 " For the path " << url; 489 " For the path " << url;
488 } 490 }
489 } 491 }
490 492
491 } // namespace extensions 493 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/extension_set_unittest.cc ('k') | extensions/common/manifest_handlers/oauth2_manifest_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698