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 26 matching lines...) Expand all Loading... |
37 // in the extension's manifest. We use the version as reported by the | 37 // in the extension's manifest. We use the version as reported by the |
38 // background page to test how overinstalling crx files with the same | 38 // background page to test how overinstalling crx files with the same |
39 // manifest version works. | 39 // manifest version works. |
40 bool IsExtensionAtVersion(const Extension* extension, | 40 bool IsExtensionAtVersion(const Extension* extension, |
41 const std::string& expected_version) { | 41 const std::string& expected_version) { |
42 // Test that the extension's version from the manifest and reported by the | 42 // Test that the extension's version from the manifest and reported by the |
43 // background page is correct. This is to ensure that the processes are in | 43 // background page is correct. This is to ensure that the processes are in |
44 // sync with the Extension. | 44 // sync with the Extension. |
45 ExtensionProcessManager* manager = browser()->profile()-> | 45 ExtensionProcessManager* manager = browser()->profile()-> |
46 GetExtensionProcessManager(); | 46 GetExtensionProcessManager(); |
47 ExtensionHost* ext_host = | 47 extensions::ExtensionHost* ext_host = |
48 manager->GetBackgroundHostForExtension(extension->id()); | 48 manager->GetBackgroundHostForExtension(extension->id()); |
49 EXPECT_TRUE(ext_host); | 49 EXPECT_TRUE(ext_host); |
50 if (!ext_host) | 50 if (!ext_host) |
51 return false; | 51 return false; |
52 | 52 |
53 std::string version_from_bg; | 53 std::string version_from_bg; |
54 bool exec = content::ExecuteJavaScriptAndExtractString( | 54 bool exec = content::ExecuteJavaScriptAndExtractString( |
55 ext_host->render_view_host(), L"", L"version()", &version_from_bg); | 55 ext_host->render_view_host(), L"", L"version()", &version_from_bg); |
56 EXPECT_TRUE(exec); | 56 EXPECT_TRUE(exec); |
57 if (!exec) | 57 if (!exec) |
(...skipping 554 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 |