| 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" |
| 11 #include "chrome/browser/extensions/extension_test_message_listener.h" | 11 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 12 #include "chrome/browser/extensions/updater/extension_updater.h" | 12 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 13 #include "chrome/browser/infobars/infobar_tab_helper.h" | 13 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
| 15 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 15 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 19 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
| 20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| 22 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
| 23 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 24 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
| 25 #include "content/public/common/url_fetcher.h" | 25 #include "content/public/common/url_fetcher.h" |
| 26 | 26 |
| 27 using extensions::Extension; |
| 28 |
| 27 class ExtensionManagementTest : public ExtensionBrowserTest { | 29 class ExtensionManagementTest : public ExtensionBrowserTest { |
| 28 protected: | 30 protected: |
| 29 // Helper method that returns whether the extension is at the given version. | 31 // Helper method that returns whether the extension is at the given version. |
| 30 // This calls version(), which must be defined in the extension's bg page, | 32 // This calls version(), which must be defined in the extension's bg page, |
| 31 // as well as asking the extension itself. | 33 // as well as asking the extension itself. |
| 32 // | 34 // |
| 33 // Note that 'version' here means something different than the version field | 35 // Note that 'version' here means something different than the version field |
| 34 // in the extension's manifest. We use the version as reported by the | 36 // in the extension's manifest. We use the version as reported by the |
| 35 // background page to test how overinstalling crx files with the same | 37 // background page to test how overinstalling crx files with the same |
| 36 // manifest version works. | 38 // manifest version works. |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest")); | 611 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest")); |
| 610 } | 612 } |
| 611 ASSERT_TRUE(WaitForExtensionInstall()); | 613 ASSERT_TRUE(WaitForExtensionInstall()); |
| 612 ASSERT_EQ(size_before + 1, service->extensions()->size()); | 614 ASSERT_EQ(size_before + 1, service->extensions()->size()); |
| 613 extension = service->GetExtensionById(kExtensionId, false); | 615 extension = service->GetExtensionById(kExtensionId, false); |
| 614 ASSERT_TRUE(extension); | 616 ASSERT_TRUE(extension); |
| 615 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); | 617 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); |
| 616 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); | 618 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); |
| 617 EXPECT_TRUE(service->disabled_extensions()->is_empty()); | 619 EXPECT_TRUE(service->disabled_extensions()->is_empty()); |
| 618 } | 620 } |
| OLD | NEW |