| 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/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 builder.AddPendingExtension( | 884 builder.AddPendingExtension( |
| 885 GenerateId("foo"), PendingExtensionInfo(GURL("http:google.com:foo"), | 885 GenerateId("foo"), PendingExtensionInfo(GURL("http:google.com:foo"), |
| 886 false, false, true, false)); | 886 false, false, true, false)); |
| 887 EXPECT_TRUE(builder.GetFetches().empty()); | 887 EXPECT_TRUE(builder.GetFetches().empty()); |
| 888 | 888 |
| 889 // Extensions with empty IDs should be rejected. | 889 // Extensions with empty IDs should be rejected. |
| 890 builder.AddPendingExtension( | 890 builder.AddPendingExtension( |
| 891 "", PendingExtensionInfo(GURL(), false, false, true, false)); | 891 "", PendingExtensionInfo(GURL(), false, false, true, false)); |
| 892 EXPECT_TRUE(builder.GetFetches().empty()); | 892 EXPECT_TRUE(builder.GetFetches().empty()); |
| 893 | 893 |
| 894 // TODO(akalin): Test that extensions with empty update URLs |
| 895 // converted from user scripts are rejected. |
| 896 |
| 894 // Extensions with empty update URLs should have a default one | 897 // Extensions with empty update URLs should have a default one |
| 895 // filled in. | 898 // filled in. |
| 896 builder.AddPendingExtension( | 899 builder.AddPendingExtension( |
| 897 GenerateId("foo"), PendingExtensionInfo(GURL(), | 900 GenerateId("foo"), PendingExtensionInfo(GURL(), |
| 898 false, false, true, false)); | 901 false, false, true, false)); |
| 899 std::vector<ManifestFetchData*> fetches = builder.GetFetches(); | 902 std::vector<ManifestFetchData*> fetches = builder.GetFetches(); |
| 900 ASSERT_EQ(1u, fetches.size()); | 903 ASSERT_EQ(1u, fetches.size()); |
| 901 scoped_ptr<ManifestFetchData> fetch(fetches[0]); | 904 scoped_ptr<ManifestFetchData> fetch(fetches[0]); |
| 902 fetches.clear(); | 905 fetches.clear(); |
| 903 EXPECT_FALSE(fetch->base_url().is_empty()); | 906 EXPECT_FALSE(fetch->base_url().is_empty()); |
| 904 EXPECT_FALSE(fetch->full_url().is_empty()); | 907 EXPECT_FALSE(fetch->full_url().is_empty()); |
| 905 } | 908 } |
| 906 | 909 |
| 907 // TODO(asargent) - (http://crbug.com/12780) add tests for: | 910 // TODO(asargent) - (http://crbug.com/12780) add tests for: |
| 908 // -prodversionmin (shouldn't update if browser version too old) | 911 // -prodversionmin (shouldn't update if browser version too old) |
| 909 // -manifests & updates arriving out of order / interleaved | 912 // -manifests & updates arriving out of order / interleaved |
| 910 // -Profile::GetDefaultRequestContext() returning null | 913 // -Profile::GetDefaultRequestContext() returning null |
| 911 // (should not crash, but just do check later) | 914 // (should not crash, but just do check later) |
| 912 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 915 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
| 913 // -An extension gets uninstalled while updates are in progress (so it doesn't | 916 // -An extension gets uninstalled while updates are in progress (so it doesn't |
| 914 // "come back from the dead") | 917 // "come back from the dead") |
| 915 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 918 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
| 916 // you don't get downgraded accidentally) | 919 // you don't get downgraded accidentally) |
| 917 // -An update manifest mentions multiple updates | 920 // -An update manifest mentions multiple updates |
| OLD | NEW |