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 "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/stl_util.h" | 6 #include "base/stl_util.h" |
7 #include "chrome/browser/extensions/autoupdate_interceptor.h" | 7 #include "chrome/browser/extensions/autoupdate_interceptor.h" |
8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 net::URLFetcher::SetEnableInterceptionForTests(true); | 382 net::URLFetcher::SetEnableInterceptionForTests(true); |
383 | 383 |
384 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/manifest", | 384 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/manifest", |
385 basedir.AppendASCII("manifest_v2.xml")); | 385 basedir.AppendASCII("manifest_v2.xml")); |
386 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/v2.crx", | 386 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/v2.crx", |
387 basedir.AppendASCII("v2.crx")); | 387 basedir.AppendASCII("v2.crx")); |
388 | 388 |
389 const size_t size_before = service->extensions()->size(); | 389 const size_t size_before = service->extensions()->size(); |
390 ASSERT_TRUE(service->disabled_extensions()->is_empty()); | 390 ASSERT_TRUE(service->disabled_extensions()->is_empty()); |
391 | 391 |
392 PendingExtensionManager* pending_extension_manager = | 392 extensions::PendingExtensionManager* pending_extension_manager = |
393 service->pending_extension_manager(); | 393 service->pending_extension_manager(); |
394 | 394 |
395 // The code that reads external_extensions.json uses this method to inform | 395 // The code that reads external_extensions.json uses this method to inform |
396 // the ExtensionService of an extension to download. Using the real code | 396 // the ExtensionService of an extension to download. Using the real code |
397 // is race-prone, because instantating the ExtensionService starts a read | 397 // is race-prone, because instantating the ExtensionService starts a read |
398 // of external_extensions.json before this test function starts. | 398 // of external_extensions.json before this test function starts. |
399 | 399 |
400 EXPECT_TRUE(pending_extension_manager->AddFromExternalUpdateUrl( | 400 EXPECT_TRUE(pending_extension_manager->AddFromExternalUpdateUrl( |
401 kExtensionId, GURL("http://localhost/autoupdate/manifest"), | 401 kExtensionId, GURL("http://localhost/autoupdate/manifest"), |
402 Extension::EXTERNAL_PREF_DOWNLOAD)); | 402 Extension::EXTERNAL_PREF_DOWNLOAD)); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest")); | 612 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest")); |
613 } | 613 } |
614 ASSERT_TRUE(WaitForExtensionInstall()); | 614 ASSERT_TRUE(WaitForExtensionInstall()); |
615 ASSERT_EQ(size_before + 1, service->extensions()->size()); | 615 ASSERT_EQ(size_before + 1, service->extensions()->size()); |
616 extension = service->GetExtensionById(kExtensionId, false); | 616 extension = service->GetExtensionById(kExtensionId, false); |
617 ASSERT_TRUE(extension); | 617 ASSERT_TRUE(extension); |
618 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); | 618 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); |
619 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); | 619 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); |
620 EXPECT_TRUE(service->disabled_extensions()->is_empty()); | 620 EXPECT_TRUE(service->disabled_extensions()->is_empty()); |
621 } | 621 } |
OLD | NEW |