OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authos. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authos. 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "googleurl/src/gurl.h" | 7 #include "googleurl/src/gurl.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "webkit/appcache/manifest_parser.h" | 9 #include "webkit/appcache/manifest_parser.h" |
10 | 10 |
11 using appcache::FallbackNamespace; | 11 namespace appcache { |
12 using appcache::Manifest; | |
13 using appcache::ParseManifest; | |
14 | |
15 namespace { | |
16 | 12 |
17 class ManifestParserTest : public testing::Test { | 13 class ManifestParserTest : public testing::Test { |
18 }; | 14 }; |
19 | 15 |
20 } // namespace | |
21 | |
22 TEST(ManifestParserTest, NoData) { | 16 TEST(ManifestParserTest, NoData) { |
23 GURL url; | 17 GURL url; |
24 Manifest manifest; | 18 Manifest manifest; |
25 EXPECT_FALSE(ParseManifest(url, "", 0, manifest)); | 19 EXPECT_FALSE(ParseManifest(url, "", 0, manifest)); |
26 EXPECT_FALSE(ParseManifest(url, "CACHE MANIFEST\r", 0, manifest)); // 0 len | 20 EXPECT_FALSE(ParseManifest(url, "CACHE MANIFEST\r", 0, manifest)); // 0 len |
27 } | 21 } |
28 | 22 |
29 TEST(ManifestParserTest, CheckSignature) { | 23 TEST(ManifestParserTest, CheckSignature) { |
30 GURL url; | 24 GURL url; |
31 Manifest manifest; | 25 Manifest manifest; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 const GURL kUrl("http://bad.com"); | 293 const GURL kUrl("http://bad.com"); |
300 const std::string kData("CACHE MANIFEST\r" | 294 const std::string kData("CACHE MANIFEST\r" |
301 "\xC0" "invalidutf8\r" | 295 "\xC0" "invalidutf8\r" |
302 "nonbmp" "\xF1\x84\xAB\xBC\r"); | 296 "nonbmp" "\xF1\x84\xAB\xBC\r"); |
303 EXPECT_TRUE(ParseManifest(kUrl, kData.c_str(), kData.length(), manifest)); | 297 EXPECT_TRUE(ParseManifest(kUrl, kData.c_str(), kData.length(), manifest)); |
304 | 298 |
305 base::hash_set<std::string> urls = manifest.explicit_urls; | 299 base::hash_set<std::string> urls = manifest.explicit_urls; |
306 EXPECT_TRUE(urls.find("http://bad.com/%EF%BF%BDinvalidutf8") != urls.end()); | 300 EXPECT_TRUE(urls.find("http://bad.com/%EF%BF%BDinvalidutf8") != urls.end()); |
307 EXPECT_TRUE(urls.find("http://bad.com/nonbmp%F1%84%AB%BC") != urls.end()); | 301 EXPECT_TRUE(urls.find("http://bad.com/nonbmp%F1%84%AB%BC") != urls.end()); |
308 } | 302 } |
| 303 |
| 304 } // namespace appcache |
| 305 |
OLD | NEW |