| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 static scoped_refptr<Extension> CreateExtensionBase( | 74 static scoped_refptr<Extension> CreateExtensionBase( |
| 75 const std::string& name, | 75 const std::string& name, |
| 76 bool background_permission, | 76 bool background_permission, |
| 77 PushMessagingOption push_messaging) { | 77 PushMessagingOption push_messaging) { |
| 78 base::DictionaryValue manifest; | 78 base::DictionaryValue manifest; |
| 79 manifest.SetString(extensions::manifest_keys::kVersion, "1.0.0.0"); | 79 manifest.SetString(extensions::manifest_keys::kVersion, "1.0.0.0"); |
| 80 manifest.SetString(extensions::manifest_keys::kName, name); | 80 manifest.SetString(extensions::manifest_keys::kName, name); |
| 81 base::ListValue* permissions = new base::ListValue(); | 81 base::ListValue* permissions = new base::ListValue(); |
| 82 manifest.Set(extensions::manifest_keys::kPermissions, permissions); | 82 manifest.Set(extensions::manifest_keys::kPermissions, permissions); |
| 83 if (background_permission) { | 83 if (background_permission) { |
| 84 permissions->Append(base::Value::CreateStringValue("background")); | 84 permissions->Append(new base::StringValue("background")); |
| 85 } | 85 } |
| 86 if (push_messaging == PUSH_MESSAGING_PERMISSION || | 86 if (push_messaging == PUSH_MESSAGING_PERMISSION || |
| 87 push_messaging == PUSH_MESSAGING_BUT_NOT_BACKGROUND) { | 87 push_messaging == PUSH_MESSAGING_BUT_NOT_BACKGROUND) { |
| 88 permissions->Append(base::Value::CreateStringValue("pushMessaging")); | 88 permissions->Append(new base::StringValue("pushMessaging")); |
| 89 } | 89 } |
| 90 | 90 |
| 91 std::string error; | 91 std::string error; |
| 92 scoped_refptr<Extension> extension; | 92 scoped_refptr<Extension> extension; |
| 93 | 93 |
| 94 // There is a whitelist for extensions that have pushMessaging permission but | 94 // There is a whitelist for extensions that have pushMessaging permission but |
| 95 // are not considered a background app. Create a test extension with a known | 95 // are not considered a background app. Create a test extension with a known |
| 96 // test id if needed. | 96 // test id if needed. |
| 97 if (push_messaging == PUSH_MESSAGING_BUT_NOT_BACKGROUND) { | 97 if (push_messaging == PUSH_MESSAGING_BUT_NOT_BACKGROUND) { |
| 98 extension = Extension::Create( | 98 extension = Extension::Create( |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 break; | 502 break; |
| 503 case 2: | 503 case 2: |
| 504 TogglePermission(service, &extensions, model.get(), &expected, &count); | 504 TogglePermission(service, &extensions, model.get(), &expected, &count); |
| 505 break; | 505 break; |
| 506 default: | 506 default: |
| 507 NOTREACHED(); | 507 NOTREACHED(); |
| 508 break; | 508 break; |
| 509 } | 509 } |
| 510 } | 510 } |
| 511 } | 511 } |
| OLD | NEW |