Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chrome/browser/component_updater/test/update_response_unittest.cc

Issue 101043010: Added support for multiple urls in the component updater. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/component_updater/update_response.h" 6 #include "chrome/browser/component_updater/update_response.h"
7 #include "libxml/globals.h" 7 #include "libxml/globals.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace component_updater { 10 namespace component_updater {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 " <package name='3' />" 59 " <package name='3' />"
60 " <package name='4' size='-a'/>" 60 " <package name='4' size='-a'/>"
61 " <package name='5' size='-123467890123456789'/>" 61 " <package name='5' size='-123467890123456789'/>"
62 " <package name='6' size='123467890123456789'/>" 62 " <package name='6' size='123467890123456789'/>"
63 " </packages>" 63 " </packages>"
64 " </manifest>" 64 " </manifest>"
65 " </updatecheck>" 65 " </updatecheck>"
66 " </app>" 66 " </app>"
67 "</response>"; 67 "</response>";
68 68
69 const char* kInvalidValidXmlMissingCodebase =
70 "<?xml version='1.0' encoding='UTF-8'?>"
71 "<response protocol='3.0'>"
72 " <app appid='12345'>"
73 " <updatecheck status='ok'>"
74 " <urls>"
75 " <url codebasediff='http://diff.example.com/'/>"
76 " </urls>"
77 " <manifest version='1.2.3.4' prodversionmin='2.0.143.0'>"
78 " <packages>"
79 " <package namediff='extension_1_2_3_4.crx'/>"
80 " </packages>"
81 " </manifest>"
82 " </updatecheck>"
83 " </app>"
84 "</response>";
85
69 const char* kMissingAppId = 86 const char* kMissingAppId =
70 "<?xml version='1.0'?>" 87 "<?xml version='1.0'?>"
71 "<response protocol='3.0'>" 88 "<response protocol='3.0'>"
72 " <app>" 89 " <app>"
73 " <updatecheck codebase='http://example.com/extension_1.2.3.4.crx'" 90 " <updatecheck codebase='http://example.com/extension_1.2.3.4.crx'"
74 " version='1.2.3.4' />" 91 " version='1.2.3.4' />"
75 " </app>" 92 " </app>"
76 "</response>"; 93 "</response>";
77 94
78 const char* kInvalidCodebase = 95 const char* kInvalidCodebase =
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 EXPECT_FALSE(parser.errors().empty()); 224 EXPECT_FALSE(parser.errors().empty());
208 225
209 EXPECT_TRUE(parser.Parse(kMissingVersion)); 226 EXPECT_TRUE(parser.Parse(kMissingVersion));
210 EXPECT_TRUE(parser.results().list.empty()); 227 EXPECT_TRUE(parser.results().list.empty());
211 EXPECT_FALSE(parser.errors().empty()); 228 EXPECT_FALSE(parser.errors().empty());
212 229
213 EXPECT_TRUE(parser.Parse(kInvalidVersion)); 230 EXPECT_TRUE(parser.Parse(kInvalidVersion));
214 EXPECT_TRUE(parser.results().list.empty()); 231 EXPECT_TRUE(parser.results().list.empty());
215 EXPECT_FALSE(parser.errors().empty()); 232 EXPECT_FALSE(parser.errors().empty());
216 233
234 EXPECT_TRUE(parser.Parse(kInvalidValidXmlMissingCodebase));
235 EXPECT_TRUE(parser.results().list.empty());
236 EXPECT_FALSE(parser.errors().empty());
237
217 // Parse some valid XML, and check that all params came out as expected 238 // Parse some valid XML, and check that all params came out as expected
218 EXPECT_TRUE(parser.Parse(kValidXml)); 239 EXPECT_TRUE(parser.Parse(kValidXml));
219 EXPECT_TRUE(parser.errors().empty()); 240 EXPECT_TRUE(parser.errors().empty());
220 EXPECT_EQ(1u, parser.results().list.size()); 241 EXPECT_EQ(1u, parser.results().list.size());
221 const UpdateResponse::Result* firstResult = &parser.results().list[0]; 242 const UpdateResponse::Result* firstResult = &parser.results().list[0];
222 EXPECT_EQ(1u, firstResult->crx_urls.size()); 243 EXPECT_EQ(1u, firstResult->crx_urls.size());
223 EXPECT_EQ(GURL("http://example.com/"), firstResult->crx_urls[0]); 244 EXPECT_EQ(GURL("http://example.com/"), firstResult->crx_urls[0]);
224 EXPECT_EQ(GURL("http://diff.example.com/"), firstResult->crx_diffurls[0]); 245 EXPECT_EQ(GURL("http://diff.example.com/"), firstResult->crx_diffurls[0]);
225 EXPECT_EQ("1.2.3.4", firstResult->manifest.version); 246 EXPECT_EQ("1.2.3.4", firstResult->manifest.version);
226 EXPECT_EQ("2.0.143.0", firstResult->manifest.browser_min_version); 247 EXPECT_EQ("2.0.143.0", firstResult->manifest.browser_min_version);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // Parse xml with one error and one success <app> tag. 293 // Parse xml with one error and one success <app> tag.
273 EXPECT_TRUE(parser.Parse(kTwoAppsOneError)); 294 EXPECT_TRUE(parser.Parse(kTwoAppsOneError));
274 EXPECT_FALSE(parser.errors().empty()); 295 EXPECT_FALSE(parser.errors().empty());
275 EXPECT_EQ(1u, parser.results().list.size()); 296 EXPECT_EQ(1u, parser.results().list.size());
276 firstResult = &parser.results().list[0]; 297 firstResult = &parser.results().list[0];
277 EXPECT_EQ(firstResult->extension_id, "bbbbbbbb"); 298 EXPECT_EQ(firstResult->extension_id, "bbbbbbbb");
278 } 299 }
279 300
280 } // namespace component_updater 301 } // namespace component_updater
281 302
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/test/crx_downloader_unittest.cc ('k') | chrome/browser/component_updater/update_response.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698