Commit 3a99f598 authored by nhiroki's avatar nhiroki Committed by Commit bot

CacheStorage: Remove duplicate member from CacheStorageManagerTest for cleanup

This is a follow-up patch for merging CacheStorageError and ErrorType:
https://codereview.chromium.org/1132683003

BUG=425505
TEST=n/a

Review URL: https://codereview.chromium.org/1138013002

Cr-Commit-Position: refs/heads/master@{#329398}
parent a6dabae2
...@@ -29,7 +29,6 @@ class CacheStorageManagerTest : public testing::Test { ...@@ -29,7 +29,6 @@ class CacheStorageManagerTest : public testing::Test {
: browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP),
callback_bool_(false), callback_bool_(false),
callback_error_(CACHE_STORAGE_OK), callback_error_(CACHE_STORAGE_OK),
callback_cache_error_(CACHE_STORAGE_OK),
origin1_("http://example1.com"), origin1_("http://example1.com"),
origin2_("http://example2.com") {} origin2_("http://example2.com") {}
...@@ -91,7 +90,7 @@ class CacheStorageManagerTest : public testing::Test { ...@@ -91,7 +90,7 @@ class CacheStorageManagerTest : public testing::Test {
} }
void CachePutCallback(base::RunLoop* run_loop, CacheStorageError error) { void CachePutCallback(base::RunLoop* run_loop, CacheStorageError error) {
callback_cache_error_ = error; callback_error_ = error;
run_loop->Quit(); run_loop->Quit();
} }
...@@ -100,7 +99,7 @@ class CacheStorageManagerTest : public testing::Test { ...@@ -100,7 +99,7 @@ class CacheStorageManagerTest : public testing::Test {
CacheStorageError error, CacheStorageError error,
scoped_ptr<ServiceWorkerResponse> response, scoped_ptr<ServiceWorkerResponse> response,
scoped_ptr<storage::BlobDataHandle> blob_data_handle) { scoped_ptr<storage::BlobDataHandle> blob_data_handle) {
callback_cache_error_ = error; callback_error_ = error;
callback_cache_response_ = response.Pass(); callback_cache_response_ = response.Pass();
// Deliberately drop the data handle as only the url is being tested. // Deliberately drop the data handle as only the url is being tested.
run_loop->Quit(); run_loop->Quit();
...@@ -152,8 +151,7 @@ class CacheStorageManagerTest : public testing::Test { ...@@ -152,8 +151,7 @@ class CacheStorageManagerTest : public testing::Test {
base::Unretained(this), base::Unretained(loop.get()))); base::Unretained(this), base::Unretained(loop.get())));
loop->Run(); loop->Run();
bool error = callback_error_ != CACHE_STORAGE_OK; return callback_error_ == CACHE_STORAGE_OK;
return !error;
} }
bool StorageMatch(const GURL& origin, bool StorageMatch(const GURL& origin,
...@@ -169,8 +167,7 @@ class CacheStorageManagerTest : public testing::Test { ...@@ -169,8 +167,7 @@ class CacheStorageManagerTest : public testing::Test {
base::Unretained(this), base::Unretained(loop.get()))); base::Unretained(this), base::Unretained(loop.get())));
loop->Run(); loop->Run();
bool error = callback_cache_error_ != CACHE_STORAGE_OK; return callback_error_ == CACHE_STORAGE_OK;
return !error;
} }
bool StorageMatchAll(const GURL& origin, const GURL& url) { bool StorageMatchAll(const GURL& origin, const GURL& url) {
...@@ -184,8 +181,7 @@ class CacheStorageManagerTest : public testing::Test { ...@@ -184,8 +181,7 @@ class CacheStorageManagerTest : public testing::Test {
base::Unretained(this), base::Unretained(loop.get()))); base::Unretained(this), base::Unretained(loop.get())));
loop->Run(); loop->Run();
bool error = callback_cache_error_ != CACHE_STORAGE_OK; return callback_error_ == CACHE_STORAGE_OK;
return !error;
} }
bool CachePut(const scoped_refptr<CacheStorageCache>& cache, bool CachePut(const scoped_refptr<CacheStorageCache>& cache,
...@@ -207,8 +203,7 @@ class CacheStorageManagerTest : public testing::Test { ...@@ -207,8 +203,7 @@ class CacheStorageManagerTest : public testing::Test {
base::Unretained(this), base::Unretained(loop.get()))); base::Unretained(this), base::Unretained(loop.get())));
loop->Run(); loop->Run();
bool error = callback_cache_error_ != CACHE_STORAGE_OK; return callback_error_ == CACHE_STORAGE_OK;
return !error;
} }
bool CacheMatch(const scoped_refptr<CacheStorageCache>& cache, bool CacheMatch(const scoped_refptr<CacheStorageCache>& cache,
...@@ -223,8 +218,7 @@ class CacheStorageManagerTest : public testing::Test { ...@@ -223,8 +218,7 @@ class CacheStorageManagerTest : public testing::Test {
base::Unretained(this), base::Unretained(loop.get()))); base::Unretained(this), base::Unretained(loop.get())));
loop->Run(); loop->Run();
bool error = callback_cache_error_ != CACHE_STORAGE_OK; return callback_error_ == CACHE_STORAGE_OK;
return !error;
} }
CacheStorage* CacheStorageForOrigin(const GURL& origin) { CacheStorage* CacheStorageForOrigin(const GURL& origin) {
...@@ -242,7 +236,6 @@ class CacheStorageManagerTest : public testing::Test { ...@@ -242,7 +236,6 @@ class CacheStorageManagerTest : public testing::Test {
scoped_refptr<CacheStorageCache> callback_cache_; scoped_refptr<CacheStorageCache> callback_cache_;
int callback_bool_; int callback_bool_;
CacheStorageError callback_error_; CacheStorageError callback_error_;
CacheStorageError callback_cache_error_;
scoped_ptr<ServiceWorkerResponse> callback_cache_response_; scoped_ptr<ServiceWorkerResponse> callback_cache_response_;
std::vector<std::string> callback_strings_; std::vector<std::string> callback_strings_;
...@@ -359,14 +352,14 @@ TEST_P(CacheStorageManagerTestP, StorageMatchNoEntry) { ...@@ -359,14 +352,14 @@ TEST_P(CacheStorageManagerTestP, StorageMatchNoEntry) {
EXPECT_TRUE(Open(origin1_, "foo")); EXPECT_TRUE(Open(origin1_, "foo"));
EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo")));
EXPECT_FALSE(StorageMatch(origin1_, "foo", GURL("http://example.com/bar"))); EXPECT_FALSE(StorageMatch(origin1_, "foo", GURL("http://example.com/bar")));
EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_cache_error_); EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_error_);
} }
TEST_P(CacheStorageManagerTestP, StorageMatchNoCache) { TEST_P(CacheStorageManagerTestP, StorageMatchNoCache) {
EXPECT_TRUE(Open(origin1_, "foo")); EXPECT_TRUE(Open(origin1_, "foo"));
EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo")));
EXPECT_FALSE(StorageMatch(origin1_, "bar", GURL("http://example.com/foo"))); EXPECT_FALSE(StorageMatch(origin1_, "bar", GURL("http://example.com/foo")));
EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_cache_error_); EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_error_);
} }
TEST_P(CacheStorageManagerTestP, StorageMatchAllEntryExists) { TEST_P(CacheStorageManagerTestP, StorageMatchAllEntryExists) {
...@@ -379,12 +372,12 @@ TEST_P(CacheStorageManagerTestP, StorageMatchAllNoEntry) { ...@@ -379,12 +372,12 @@ TEST_P(CacheStorageManagerTestP, StorageMatchAllNoEntry) {
EXPECT_TRUE(Open(origin1_, "foo")); EXPECT_TRUE(Open(origin1_, "foo"));
EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo")));
EXPECT_FALSE(StorageMatchAll(origin1_, GURL("http://example.com/bar"))); EXPECT_FALSE(StorageMatchAll(origin1_, GURL("http://example.com/bar")));
EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_cache_error_); EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_error_);
} }
TEST_P(CacheStorageManagerTestP, StorageMatchAllNoCaches) { TEST_P(CacheStorageManagerTestP, StorageMatchAllNoCaches) {
EXPECT_FALSE(StorageMatchAll(origin1_, GURL("http://example.com/foo"))); EXPECT_FALSE(StorageMatchAll(origin1_, GURL("http://example.com/foo")));
EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_cache_error_); EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_error_);
} }
TEST_P(CacheStorageManagerTestP, StorageMatchAllEntryExistsTwice) { TEST_P(CacheStorageManagerTestP, StorageMatchAllEntryExistsTwice) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment