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/background_application_list_model.h" | 10 #include "chrome/browser/background/background_application_list_model.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 DictionaryValue manifest; | 53 DictionaryValue manifest; |
54 manifest.SetString(extension_manifest_keys::kVersion, "1.0.0.0"); | 54 manifest.SetString(extension_manifest_keys::kVersion, "1.0.0.0"); |
55 manifest.SetString(extension_manifest_keys::kName, name); | 55 manifest.SetString(extension_manifest_keys::kName, name); |
56 if (background_permission) { | 56 if (background_permission) { |
57 ListValue* permissions = new ListValue(); | 57 ListValue* permissions = new ListValue(); |
58 manifest.Set(extension_manifest_keys::kPermissions, permissions); | 58 manifest.Set(extension_manifest_keys::kPermissions, permissions); |
59 permissions->Append(Value::CreateStringValue("background")); | 59 permissions->Append(Value::CreateStringValue("background")); |
60 } | 60 } |
61 std::string error; | 61 std::string error; |
62 scoped_refptr<Extension> extension = Extension::Create( | 62 scoped_refptr<Extension> extension = Extension::Create( |
63 bogus_file_path().AppendASCII(name), Extension::INVALID, manifest, | 63 bogus_file_path().AppendASCII(name), |
64 Extension::STRICT_ERROR_CHECKS, &error); | 64 Extension::INVALID, |
| 65 manifest, |
| 66 Extension::STRICT_ERROR_CHECKS, |
| 67 &error); |
65 // Cannot ASSERT_* here because that attempts an illegitimate return. | 68 // Cannot ASSERT_* here because that attempts an illegitimate return. |
66 // Cannot EXPECT_NE here because that assumes non-pointers unlike EXPECT_EQ | 69 // Cannot EXPECT_NE here because that assumes non-pointers unlike EXPECT_EQ |
67 EXPECT_TRUE(extension.get() != NULL) << error; | 70 EXPECT_TRUE(extension.get() != NULL) << error; |
68 return extension; | 71 return extension; |
69 } | 72 } |
70 | 73 |
71 namespace { | 74 namespace { |
72 std::string GenerateUniqueExtensionName() { | 75 std::string GenerateUniqueExtensionName() { |
73 static int uniqueness = 0; | 76 static int uniqueness = 0; |
74 std::ostringstream output; | 77 std::ostringstream output; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 break; | 333 break; |
331 case 2: | 334 case 2: |
332 TogglePermission(service, &extensions, model.get(), &expected, &count); | 335 TogglePermission(service, &extensions, model.get(), &expected, &count); |
333 break; | 336 break; |
334 default: | 337 default: |
335 NOTREACHED(); | 338 NOTREACHED(); |
336 break; | 339 break; |
337 } | 340 } |
338 } | 341 } |
339 } | 342 } |
OLD | NEW |