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

Side by Side Diff: blimp/common/blob_cache/in_memory_blob_cache_unittest.cc

Issue 1958823002: Fix implicit access to raw pointer of scoped_refptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Splitting out change to scoped_refptr to follow up patch. Created 4 years, 7 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
« no previous file with comments | « base/threading/thread_unittest.cc ('k') | cc/test/fake_video_frame_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <algorithm> 5 #include <algorithm>
6 #include <memory> 6 #include <memory>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 18 matching lines...) Expand all
29 public: 29 public:
30 InMemoryBlobCacheTest() {} 30 InMemoryBlobCacheTest() {}
31 ~InMemoryBlobCacheTest() override {} 31 ~InMemoryBlobCacheTest() override {}
32 32
33 protected: 33 protected:
34 InMemoryBlobCache cache_; 34 InMemoryBlobCache cache_;
35 }; 35 };
36 36
37 TEST_F(InMemoryBlobCacheTest, SimplePutContainsAndGetOperations) { 37 TEST_F(InMemoryBlobCacheTest, SimplePutContainsAndGetOperations) {
38 EXPECT_FALSE(cache_.Contains(kFoo)); 38 EXPECT_FALSE(cache_.Contains(kFoo));
39 EXPECT_EQ(nullptr, cache_.Get(kFoo)); 39 EXPECT_FALSE(cache_.Get(kFoo));
40 40
41 BlobDataPtr blob_data = CreateBlobDataPtr(kDeadbeef); 41 BlobDataPtr blob_data = CreateBlobDataPtr(kDeadbeef);
42 cache_.Put(kFoo, blob_data); 42 cache_.Put(kFoo, blob_data);
43 43
44 EXPECT_TRUE(cache_.Contains(kFoo)); 44 EXPECT_TRUE(cache_.Contains(kFoo));
45 EXPECT_FALSE(cache_.Contains(kBar)); 45 EXPECT_FALSE(cache_.Contains(kBar));
46 46
47 BlobDataPtr out = cache_.Get(kFoo); 47 BlobDataPtr out = cache_.Get(kFoo);
48 48
49 EXPECT_EQ(blob_data, out); 49 EXPECT_EQ(blob_data, out);
50 } 50 }
51 51
52 TEST_F(InMemoryBlobCacheTest, TestDuplicatePut) { 52 TEST_F(InMemoryBlobCacheTest, TestDuplicatePut) {
53 BlobDataPtr first = CreateBlobDataPtr(kDeadbeef); 53 BlobDataPtr first = CreateBlobDataPtr(kDeadbeef);
54 BlobDataPtr duplicate = CreateBlobDataPtr(kForbiddenCode); 54 BlobDataPtr duplicate = CreateBlobDataPtr(kForbiddenCode);
55 cache_.Put(kFoo, first); 55 cache_.Put(kFoo, first);
56 56
57 BlobDataPtr out1 = cache_.Get(kFoo); 57 BlobDataPtr out1 = cache_.Get(kFoo);
58 EXPECT_EQ(first, out1); 58 EXPECT_EQ(first, out1);
59 59
60 // The second put should be ignored and retrieving kFoo should still retrieve 60 // The second put should be ignored and retrieving kFoo should still retrieve
61 // the first item. 61 // the first item.
62 cache_.Put(kFoo, duplicate); 62 cache_.Put(kFoo, duplicate);
63 BlobDataPtr out2 = cache_.Get(kFoo); 63 BlobDataPtr out2 = cache_.Get(kFoo);
64 EXPECT_EQ(first, out2); 64 EXPECT_EQ(first, out2);
65 } 65 }
66 66
67 } // namespace 67 } // namespace
68 } // namespace blimp 68 } // namespace blimp
OLDNEW
« no previous file with comments | « base/threading/thread_unittest.cc ('k') | cc/test/fake_video_frame_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698