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

Side by Side Diff: content/browser/appcache/appcache_service_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "content/browser/appcache/appcache_response.h"
12 #include "content/browser/appcache/appcache_service_impl.h"
11 #include "content/browser/appcache/mock_appcache_storage.h" 13 #include "content/browser/appcache/mock_appcache_storage.h"
12 #include "net/base/completion_callback.h" 14 #include "net/base/completion_callback.h"
13 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
14 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
15 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
16 #include "webkit/browser/appcache/appcache_response.h"
17 #include "webkit/browser/appcache/appcache_service_impl.h"
18
19 using appcache::AppCache;
20 using appcache::AppCacheEntry;
21 using appcache::AppCacheGroup;
22 using appcache::AppCacheInfo;
23 using appcache::AppCacheInfoCollection;
24 using appcache::AppCacheInfoVector;
25 using appcache::AppCacheResponseReader;
26 using appcache::AppCacheServiceImpl;
27 using appcache::HttpResponseInfoIOBuffer;
28 18
29 namespace content { 19 namespace content {
30 namespace { 20 namespace {
31 21
32 const int64 kMockGroupId = 1; 22 const int64 kMockGroupId = 1;
33 const int64 kMockCacheId = 1; 23 const int64 kMockCacheId = 1;
34 const int64 kMockResponseId = 1; 24 const int64 kMockResponseId = 1;
35 const int64 kMissingCacheId = 5; 25 const int64 kMissingCacheId = 5;
36 const int64 kMissingResponseId = 5; 26 const int64 kMissingResponseId = 5;
37 const char kMockHeaders[] = 27 const char kMockHeaders[] =
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 TEST_F(AppCacheServiceImplTest, DeleteAppCachesForOrigin) { 182 TEST_F(AppCacheServiceImplTest, DeleteAppCachesForOrigin) {
193 // Without giving mock storage simiulated info, should fail. 183 // Without giving mock storage simiulated info, should fail.
194 service_->DeleteAppCachesForOrigin(kOrigin, deletion_callback_); 184 service_->DeleteAppCachesForOrigin(kOrigin, deletion_callback_);
195 EXPECT_EQ(0, delete_completion_count_); 185 EXPECT_EQ(0, delete_completion_count_);
196 base::RunLoop().RunUntilIdle(); 186 base::RunLoop().RunUntilIdle();
197 EXPECT_EQ(1, delete_completion_count_); 187 EXPECT_EQ(1, delete_completion_count_);
198 EXPECT_EQ(net::ERR_FAILED, delete_result_); 188 EXPECT_EQ(net::ERR_FAILED, delete_result_);
199 delete_completion_count_ = 0; 189 delete_completion_count_ = 0;
200 190
201 // Should succeed given an empty info collection. 191 // Should succeed given an empty info collection.
202 mock_storage()->SimulateGetAllInfo(new AppCacheInfoCollection); 192 mock_storage()->SimulateGetAllInfo(new content::AppCacheInfoCollection);
203 service_->DeleteAppCachesForOrigin(kOrigin, deletion_callback_); 193 service_->DeleteAppCachesForOrigin(kOrigin, deletion_callback_);
204 EXPECT_EQ(0, delete_completion_count_); 194 EXPECT_EQ(0, delete_completion_count_);
205 base::RunLoop().RunUntilIdle(); 195 base::RunLoop().RunUntilIdle();
206 EXPECT_EQ(1, delete_completion_count_); 196 EXPECT_EQ(1, delete_completion_count_);
207 EXPECT_EQ(net::OK, delete_result_); 197 EXPECT_EQ(net::OK, delete_result_);
208 delete_completion_count_ = 0; 198 delete_completion_count_ = 0;
209 199
210 scoped_refptr<AppCacheInfoCollection> info(new AppCacheInfoCollection); 200 scoped_refptr<AppCacheInfoCollection> info(new AppCacheInfoCollection);
211 201
212 // Should succeed given a non-empty info collection. 202 // Should succeed given a non-empty info collection.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 EXPECT_EQ(kOneHour, service->reinit_timer_.GetCurrentDelay()); 367 EXPECT_EQ(kOneHour, service->reinit_timer_.GetCurrentDelay());
378 EXPECT_EQ(kOneHour, service->next_reinit_delay_); 368 EXPECT_EQ(kOneHour, service->next_reinit_delay_);
379 369
380 // Fine to delete while pending. 370 // Fine to delete while pending.
381 service.reset(NULL); 371 service.reset(NULL);
382 } 372 }
383 373
384 374
385 375
386 } // namespace content 376 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698