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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 "ogjcoiohnmldgjemafoockdghcjciccf")); | 285 "ogjcoiohnmldgjemafoockdghcjciccf")); |
286 | 286 |
287 // Make sure the extension state is the same as before. | 287 // Make sure the extension state is the same as before. |
288 ASSERT_EQ(size_before + 1, service->extensions()->size()); | 288 ASSERT_EQ(size_before + 1, service->extensions()->size()); |
289 extension = service->GetExtensionById( | 289 extension = service->GetExtensionById( |
290 "ogjcoiohnmldgjemafoockdghcjciccf", false); | 290 "ogjcoiohnmldgjemafoockdghcjciccf", false); |
291 ASSERT_TRUE(extension); | 291 ASSERT_TRUE(extension); |
292 ASSERT_EQ("2.0", extension->VersionString()); | 292 ASSERT_EQ("2.0", extension->VersionString()); |
293 } | 293 } |
294 | 294 |
| 295 #if defined(OS_WIN) |
| 296 // Fails consistently on Windows XP, see: http://crbug.com/120640. |
| 297 #define MAYBE_AutoUpdateDisabledExtensions DISABLED_AutoUpdateDisabledExtensions |
| 298 #else |
| 299 #define MAYBE_AutoUpdateDisabledExtensions AutoUpdateDisabledExtensions |
| 300 #endif |
| 301 |
295 // Tests extension autoupdate. | 302 // Tests extension autoupdate. |
296 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, AutoUpdateDisabledExtensions) { | 303 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, |
| 304 MAYBE_AutoUpdateDisabledExtensions) { |
297 NotificationListener notification_listener; | 305 NotificationListener notification_listener; |
298 FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); | 306 FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); |
299 // Note: This interceptor gets requests on the IO thread. | 307 // Note: This interceptor gets requests on the IO thread. |
300 scoped_refptr<AutoUpdateInterceptor> interceptor(new AutoUpdateInterceptor()); | 308 scoped_refptr<AutoUpdateInterceptor> interceptor(new AutoUpdateInterceptor()); |
301 content::URLFetcher::SetEnableInterceptionForTests(true); | 309 content::URLFetcher::SetEnableInterceptionForTests(true); |
302 | 310 |
303 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/manifest", | 311 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/manifest", |
304 basedir.AppendASCII("manifest_v2.xml")); | 312 basedir.AppendASCII("manifest_v2.xml")); |
305 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/v2.crx", | 313 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/v2.crx", |
306 basedir.AppendASCII("v2.crx")); | 314 basedir.AppendASCII("v2.crx")); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest")); | 592 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest")); |
585 } | 593 } |
586 ASSERT_TRUE(WaitForExtensionInstall()); | 594 ASSERT_TRUE(WaitForExtensionInstall()); |
587 ASSERT_EQ(size_before + 1, service->extensions()->size()); | 595 ASSERT_EQ(size_before + 1, service->extensions()->size()); |
588 extension = service->GetExtensionById(kExtensionId, false); | 596 extension = service->GetExtensionById(kExtensionId, false); |
589 ASSERT_TRUE(extension); | 597 ASSERT_TRUE(extension); |
590 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); | 598 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); |
591 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); | 599 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); |
592 EXPECT_TRUE(service->disabled_extensions()->is_empty()); | 600 EXPECT_TRUE(service->disabled_extensions()->is_empty()); |
593 } | 601 } |
OLD | NEW |