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

Side by Side Diff: content/browser/appcache/appcache_host_unittest.cc

Issue 1418783005: Fix possible map::end() dereference in AppCacheUpdateJob triggered by a compromised renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move check to host, add unittest Created 5 years, 1 month 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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/browser/appcache/appcache.h" 9 #include "content/browser/appcache/appcache.h"
10 #include "content/browser/appcache/appcache_backend_impl.h" 10 #include "content/browser/appcache/appcache_backend_impl.h"
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 EXPECT_EQ(&service_, host.service()); 523 EXPECT_EQ(&service_, host.service());
524 EXPECT_EQ(&mock_frontend_, host.frontend()); 524 EXPECT_EQ(&mock_frontend_, host.frontend());
525 EXPECT_EQ(NULL, host.associated_cache()); 525 EXPECT_EQ(NULL, host.associated_cache());
526 EXPECT_FALSE(host.is_selection_pending()); 526 EXPECT_FALSE(host.is_selection_pending());
527 EXPECT_TRUE(host.preferred_manifest_url().is_empty()); 527 EXPECT_TRUE(host.preferred_manifest_url().is_empty());
528 } 528 }
529 EXPECT_EQ(0, mock_quota_proxy->GetInUseCount(kDocAndOriginUrl)); 529 EXPECT_EQ(0, mock_quota_proxy->GetInUseCount(kDocAndOriginUrl));
530 service_.set_quota_manager_proxy(NULL); 530 service_.set_quota_manager_proxy(NULL);
531 } 531 }
532 532
533 TEST_F(AppCacheHostTest, SelectCacheTwice) {
534 AppCacheHost host(1, &mock_frontend_, &service_);
535 const GURL kDocAndOriginUrl(GURL("http://whatever/").GetOrigin());
536
537 EXPECT_TRUE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL()));
538
539 // Select methods should bail if cache has already been selected.
540 EXPECT_FALSE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL()));
541 EXPECT_FALSE(host.SelectCacheForWorker(0, 0));
542 EXPECT_FALSE(host.SelectCacheForSharedWorker(kAppCacheNoCacheId));
543 EXPECT_FALSE(host.MarkAsForeignEntry(kDocAndOriginUrl, kAppCacheNoCacheId));
544 }
545
533 } // namespace content 546 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_host.cc ('k') | content/browser/appcache/appcache_update_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698