Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/values.h" | |
| 5 #include "chrome/common/extensions/extension.h" | 6 #include "chrome/common/extensions/extension.h" |
| 7 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 6 #include "chrome/common/extensions/extension_test_util.h" | 8 #include "chrome/common/extensions/extension_test_util.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 10 |
| 11 using extensions::Extension; | |
| 12 | |
| 9 namespace extension_test_util { | 13 namespace extension_test_util { |
| 10 | 14 |
| 11 std::string MakeId(std::string seed) { | 15 std::string MakeId(std::string seed) { |
| 12 std::string result; | 16 std::string result; |
| 13 bool success = extensions::Extension::GenerateId(seed, &result); | 17 bool success = Extension::GenerateId(seed, &result); |
| 14 EXPECT_TRUE(success); | 18 EXPECT_TRUE(success); |
| 15 EXPECT_FALSE(result.empty()); | 19 EXPECT_FALSE(result.empty()); |
| 16 EXPECT_TRUE(extensions::Extension::IdIsValid(result)); | 20 EXPECT_TRUE(Extension::IdIsValid(result)); |
| 17 return result; | 21 return result; |
| 18 } | 22 } |
| 19 | 23 |
| 24 scoped_refptr<Extension> CreateExtension(std::string id) { | |
| 25 DictionaryValue values; | |
| 26 values.SetString(extension_manifest_keys::kName, "test"); | |
| 27 values.SetString(extension_manifest_keys::kVersion, "0.1"); | |
| 28 std::string error; | |
| 29 return id.empty() ? | |
| 30 Extension::Create(FilePath(), Extension::INTERNAL, values, | |
|
Yoyo Zhou
2012/07/09 17:06:37
This is not needed.
Devlin
2012/07/09 20:48:26
Done.
| |
| 31 Extension::NO_FLAGS, &error) : | |
| 32 Extension::Create(FilePath(), Extension::INTERNAL, values, | |
| 33 Extension::NO_FLAGS, id, &error); | |
| 34 } | |
| 35 | |
| 20 } // namespace extension_test_util | 36 } // namespace extension_test_util |
| OLD | NEW |