Extract SIGPIPE ignoring code to a common place.
[chromium-blink-merge.git] / chrome / common / extensions / extension_test_util.cc
blob5dfa9a64535f7444f5b61ac11993b20c2e7a2854
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
3 // found in the LICENSE file.
5 #include "base/values.h"
6 #include "chrome/common/extensions/extension.h"
7 #include "chrome/common/extensions/extension_manifest_constants.h"
8 #include "chrome/common/extensions/extension_test_util.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 using extensions::Extension;
13 namespace extension_test_util {
15 std::string MakeId(std::string seed) {
16 std::string result;
17 bool success = Extension::GenerateId(seed, &result);
18 EXPECT_TRUE(success);
19 EXPECT_FALSE(result.empty());
20 EXPECT_TRUE(Extension::IdIsValid(result));
21 return result;
24 scoped_refptr<Extension> CreateExtensionWithID(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 Extension::Create(FilePath(), Extension::INTERNAL, values,
30 Extension::NO_FLAGS, id, &error);
33 } // namespace extension_test_util