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

Unified Diff: content/browser/appcache/appcache_unittest.cc

Issue 344493002: Move all remaining appcache-related code to content namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/appcache/appcache_unittest.cc
diff --git a/content/browser/appcache/appcache_unittest.cc b/content/browser/appcache/appcache_unittest.cc
index 32c4e89dee03f66607dae11961e4fdc58d21ea77..a82ab3df40a4e76e7555df1ece12ddab52ba43fb 100644
--- a/content/browser/appcache/appcache_unittest.cc
+++ b/content/browser/appcache/appcache_unittest.cc
@@ -2,30 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "content/browser/appcache/appcache.h"
+#include "content/browser/appcache/appcache_host.h"
#include "content/browser/appcache/mock_appcache_service.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/browser/appcache/appcache.h"
-#include "webkit/browser/appcache/appcache_host.h"
-
-using appcache::AppCache;
-using appcache::AppCacheDatabase;
-using appcache::AppCacheEntry;
-using appcache::AppCacheFrontend;
-using appcache::AppCacheGroup;
-using appcache::AppCacheHost;
-using appcache::AppCacheInfo;
-using appcache::AppCacheErrorDetails;
-using appcache::AppCacheEventID;
-using appcache::APPCACHE_FALLBACK_NAMESPACE;
-using appcache::APPCACHE_INTERCEPT_NAMESPACE;
-using appcache::AppCacheLogLevel;
-using appcache::Manifest;
-using appcache::Namespace;
-using appcache::NamespaceVector;
-using appcache::APPCACHE_NETWORK_NAMESPACE;
-using appcache::PARSE_MANIFEST_ALLOWING_INTERCEPTS;
-using appcache::PARSE_MANIFEST_PER_STANDARD;
-using appcache::AppCacheStatus;
namespace content {
@@ -132,23 +112,26 @@ TEST(AppCacheTest, InitializeWithManifest) {
manifest.explicit_urls.insert("http://one.com");
manifest.explicit_urls.insert("http://two.com");
manifest.fallback_namespaces.push_back(
- Namespace(APPCACHE_FALLBACK_NAMESPACE, GURL("http://fb1.com"),
+ AppCacheNamespace(APPCACHE_FALLBACK_NAMESPACE, GURL("http://fb1.com"),
GURL("http://fbone.com"), true));
manifest.online_whitelist_namespaces.push_back(
- Namespace(APPCACHE_NETWORK_NAMESPACE, GURL("http://w1.com"), GURL(), false));
+ AppCacheNamespace(APPCACHE_NETWORK_NAMESPACE, GURL("http://w1.com"),
+ GURL(), false));
manifest.online_whitelist_namespaces.push_back(
- Namespace(APPCACHE_NETWORK_NAMESPACE, GURL("http://w2.com"), GURL(), false));
+ AppCacheNamespace(APPCACHE_NETWORK_NAMESPACE, GURL("http://w2.com"),
+ GURL(), false));
manifest.online_whitelist_all = true;
cache->InitializeWithManifest(&manifest);
- const std::vector<Namespace>& fallbacks =
+ const std::vector<AppCacheNamespace>& fallbacks =
cache->fallback_namespaces_;
size_t expected = 1;
EXPECT_EQ(expected, fallbacks.size());
EXPECT_EQ(GURL("http://fb1.com"), fallbacks[0].namespace_url);
EXPECT_EQ(GURL("http://fbone.com"), fallbacks[0].target_url);
EXPECT_TRUE(fallbacks[0].is_pattern);
- const NamespaceVector& whitelist = cache->online_whitelist_namespaces_;
+ const AppCacheNamespaceVector& whitelist =
+ cache->online_whitelist_namespaces_;
expected = 2;
EXPECT_EQ(expected, whitelist.size());
EXPECT_EQ(GURL("http://w1.com"), whitelist[0].namespace_url);
@@ -193,24 +176,23 @@ TEST(AppCacheTest, FindResponseForRequest) {
Manifest manifest;
manifest.online_whitelist_namespaces.push_back(
- Namespace(APPCACHE_NETWORK_NAMESPACE, kOnlineNamespaceUrl,
- GURL(), false));
+ AppCacheNamespace(APPCACHE_NETWORK_NAMESPACE, kOnlineNamespaceUrl,
+ GURL(), false));
manifest.online_whitelist_namespaces.push_back(
- Namespace(APPCACHE_NETWORK_NAMESPACE,
- kOnlineNamespaceWithinOtherNamespaces,
- GURL(), false));
+ AppCacheNamespace(APPCACHE_NETWORK_NAMESPACE,
+ kOnlineNamespaceWithinOtherNamespaces, GURL(), false));
manifest.fallback_namespaces.push_back(
- Namespace(APPCACHE_FALLBACK_NAMESPACE, kFallbackNamespaceUrl1,
- kFallbackEntryUrl1, false));
+ AppCacheNamespace(APPCACHE_FALLBACK_NAMESPACE, kFallbackNamespaceUrl1,
+ kFallbackEntryUrl1, false));
manifest.fallback_namespaces.push_back(
- Namespace(APPCACHE_FALLBACK_NAMESPACE, kFallbackNamespaceUrl2,
- kFallbackEntryUrl2, false));
+ AppCacheNamespace(APPCACHE_FALLBACK_NAMESPACE, kFallbackNamespaceUrl2,
+ kFallbackEntryUrl2, false));
manifest.intercept_namespaces.push_back(
- Namespace(APPCACHE_INTERCEPT_NAMESPACE, kInterceptNamespace,
- kInterceptNamespaceEntry, false));
+ AppCacheNamespace(APPCACHE_INTERCEPT_NAMESPACE, kInterceptNamespace,
+ kInterceptNamespaceEntry, false));
manifest.intercept_namespaces.push_back(
- Namespace(APPCACHE_INTERCEPT_NAMESPACE, kInterceptNamespaceWithinFallback,
- kInterceptNamespaceEntry, false));
+ AppCacheNamespace(APPCACHE_INTERCEPT_NAMESPACE,
+ kInterceptNamespaceWithinFallback, kInterceptNamespaceEntry, false));
// Create a cache with some namespaces and entries.
scoped_refptr<AppCache> cache(new AppCache(service.storage(), 1234));
@@ -385,8 +367,8 @@ TEST(AppCacheTest, FindInterceptPatternResponseForRequest) {
const int64 kInterceptResponseId = 1;
Manifest manifest;
manifest.intercept_namespaces.push_back(
- Namespace(APPCACHE_INTERCEPT_NAMESPACE, kInterceptPatternNamespace,
- kInterceptNamespaceEntry, true));
+ AppCacheNamespace(APPCACHE_INTERCEPT_NAMESPACE,
+ kInterceptPatternNamespace, kInterceptNamespaceEntry, true));
scoped_refptr<AppCache> cache(new AppCache(service.storage(), 1234));
cache->InitializeWithManifest(&manifest);
cache->AddEntry(
@@ -456,7 +438,7 @@ TEST(AppCacheTest, FindFallbackPatternResponseForRequest) {
const int64 kFallbackResponseId = 1;
Manifest manifest;
manifest.fallback_namespaces.push_back(
- Namespace(APPCACHE_FALLBACK_NAMESPACE, kFallbackPatternNamespace,
+ AppCacheNamespace(APPCACHE_FALLBACK_NAMESPACE, kFallbackPatternNamespace,
kFallbackNamespaceEntry, true));
scoped_refptr<AppCache> cache(new AppCache(service.storage(), 1234));
cache->InitializeWithManifest(&manifest);
@@ -526,7 +508,7 @@ TEST(AppCacheTest, FindNetworkNamespacePatternResponseForRequest) {
kNetworkNamespaceBase.Resolve("*.hit*"));
Manifest manifest;
manifest.online_whitelist_namespaces.push_back(
- Namespace(APPCACHE_NETWORK_NAMESPACE, kNetworkPatternNamespace,
+ AppCacheNamespace(APPCACHE_NETWORK_NAMESPACE, kNetworkPatternNamespace,
GURL(), true));
manifest.online_whitelist_all = false;
scoped_refptr<AppCache> cache(new AppCache(service.storage(), 1234));
@@ -644,7 +626,7 @@ TEST(AppCacheTest, ToFromDatabaseRecords) {
}
TEST(AppCacheTest, IsNamespaceMatch) {
- Namespace prefix;
+ AppCacheNamespace prefix;
prefix.namespace_url = GURL("http://foo.com/prefix");
prefix.is_pattern = false;
EXPECT_TRUE(prefix.IsMatch(
@@ -652,7 +634,7 @@ TEST(AppCacheTest, IsNamespaceMatch) {
EXPECT_FALSE(prefix.IsMatch(
GURL("http://foo.com/nope")));
- Namespace bar_no_star;
+ AppCacheNamespace bar_no_star;
bar_no_star.namespace_url = GURL("http://foo.com/bar");
bar_no_star.is_pattern = true;
EXPECT_TRUE(bar_no_star.IsMatch(
@@ -660,7 +642,7 @@ TEST(AppCacheTest, IsNamespaceMatch) {
EXPECT_FALSE(bar_no_star.IsMatch(
GURL("http://foo.com/bar/nope")));
- Namespace bar_star;
+ AppCacheNamespace bar_star;
bar_star.namespace_url = GURL("http://foo.com/bar/*");
bar_star.is_pattern = true;
EXPECT_TRUE(bar_star.IsMatch(
@@ -670,7 +652,7 @@ TEST(AppCacheTest, IsNamespaceMatch) {
EXPECT_FALSE(bar_star.IsMatch(
GURL("http://foo.com/not_bar/should_not_match")));
- Namespace star_bar_star;
+ AppCacheNamespace star_bar_star;
star_bar_star.namespace_url = GURL("http://foo.com/*/bar/*");
star_bar_star.is_pattern = true;
EXPECT_TRUE(star_bar_star.IsMatch(
@@ -680,7 +662,7 @@ TEST(AppCacheTest, IsNamespaceMatch) {
EXPECT_FALSE(star_bar_star.IsMatch(
GURL("http://foo.com/any/not_bar/no_match")));
- Namespace query_star_edit;
+ AppCacheNamespace query_star_edit;
query_star_edit.namespace_url = GURL("http://foo.com/query?id=*&verb=edit*");
query_star_edit.is_pattern = true;
EXPECT_TRUE(query_star_edit.IsMatch(
@@ -692,7 +674,7 @@ TEST(AppCacheTest, IsNamespaceMatch) {
EXPECT_TRUE(query_star_edit.IsMatch(
GURL("http://foo.com/query?id=123&verb=print&verb=edit")));
- Namespace star_greediness;
+ AppCacheNamespace star_greediness;
star_greediness.namespace_url = GURL("http://foo.com/*/b");
star_greediness.is_pattern = true;
EXPECT_TRUE(star_greediness.IsMatch(

Powered by Google App Engine
This is Rietveld 408576698