| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 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, | 83 const std::string& id, |
| 84 const std::string& install_parameter, | 84 const std::string& install_parameter, |
| 85 const GURL& update_url, | 85 const GURL& update_url, |
| 86 Manifest::Location location, | 86 Manifest::Location location, |
| 87 int unused1, | 87 int unused1, |
| 88 bool unused2) OVERRIDE { | 88 bool unused2) override { |
| 89 // Extension has the correct location. | 89 // Extension has the correct location. |
| 90 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location); | 90 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location); |
| 91 | 91 |
| 92 // Provider returns the correct location when asked. | 92 // Provider returns the correct location when asked. |
| 93 Manifest::Location location1; | 93 Manifest::Location location1; |
| 94 scoped_ptr<Version> version1; | 94 scoped_ptr<Version> version1; |
| 95 provider_->GetExtensionDetails(id, &location1, &version1); | 95 provider_->GetExtensionDetails(id, &location1, &version1); |
| 96 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location1); | 96 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location1); |
| 97 EXPECT_FALSE(version1.get()); | 97 EXPECT_FALSE(version1.get()); |
| 98 | 98 |
| 99 // Remove the extension from our list. | 99 // Remove the extension from our list. |
| 100 EXPECT_EQ(1U, expected_extensions_.erase(id)); | 100 EXPECT_EQ(1U, expected_extensions_.erase(id)); |
| 101 return true; | 101 return true; |
| 102 } | 102 } |
| 103 | 103 |
| 104 virtual void OnExternalProviderReady( | 104 virtual void OnExternalProviderReady( |
| 105 const ExternalProviderInterface* provider) OVERRIDE { | 105 const ExternalProviderInterface* provider) override { |
| 106 EXPECT_EQ(provider, provider_.get()); | 106 EXPECT_EQ(provider, provider_.get()); |
| 107 EXPECT_TRUE(provider->IsReady()); | 107 EXPECT_TRUE(provider->IsReady()); |
| 108 } | 108 } |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 std::set<std::string> expected_extensions_; | 111 std::set<std::string> expected_extensions_; |
| 112 | 112 |
| 113 scoped_ptr<TestingProfile> profile_; | 113 scoped_ptr<TestingProfile> profile_; |
| 114 | 114 |
| 115 scoped_ptr<ExternalProviderImpl> provider_; | 115 scoped_ptr<ExternalProviderImpl> provider_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 146 forced_extensions.SetString("invalid", "http://www.example.com/crx"); | 146 forced_extensions.SetString("invalid", "http://www.example.com/crx"); |
| 147 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", | 147 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", |
| 148 std::string()); | 148 std::string()); |
| 149 forced_extensions.SetString("invalid", "bad"); | 149 forced_extensions.SetString("invalid", "bad"); |
| 150 | 150 |
| 151 MockExternalPolicyProviderVisitor mv; | 151 MockExternalPolicyProviderVisitor mv; |
| 152 mv.Visit(forced_extensions, expected_extensions); | 152 mv.Visit(forced_extensions, expected_extensions); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace extensions | 155 } // namespace extensions |
| OLD | NEW |