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

Side by Side Diff: chrome/common/extensions/update_manifest_unittest.cc

Issue 829583002: Validate hash_sha256 checksum on .crx update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittest build for windows. Created 5 years, 10 months 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
OLDNEW
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 "extensions/common/update_manifest.h" 6 #include "extensions/common/update_manifest.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 static const char kValidXml[] = 10 static const char kValidXml[] =
11 "<?xml version='1.0' encoding='UTF-8'?>" 11 "<?xml version='1.0' encoding='UTF-8'?>"
12 "<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>" 12 "<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>"
13 " <app appid='12345'>" 13 " <app appid='12345'>"
14 " <updatecheck codebase='http://example.com/extension_1.2.3.4.crx'" 14 " <updatecheck codebase='http://example.com/extension_1.2.3.4.crx'"
15 " version='1.2.3.4' prodversionmin='2.0.143.0' />" 15 " version='1.2.3.4' prodversionmin='2.0.143.0' />"
16 " </app>" 16 " </app>"
17 "</gupdate>"; 17 "</gupdate>";
18 18
19 static const char valid_xml_with_hash[] = 19 static const char valid_xml_with_hash[] =
20 "<?xml version='1.0' encoding='UTF-8'?>" 20 "<?xml version='1.0' encoding='UTF-8'?>"
21 "<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>" 21 "<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>"
22 " <app appid='12345'>" 22 " <app appid='12345'>"
23 " <updatecheck codebase='http://example.com/extension_1.2.3.4.crx'" 23 " <updatecheck codebase='http://example.com/extension_1.2.3.4.crx'"
24 " version='1.2.3.4' prodversionmin='2.0.143.0' " 24 " version='1.2.3.4' prodversionmin='2.0.143.0' "
25 " hash='1234'/>" 25 " hash_sha256='1234'/>"
26 " </app>" 26 " </app>"
27 "</gupdate>"; 27 "</gupdate>";
28 28
29 static const char kMissingAppId[] = 29 static const char kMissingAppId[] =
30 "<?xml version='1.0'?>" 30 "<?xml version='1.0'?>"
31 "<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>" 31 "<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>"
32 " <app>" 32 " <app>"
33 " <updatecheck codebase='http://example.com/extension_1.2.3.4.crx'" 33 " <updatecheck codebase='http://example.com/extension_1.2.3.4.crx'"
34 " version='1.2.3.4' />" 34 " version='1.2.3.4' />"
35 " </app>" 35 " </app>"
36 "</gupdate>"; 36 "</gupdate>";
37 37
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/updater/extension_updater_unittest.cc ('k') | extensions/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698