| 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 expected_extensions_ = expected_extensions; | 66 expected_extensions_ = expected_extensions; |
| 67 provider_->VisitRegisteredExtension(); | 67 provider_->VisitRegisteredExtension(); |
| 68 EXPECT_TRUE(expected_extensions_.empty()); | 68 EXPECT_TRUE(expected_extensions_.empty()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual bool OnExternalExtensionFileFound(const std::string& id, | 71 virtual bool OnExternalExtensionFileFound(const std::string& id, |
| 72 const Version* version, | 72 const Version* version, |
| 73 const FilePath& path, | 73 const FilePath& path, |
| 74 Manifest::Location unused, | 74 Manifest::Location unused, |
| 75 int unused2, | 75 int unused2, |
| 76 bool unused3) { | 76 bool unused3) OVERRIDE { |
| 77 ADD_FAILURE() << "There should be no external extensions from files."; | 77 ADD_FAILURE() << "There should be no external extensions from files."; |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 | 80 |
| 81 virtual bool OnExternalExtensionUpdateUrlFound( | 81 virtual bool OnExternalExtensionUpdateUrlFound( |
| 82 const std::string& id, const GURL& update_url, | 82 const std::string& id, const GURL& update_url, |
| 83 Manifest::Location location) { | 83 Manifest::Location location) OVERRIDE { |
| 84 // Extension has the correct location. | 84 // Extension has the correct location. |
| 85 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location); | 85 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location); |
| 86 | 86 |
| 87 // Provider returns the correct location when asked. | 87 // Provider returns the correct location when asked. |
| 88 Manifest::Location location1; | 88 Manifest::Location location1; |
| 89 scoped_ptr<Version> version1; | 89 scoped_ptr<Version> version1; |
| 90 provider_->GetExtensionDetails(id, &location1, &version1); | 90 provider_->GetExtensionDetails(id, &location1, &version1); |
| 91 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location1); | 91 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location1); |
| 92 EXPECT_FALSE(version1.get()); | 92 EXPECT_FALSE(version1.get()); |
| 93 | 93 |
| 94 // Remove the extension from our list. | 94 // Remove the extension from our list. |
| 95 EXPECT_EQ(1U, expected_extensions_.erase(id)); | 95 EXPECT_EQ(1U, expected_extensions_.erase(id)); |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 virtual void OnExternalProviderReady( | 99 virtual void OnExternalProviderReady( |
| 100 const ExternalProviderInterface* provider) { | 100 const ExternalProviderInterface* provider) OVERRIDE { |
| 101 EXPECT_EQ(provider, provider_.get()); | 101 EXPECT_EQ(provider, provider_.get()); |
| 102 EXPECT_TRUE(provider->IsReady()); | 102 EXPECT_TRUE(provider->IsReady()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 std::set<std::string> expected_extensions_; | 106 std::set<std::string> expected_extensions_; |
| 107 | 107 |
| 108 scoped_ptr<TestingProfile> profile_; | 108 scoped_ptr<TestingProfile> profile_; |
| 109 | 109 |
| 110 scoped_ptr<ExternalProviderImpl> provider_; | 110 scoped_ptr<ExternalProviderImpl> provider_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 140 // Add invalid entries. | 140 // Add invalid entries. |
| 141 forced_extensions.SetString("invalid", "http://www.example.com/crx"); | 141 forced_extensions.SetString("invalid", "http://www.example.com/crx"); |
| 142 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", ""); | 142 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", ""); |
| 143 forced_extensions.SetString("invalid", "bad"); | 143 forced_extensions.SetString("invalid", "bad"); |
| 144 | 144 |
| 145 MockExternalPolicyProviderVisitor mv; | 145 MockExternalPolicyProviderVisitor mv; |
| 146 mv.Visit(forced_extensions, expected_extensions); | 146 mv.Visit(forced_extensions, expected_extensions); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace extensions | 149 } // namespace extensions |
| OLD | NEW |