| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <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 namespace appcache { | 11 namespace appcache { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const std::string good = kGoodSignatures[i]; | 55 const std::string good = kGoodSignatures[i]; |
| 56 EXPECT_TRUE(ParseManifest(url, good.c_str(), good.length(), manifest)); | 56 EXPECT_TRUE(ParseManifest(url, good.c_str(), good.length(), manifest)); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 TEST(ManifestParserTest, NoManifestUrl) { | 60 TEST(ManifestParserTest, NoManifestUrl) { |
| 61 Manifest manifest; | 61 Manifest manifest; |
| 62 const std::string kData("CACHE MANIFEST\r" | 62 const std::string kData("CACHE MANIFEST\r" |
| 63 "relative/tobase.com\r" | 63 "relative/tobase.com\r" |
| 64 "http://absolute.com/addme.com"); | 64 "http://absolute.com/addme.com"); |
| 65 const GURL kUrl = GURL::EmptyGURL(); | 65 const GURL kUrl; |
| 66 EXPECT_TRUE(ParseManifest(kUrl, kData.c_str(), kData.length(), manifest)); | 66 EXPECT_TRUE(ParseManifest(kUrl, kData.c_str(), kData.length(), manifest)); |
| 67 EXPECT_TRUE(manifest.explicit_urls.empty()); | 67 EXPECT_TRUE(manifest.explicit_urls.empty()); |
| 68 EXPECT_TRUE(manifest.fallback_namespaces.empty()); | 68 EXPECT_TRUE(manifest.fallback_namespaces.empty()); |
| 69 EXPECT_TRUE(manifest.online_whitelist_namespaces.empty()); | 69 EXPECT_TRUE(manifest.online_whitelist_namespaces.empty()); |
| 70 EXPECT_FALSE(manifest.online_whitelist_all); | 70 EXPECT_FALSE(manifest.online_whitelist_all); |
| 71 } | 71 } |
| 72 | 72 |
| 73 TEST(ManifestParserTest, ExplicitUrls) { | 73 TEST(ManifestParserTest, ExplicitUrls) { |
| 74 Manifest manifest; | 74 Manifest manifest; |
| 75 const GURL kUrl("http://www.foo.com"); | 75 const GURL kUrl("http://www.foo.com"); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 "CACHE MANIFEST\r" | 308 "CACHE MANIFEST\r" |
| 309 "resource.txt this stuff after the white space should be ignored\r"); | 309 "resource.txt this stuff after the white space should be ignored\r"); |
| 310 EXPECT_TRUE(ParseManifest(kUrl, kData.c_str(), kData.length(), manifest)); | 310 EXPECT_TRUE(ParseManifest(kUrl, kData.c_str(), kData.length(), manifest)); |
| 311 | 311 |
| 312 base::hash_set<std::string> urls = manifest.explicit_urls; | 312 base::hash_set<std::string> urls = manifest.explicit_urls; |
| 313 EXPECT_TRUE(urls.find("http://smorg.borg/resource.txt") != urls.end()); | 313 EXPECT_TRUE(urls.find("http://smorg.borg/resource.txt") != urls.end()); |
| 314 } | 314 } |
| 315 | 315 |
| 316 } // namespace appcache | 316 } // namespace appcache |
| 317 | 317 |
| OLD | NEW |