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 Manifest::EXTERNAL_POLICY_DOWNLOAD, | 63 Manifest::EXTERNAL_POLICY_DOWNLOAD, |
64 Extension::NO_FLAGS)); | 64 Extension::NO_FLAGS)); |
65 | 65 |
66 // Extensions will be removed from this list as they visited, | 66 // Extensions will be removed from this list as they visited, |
67 // so it should be emptied by the end. | 67 // so it should be emptied by the end. |
68 expected_extensions_ = expected_extensions; | 68 expected_extensions_ = expected_extensions; |
69 provider_->VisitRegisteredExtension(); | 69 provider_->VisitRegisteredExtension(); |
70 EXPECT_TRUE(expected_extensions_.empty()); | 70 EXPECT_TRUE(expected_extensions_.empty()); |
71 } | 71 } |
72 | 72 |
73 virtual bool OnExternalExtensionFileFound(const std::string& id, | 73 bool OnExternalExtensionFileFound(const std::string& id, |
74 const Version* version, | 74 const Version* version, |
75 const base::FilePath& path, | 75 const base::FilePath& path, |
76 Manifest::Location unused, | 76 Manifest::Location unused, |
77 int unused2, | 77 int unused2, |
78 bool unused3) override { | 78 bool unused3) override { |
79 ADD_FAILURE() << "There should be no external extensions from files."; | 79 ADD_FAILURE() << "There should be no external extensions from files."; |
80 return false; | 80 return false; |
81 } | 81 } |
82 | 82 |
83 virtual bool OnExternalExtensionUpdateUrlFound( | 83 bool OnExternalExtensionUpdateUrlFound(const std::string& id, |
84 const std::string& id, | 84 const std::string& install_parameter, |
85 const std::string& install_parameter, | 85 const GURL& update_url, |
86 const GURL& update_url, | 86 Manifest::Location location, |
87 Manifest::Location location, | 87 int unused1, |
88 int unused1, | 88 bool unused2) override { |
89 bool unused2) override { | |
90 // Extension has the correct location. | 89 // Extension has the correct location. |
91 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location); | 90 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location); |
92 | 91 |
93 // Provider returns the correct location when asked. | 92 // Provider returns the correct location when asked. |
94 Manifest::Location location1; | 93 Manifest::Location location1; |
95 scoped_ptr<Version> version1; | 94 scoped_ptr<Version> version1; |
96 provider_->GetExtensionDetails(id, &location1, &version1); | 95 provider_->GetExtensionDetails(id, &location1, &version1); |
97 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location1); | 96 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location1); |
98 EXPECT_FALSE(version1.get()); | 97 EXPECT_FALSE(version1.get()); |
99 | 98 |
100 // Remove the extension from our list. | 99 // Remove the extension from our list. |
101 EXPECT_EQ(1U, expected_extensions_.erase(id)); | 100 EXPECT_EQ(1U, expected_extensions_.erase(id)); |
102 return true; | 101 return true; |
103 } | 102 } |
104 | 103 |
105 virtual void OnExternalProviderReady( | 104 void OnExternalProviderReady( |
106 const ExternalProviderInterface* provider) override { | 105 const ExternalProviderInterface* provider) override { |
107 EXPECT_EQ(provider, provider_.get()); | 106 EXPECT_EQ(provider, provider_.get()); |
108 EXPECT_TRUE(provider->IsReady()); | 107 EXPECT_TRUE(provider->IsReady()); |
109 } | 108 } |
110 | 109 |
111 private: | 110 private: |
112 std::set<std::string> expected_extensions_; | 111 std::set<std::string> expected_extensions_; |
113 | 112 |
114 scoped_ptr<TestingProfile> profile_; | 113 scoped_ptr<TestingProfile> profile_; |
115 | 114 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 forced_extensions.SetString("invalid", "http://www.example.com/crx"); | 146 forced_extensions.SetString("invalid", "http://www.example.com/crx"); |
148 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", | 147 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", |
149 std::string()); | 148 std::string()); |
150 forced_extensions.SetString("invalid", "bad"); | 149 forced_extensions.SetString("invalid", "bad"); |
151 | 150 |
152 MockExternalPolicyProviderVisitor mv; | 151 MockExternalPolicyProviderVisitor mv; |
153 mv.Visit(forced_extensions, expected_extensions); | 152 mv.Visit(forced_extensions, expected_extensions); |
154 } | 153 } |
155 | 154 |
156 } // namespace extensions | 155 } // namespace extensions |
OLD | NEW |