| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // returned extension will include background permission iff | 50 // returned extension will include background permission iff |
| 51 // |background_permission| is true. | 51 // |background_permission| is true. |
| 52 static scoped_refptr<Extension> CreateExtension(const std::string& name, | 52 static scoped_refptr<Extension> CreateExtension(const std::string& name, |
| 53 bool background_permission) { | 53 bool background_permission) { |
| 54 DictionaryValue manifest; | 54 DictionaryValue manifest; |
| 55 manifest.SetString(extension_manifest_keys::kVersion, "1.0.0.0"); | 55 manifest.SetString(extension_manifest_keys::kVersion, "1.0.0.0"); |
| 56 manifest.SetString(extension_manifest_keys::kName, name); | 56 manifest.SetString(extension_manifest_keys::kName, name); |
| 57 if (background_permission) { | 57 if (background_permission) { |
| 58 ListValue* permissions = new ListValue(); | 58 ListValue* permissions = new ListValue(); |
| 59 manifest.Set(extension_manifest_keys::kPermissions, permissions); | 59 manifest.Set(extension_manifest_keys::kPermissions, permissions); |
| 60 permissions->Append(Value::CreateStringValue("background")); | 60 permissions->Append(base::StringValue::New("background")); |
| 61 } | 61 } |
| 62 std::string error; | 62 std::string error; |
| 63 scoped_refptr<Extension> extension = Extension::Create( | 63 scoped_refptr<Extension> extension = Extension::Create( |
| 64 bogus_file_path().AppendASCII(name), Extension::INVALID, manifest, | 64 bogus_file_path().AppendASCII(name), Extension::INVALID, manifest, |
| 65 Extension::STRICT_ERROR_CHECKS, &error); | 65 Extension::STRICT_ERROR_CHECKS, &error); |
| 66 // Cannot ASSERT_* here because that attempts an illegitimate return. | 66 // Cannot ASSERT_* here because that attempts an illegitimate return. |
| 67 // Cannot EXPECT_NE here because that assumes non-pointers unlike EXPECT_EQ | 67 // Cannot EXPECT_NE here because that assumes non-pointers unlike EXPECT_EQ |
| 68 EXPECT_TRUE(extension.get() != NULL) << error; | 68 EXPECT_TRUE(extension.get() != NULL) << error; |
| 69 return extension; | 69 return extension; |
| 70 } | 70 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 break; | 331 break; |
| 332 case 2: | 332 case 2: |
| 333 TogglePermission(service, &extensions, model.get(), &expected, &count); | 333 TogglePermission(service, &extensions, model.get(), &expected, &count); |
| 334 break; | 334 break; |
| 335 default: | 335 default: |
| 336 NOTREACHED(); | 336 NOTREACHED(); |
| 337 break; | 337 break; |
| 338 } | 338 } |
| 339 } | 339 } |
| 340 } | 340 } |
| OLD | NEW |