| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
| 9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 PrefService* get() { | 72 PrefService* get() { |
| 73 return prefs_.get(); | 73 return prefs_.get(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 // Ordering matters, we want |prefs_| to be destroyed before |temp_dir_|. | 77 // Ordering matters, we want |prefs_| to be destroyed before |temp_dir_|. |
| 78 ScopedTempDir temp_dir_; | 78 ScopedTempDir temp_dir_; |
| 79 scoped_ptr<PrefService> prefs_; | 79 scoped_ptr<PrefService> prefs_; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 const char* kIdPrefix = "000000000000000000000000000000000000000"; | |
| 83 | |
| 84 // Creates test extensions and inserts them into list. The name and | 82 // Creates test extensions and inserts them into list. The name and |
| 85 // version are all based on their index. If |update_url| is non-null, it | 83 // version are all based on their index. If |update_url| is non-null, it |
| 86 // will be used as the update_url for each extension. | 84 // will be used as the update_url for each extension. |
| 87 void CreateTestExtensions(int count, ExtensionList *list, | 85 void CreateTestExtensions(int count, ExtensionList *list, |
| 88 const std::string* update_url) { | 86 const std::string* update_url) { |
| 89 for (int i = 1; i <= count; i++) { | 87 for (int i = 1; i <= count; i++) { |
| 90 DictionaryValue input; | 88 DictionaryValue input; |
| 91 Extension* e = new Extension(); | 89 #if defined(OS_WIN) |
| 90 FilePath path(StringPrintf(L"c:\\extension%i", i)); |
| 91 #else |
| 92 FilePath path(StringPrintf("/extension%i", i)); |
| 93 #endif |
| 94 Extension* e = new Extension(path); |
| 92 input.SetString(extension_manifest_keys::kVersion, | 95 input.SetString(extension_manifest_keys::kVersion, |
| 93 StringPrintf("%d.0.0.0", i)); | 96 StringPrintf("%d.0.0.0", i)); |
| 94 input.SetString(extension_manifest_keys::kName, | 97 input.SetString(extension_manifest_keys::kName, |
| 95 StringPrintf("Extension %d", i)); | 98 StringPrintf("Extension %d", i)); |
| 96 if (update_url) | 99 if (update_url) |
| 97 input.SetString(extension_manifest_keys::kUpdateURL, *update_url); | 100 input.SetString(extension_manifest_keys::kUpdateURL, *update_url); |
| 98 std::string error; | 101 std::string error; |
| 99 EXPECT_TRUE(e->InitFromValue(input, false, &error)); | 102 EXPECT_TRUE(e->InitFromValue(input, false, &error)); |
| 100 list->push_back(e); | 103 list->push_back(e); |
| 101 } | 104 } |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 // -prodversionmin (shouldn't update if browser version too old) | 601 // -prodversionmin (shouldn't update if browser version too old) |
| 599 // -manifests & updates arriving out of order / interleaved | 602 // -manifests & updates arriving out of order / interleaved |
| 600 // -Profile::GetDefaultRequestContext() returning null | 603 // -Profile::GetDefaultRequestContext() returning null |
| 601 // (should not crash, but just do check later) | 604 // (should not crash, but just do check later) |
| 602 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 605 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
| 603 // -An extension gets uninstalled while updates are in progress (so it doesn't | 606 // -An extension gets uninstalled while updates are in progress (so it doesn't |
| 604 // "come back from the dead") | 607 // "come back from the dead") |
| 605 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 608 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
| 606 // you don't get downgraded accidentally) | 609 // you don't get downgraded accidentally) |
| 607 // -An update manifest mentions multiple updates | 610 // -An update manifest mentions multiple updates |
| OLD | NEW |