| 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 #include "chrome/browser/media_gallery/media_galleries_test_util.h" | 5 #include "chrome/browser/media_gallery/media_galleries_test_util.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 DictionaryValue* media_galleries_permission = new DictionaryValue(); | 38 DictionaryValue* media_galleries_permission = new DictionaryValue(); |
| 39 media_galleries_permission->Set("mediaGalleries", permission_detail_list); | 39 media_galleries_permission->Set("mediaGalleries", permission_detail_list); |
| 40 ListValue* permission_list = new ListValue; | 40 ListValue* permission_list = new ListValue; |
| 41 permission_list->Append(media_galleries_permission); | 41 permission_list->Append(media_galleries_permission); |
| 42 manifest->Set(extension_manifest_keys::kPermissions, permission_list); | 42 manifest->Set(extension_manifest_keys::kPermissions, permission_list); |
| 43 | 43 |
| 44 | 44 |
| 45 FilePath path = profile->GetPath().AppendASCII(name); | 45 FilePath path = profile->GetPath().AppendASCII(name); |
| 46 std::string errors; | 46 std::string errors; |
| 47 scoped_refptr<extensions::Extension> extension = | 47 scoped_refptr<extensions::Extension> extension = |
| 48 extensions::Extension::Create(path, extensions::Extension::INTERNAL, | 48 extensions::Extension::Create(path, extensions::Manifest::INTERNAL, |
| 49 *manifest.get(), | 49 *manifest.get(), |
| 50 extensions::Extension::NO_FLAGS, &errors); | 50 extensions::Extension::NO_FLAGS, &errors); |
| 51 EXPECT_TRUE(extension.get() != NULL) << errors; | 51 EXPECT_TRUE(extension.get() != NULL) << errors; |
| 52 EXPECT_TRUE(extensions::Extension::IdIsValid(extension->id())); | 52 EXPECT_TRUE(extensions::Extension::IdIsValid(extension->id())); |
| 53 if (!extension.get() || !extensions::Extension::IdIsValid(extension->id())) | 53 if (!extension.get() || !extensions::Extension::IdIsValid(extension->id())) |
| 54 return NULL; | 54 return NULL; |
| 55 | 55 |
| 56 ExtensionService* extension_service = | 56 ExtensionService* extension_service = |
| 57 extensions::ExtensionSystem::Get(profile)->extension_service(); | 57 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 58 extension_service->extension_prefs()->OnExtensionInstalled( | 58 extension_service->extension_prefs()->OnExtensionInstalled( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 if (PathService::Get(kDirectoryKeys[i], &path) && | 95 if (PathService::Get(kDirectoryKeys[i], &path) && |
| 96 file_util::DirectoryExists(path)) { | 96 file_util::DirectoryExists(path)) { |
| 97 ++num_galleries_; | 97 ++num_galleries_; |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 ASSERT_GT(num_galleries_, 0); | 100 ASSERT_GT(num_galleries_, 0); |
| 101 #endif | 101 #endif |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace chrome | 104 } // namespace chrome |
| OLD | NEW |