OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
6 #include "chrome/common/extensions/update_manifest.h" | 6 #include "chrome/common/extensions/update_manifest.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "libxml/globals.h" | 8 #include "libxml/globals.h" |
9 | 9 |
10 static const char* kValidXml = | 10 static const char* kValidXml = |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 " </app>" | 113 " </app>" |
114 " <app appid='bbbbbbbb'>" | 114 " <app appid='bbbbbbbb'>" |
115 " <updatecheck codebase='http://example.com/b_3.1.crx' version='3.1'/>" | 115 " <updatecheck codebase='http://example.com/b_3.1.crx' version='3.1'/>" |
116 " </app>" | 116 " </app>" |
117 "</gupdate>"; | 117 "</gupdate>"; |
118 | 118 |
119 TEST(ExtensionUpdateManifestTest, TestUpdateManifest) { | 119 TEST(ExtensionUpdateManifestTest, TestUpdateManifest) { |
120 UpdateManifest parser; | 120 UpdateManifest parser; |
121 | 121 |
122 // Test parsing of a number of invalid xml cases | 122 // Test parsing of a number of invalid xml cases |
123 EXPECT_FALSE(parser.Parse("")); | 123 EXPECT_FALSE(parser.Parse(std::string())); |
124 EXPECT_FALSE(parser.errors().empty()); | 124 EXPECT_FALSE(parser.errors().empty()); |
125 | 125 |
126 EXPECT_TRUE(parser.Parse(kMissingAppId)); | 126 EXPECT_TRUE(parser.Parse(kMissingAppId)); |
127 EXPECT_TRUE(parser.results().list.empty()); | 127 EXPECT_TRUE(parser.results().list.empty()); |
128 EXPECT_FALSE(parser.errors().empty()); | 128 EXPECT_FALSE(parser.errors().empty()); |
129 | 129 |
130 EXPECT_TRUE(parser.Parse(kInvalidCodebase)); | 130 EXPECT_TRUE(parser.Parse(kInvalidCodebase)); |
131 EXPECT_TRUE(parser.results().list.empty()); | 131 EXPECT_TRUE(parser.results().list.empty()); |
132 EXPECT_FALSE(parser.errors().empty()); | 132 EXPECT_FALSE(parser.errors().empty()); |
133 | 133 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 EXPECT_EQ(firstResult->extension_id, "12345"); | 178 EXPECT_EQ(firstResult->extension_id, "12345"); |
179 EXPECT_EQ(firstResult->version, ""); | 179 EXPECT_EQ(firstResult->version, ""); |
180 | 180 |
181 // Parse xml with one error and one success <app> tag. | 181 // Parse xml with one error and one success <app> tag. |
182 EXPECT_TRUE(parser.Parse(kTwoAppsOneError)); | 182 EXPECT_TRUE(parser.Parse(kTwoAppsOneError)); |
183 EXPECT_FALSE(parser.errors().empty()); | 183 EXPECT_FALSE(parser.errors().empty()); |
184 EXPECT_EQ(1u, parser.results().list.size()); | 184 EXPECT_EQ(1u, parser.results().list.size()); |
185 firstResult = &parser.results().list.at(0); | 185 firstResult = &parser.results().list.at(0); |
186 EXPECT_EQ(firstResult->extension_id, "bbbbbbbb"); | 186 EXPECT_EQ(firstResult->extension_id, "bbbbbbbb"); |
187 } | 187 } |
OLD | NEW |