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 <list> | 5 #include <list> |
6 #include <map> | 6 #include <map> |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 // All of our tests that need to use private APIs of ExtensionUpdater live | 486 // All of our tests that need to use private APIs of ExtensionUpdater live |
487 // inside this class (which is a friend to ExtensionUpdater). | 487 // inside this class (which is a friend to ExtensionUpdater). |
488 class ExtensionUpdaterTest : public testing::Test { | 488 class ExtensionUpdaterTest : public testing::Test { |
489 public: | 489 public: |
490 ExtensionUpdaterTest() | 490 ExtensionUpdaterTest() |
491 : thread_bundle_( | 491 : thread_bundle_( |
492 content::TestBrowserThreadBundle::IO_MAINLOOP) { | 492 content::TestBrowserThreadBundle::IO_MAINLOOP) { |
493 } | 493 } |
494 | 494 |
495 virtual void SetUp() OVERRIDE { | 495 virtual void SetUp() OVERRIDE { |
496 prefs_.reset(new TestExtensionPrefs(base::MessageLoopProxy::current())); | 496 prefs_.reset( |
| 497 new TestExtensionPrefs(base::MessageLoopProxy::current(), NULL)); |
497 content::RenderProcessHost::SetRunRendererInProcess(true); | 498 content::RenderProcessHost::SetRunRendererInProcess(true); |
498 } | 499 } |
499 | 500 |
500 virtual void TearDown() OVERRIDE { | 501 virtual void TearDown() OVERRIDE { |
501 // Some tests create URLRequestContextGetters, whose destruction must run | 502 // Some tests create URLRequestContextGetters, whose destruction must run |
502 // on the IO thread. Make sure the IO loop spins before shutdown so that | 503 // on the IO thread. Make sure the IO loop spins before shutdown so that |
503 // those objects are released. | 504 // those objects are released. |
504 RunUntilIdle(); | 505 RunUntilIdle(); |
505 prefs_.reset(); | 506 prefs_.reset(); |
506 content::RenderProcessHost::SetRunRendererInProcess(false); | 507 content::RenderProcessHost::SetRunRendererInProcess(false); |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 // on the delta between now and the last ping time (or in the case of active | 1227 // on the delta between now and the last ping time (or in the case of active |
1227 // pings, that delta plus whether the app has been active). | 1228 // pings, that delta plus whether the app has been active). |
1228 void TestGalleryRequests(int rollcall_ping_days, | 1229 void TestGalleryRequests(int rollcall_ping_days, |
1229 int active_ping_days, | 1230 int active_ping_days, |
1230 bool active_bit, | 1231 bool active_bit, |
1231 bool expect_brand_code) { | 1232 bool expect_brand_code) { |
1232 net::TestURLFetcherFactory factory; | 1233 net::TestURLFetcherFactory factory; |
1233 | 1234 |
1234 // Set up 2 mock extensions, one with a google.com update url and one | 1235 // Set up 2 mock extensions, one with a google.com update url and one |
1235 // without. | 1236 // without. |
1236 prefs_.reset(new TestExtensionPrefs(base::MessageLoopProxy::current())); | 1237 prefs_.reset( |
| 1238 new TestExtensionPrefs(base::MessageLoopProxy::current(), NULL)); |
1237 ServiceForManifestTests service(prefs_.get()); | 1239 ServiceForManifestTests service(prefs_.get()); |
1238 ExtensionList tmp; | 1240 ExtensionList tmp; |
1239 GURL url1("http://clients2.google.com/service/update2/crx"); | 1241 GURL url1("http://clients2.google.com/service/update2/crx"); |
1240 GURL url2("http://www.somewebsite.com"); | 1242 GURL url2("http://www.somewebsite.com"); |
1241 service.CreateTestExtensions(1, 1, &tmp, &url1.possibly_invalid_spec(), | 1243 service.CreateTestExtensions(1, 1, &tmp, &url1.possibly_invalid_spec(), |
1242 Manifest::INTERNAL); | 1244 Manifest::INTERNAL); |
1243 service.CreateTestExtensions(2, 1, &tmp, &url2.possibly_invalid_spec(), | 1245 service.CreateTestExtensions(2, 1, &tmp, &url2.possibly_invalid_spec(), |
1244 Manifest::INTERNAL); | 1246 Manifest::INTERNAL); |
1245 EXPECT_EQ(2u, tmp.size()); | 1247 EXPECT_EQ(2u, tmp.size()); |
1246 service.set_extensions(tmp); | 1248 service.set_extensions(tmp); |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 // -prodversionmin (shouldn't update if browser version too old) | 1641 // -prodversionmin (shouldn't update if browser version too old) |
1640 // -manifests & updates arriving out of order / interleaved | 1642 // -manifests & updates arriving out of order / interleaved |
1641 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 1643 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
1642 // -An extension gets uninstalled while updates are in progress (so it doesn't | 1644 // -An extension gets uninstalled while updates are in progress (so it doesn't |
1643 // "come back from the dead") | 1645 // "come back from the dead") |
1644 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 1646 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
1645 // you don't get downgraded accidentally) | 1647 // you don't get downgraded accidentally) |
1646 // -An update manifest mentions multiple updates | 1648 // -An update manifest mentions multiple updates |
1647 | 1649 |
1648 } // namespace extensions | 1650 } // namespace extensions |
OLD | NEW |