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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 Extension::NO_FLAGS)); | 63 Extension::NO_FLAGS)); |
64 | 64 |
65 // Extensions will be removed from this list as they visited, | 65 // Extensions will be removed from this list as they visited, |
66 // so it should be emptied by the end. | 66 // so it should be emptied by the end. |
67 expected_extensions_ = expected_extensions; | 67 expected_extensions_ = expected_extensions; |
68 provider_->VisitRegisteredExtension(); | 68 provider_->VisitRegisteredExtension(); |
69 EXPECT_TRUE(expected_extensions_.empty()); | 69 EXPECT_TRUE(expected_extensions_.empty()); |
70 } | 70 } |
71 | 71 |
72 virtual bool OnExternalExtensionFileFound(const std::string& id, | 72 virtual bool OnExternalExtensionFileFound(const std::string& id, |
73 const base::Version* version, | 73 const Version* version, |
74 const base::FilePath& path, | 74 const base::FilePath& path, |
75 Manifest::Location unused, | 75 Manifest::Location unused, |
76 int unused2, | 76 int unused2, |
77 bool unused3) OVERRIDE { | 77 bool unused3) OVERRIDE { |
78 ADD_FAILURE() << "There should be no external extensions from files."; | 78 ADD_FAILURE() << "There should be no external extensions from files."; |
79 return false; | 79 return false; |
80 } | 80 } |
81 | 81 |
82 virtual bool OnExternalExtensionUpdateUrlFound( | 82 virtual bool OnExternalExtensionUpdateUrlFound( |
83 const std::string& id, const GURL& update_url, | 83 const std::string& id, const GURL& update_url, |
84 Manifest::Location location, int unused1, bool unused2) OVERRIDE { | 84 Manifest::Location location, int unused1, bool unused2) OVERRIDE { |
85 // Extension has the correct location. | 85 // Extension has the correct location. |
86 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location); | 86 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location); |
87 | 87 |
88 // Provider returns the correct location when asked. | 88 // Provider returns the correct location when asked. |
89 Manifest::Location location1; | 89 Manifest::Location location1; |
90 scoped_ptr<base::Version> version1; | 90 scoped_ptr<Version> version1; |
91 provider_->GetExtensionDetails(id, &location1, &version1); | 91 provider_->GetExtensionDetails(id, &location1, &version1); |
92 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location1); | 92 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location1); |
93 EXPECT_FALSE(version1.get()); | 93 EXPECT_FALSE(version1.get()); |
94 | 94 |
95 // Remove the extension from our list. | 95 // Remove the extension from our list. |
96 EXPECT_EQ(1U, expected_extensions_.erase(id)); | 96 EXPECT_EQ(1U, expected_extensions_.erase(id)); |
97 return true; | 97 return true; |
98 } | 98 } |
99 | 99 |
100 virtual void OnExternalProviderReady( | 100 virtual void OnExternalProviderReady( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 forced_extensions.SetString("invalid", "http://www.example.com/crx"); | 142 forced_extensions.SetString("invalid", "http://www.example.com/crx"); |
143 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", | 143 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", |
144 std::string()); | 144 std::string()); |
145 forced_extensions.SetString("invalid", "bad"); | 145 forced_extensions.SetString("invalid", "bad"); |
146 | 146 |
147 MockExternalPolicyProviderVisitor mv; | 147 MockExternalPolicyProviderVisitor mv; |
148 mv.Visit(forced_extensions, expected_extensions); | 148 mv.Visit(forced_extensions, expected_extensions); |
149 } | 149 } |
150 | 150 |
151 } // namespace extensions | 151 } // namespace extensions |
OLD | NEW |