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 // TODO(rickcam): Bug 73183: Add unit tests for image loading | 5 // TODO(rickcam): Bug 73183: Add unit tests for image loading |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "chrome/browser/background_application_list_model.h" | 10 #include "chrome/browser/background_application_list_model.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 DictionaryValue manifest; | 82 DictionaryValue manifest; |
83 manifest.SetString(extension_manifest_keys::kVersion, "1.0.0.0"); | 83 manifest.SetString(extension_manifest_keys::kVersion, "1.0.0.0"); |
84 manifest.SetString(extension_manifest_keys::kName, name); | 84 manifest.SetString(extension_manifest_keys::kName, name); |
85 if (background_permission) { | 85 if (background_permission) { |
86 ListValue* permissions = new ListValue(); | 86 ListValue* permissions = new ListValue(); |
87 manifest.Set(extension_manifest_keys::kPermissions, permissions); | 87 manifest.Set(extension_manifest_keys::kPermissions, permissions); |
88 permissions->Append(Value::CreateStringValue("background")); | 88 permissions->Append(Value::CreateStringValue("background")); |
89 } | 89 } |
90 std::string error; | 90 std::string error; |
91 scoped_refptr<Extension> extension = Extension::Create( | 91 scoped_refptr<Extension> extension = Extension::Create( |
92 bogus_file_path().AppendASCII(name), Extension::INVALID, manifest, false, | 92 bogus_file_path().AppendASCII(name), Extension::INVALID, manifest, |
93 true, &error); | 93 Extension::STRICT_ERROR_CHECKS, &error); |
94 // Cannot ASSERT_* here because that attempts an illegitimate return. | 94 // Cannot ASSERT_* here because that attempts an illegitimate return. |
95 // Cannot EXPECT_NE here because that assumes non-pointers unlike EXPECT_EQ | 95 // Cannot EXPECT_NE here because that assumes non-pointers unlike EXPECT_EQ |
96 EXPECT_TRUE(extension.get() != NULL) << error; | 96 EXPECT_TRUE(extension.get() != NULL) << error; |
97 return extension; | 97 return extension; |
98 } | 98 } |
99 | 99 |
100 // With minimal test logic, verifies behavior over an explicit set of | 100 // With minimal test logic, verifies behavior over an explicit set of |
101 // extensions, of which some are Background Apps and others are not. | 101 // extensions, of which some are Background Apps and others are not. |
102 TEST_F(BackgroundApplicationListModelTest, LoadExplicitExtensions) { | 102 TEST_F(BackgroundApplicationListModelTest, LoadExplicitExtensions) { |
103 InitializeEmptyExtensionService(); | 103 InitializeEmptyExtensionService(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 extensions.erase(cursor); | 232 extensions.erase(cursor); |
233 --count; | 233 --count; |
234 ASSERT_EQ(count, extensions.size()); | 234 ASSERT_EQ(count, extensions.size()); |
235 service->UninstallExtension(extension->id(), false); | 235 service->UninstallExtension(extension->id(), false); |
236 ASSERT_EQ(count, service->extensions()->size()); | 236 ASSERT_EQ(count, service->extensions()->size()); |
237 ASSERT_EQ(expected, model->size()); | 237 ASSERT_EQ(expected, model->size()); |
238 } | 238 } |
239 } | 239 } |
240 } | 240 } |
241 } | 241 } |
OLD | NEW |