| 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/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 if (!launch_url.empty()) | 30 if (!launch_url.empty()) |
| 31 manifest.SetString("app.launch.web_url", launch_url); | 31 manifest.SetString("app.launch.web_url", launch_url); |
| 32 | 32 |
| 33 if (!extent.empty()) { | 33 if (!extent.empty()) { |
| 34 ListValue* urls = new ListValue(); | 34 ListValue* urls = new ListValue(); |
| 35 manifest.Set("app.urls", urls); | 35 manifest.Set("app.urls", urls); |
| 36 urls->Append(Value::CreateStringValue(extent)); | 36 urls->Append(Value::CreateStringValue(extent)); |
| 37 } | 37 } |
| 38 | 38 |
| 39 const bool kRequireKey = false; | |
| 40 const bool kStrictErrorChecks = true; | |
| 41 std::string error; | 39 std::string error; |
| 42 scoped_refptr<Extension> extension( | 40 scoped_refptr<Extension> extension( |
| 43 Extension::Create(path, Extension::INTERNAL, manifest, kRequireKey, | 41 Extension::Create(path, Extension::INTERNAL, manifest, |
| 44 kStrictErrorChecks, &error)); | 42 Extension::STRICT_ERROR_CHECKS, &error)); |
| 45 EXPECT_TRUE(extension.get()) << error; | 43 EXPECT_TRUE(extension.get()) << error; |
| 46 return extension; | 44 return extension; |
| 47 } | 45 } |
| 48 | 46 |
| 49 } // namespace | 47 } // namespace |
| 50 | 48 |
| 51 TEST(ExtensionSetTest, ExtensionSet) { | 49 TEST(ExtensionSetTest, ExtensionSet) { |
| 52 scoped_refptr<Extension> ext1(CreateTestExtension( | 50 scoped_refptr<Extension> ext1(CreateTestExtension( |
| 53 "a", "https://chrome.google.com/launch", "https://chrome.google.com/")); | 51 "a", "https://chrome.google.com/launch", "https://chrome.google.com/")); |
| 54 | 52 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Both of these should be NULL, which mean true for InSameExtent. | 108 // Both of these should be NULL, which mean true for InSameExtent. |
| 111 EXPECT_TRUE(extensions.InSameExtent( | 109 EXPECT_TRUE(extensions.InSameExtent( |
| 112 GURL("http://www.google.com/"), | 110 GURL("http://www.google.com/"), |
| 113 GURL("http://blog.chromium.org/"))); | 111 GURL("http://blog.chromium.org/"))); |
| 114 | 112 |
| 115 // Remove one of the extensions. | 113 // Remove one of the extensions. |
| 116 extensions.Remove(ext2->id()); | 114 extensions.Remove(ext2->id()); |
| 117 EXPECT_EQ(2u, extensions.size()); | 115 EXPECT_EQ(2u, extensions.size()); |
| 118 EXPECT_FALSE(extensions.GetByID(ext2->id())); | 116 EXPECT_FALSE(extensions.GetByID(ext2->id())); |
| 119 } | 117 } |
| OLD | NEW |