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

Side by Side Diff: components/suggestions/image_manager_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
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 "components/suggestions/image_manager.h" 5 #include "components/suggestions/image_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // Create the ImageManager with an added entry in the database. 197 // Create the ImageManager with an added entry in the database.
198 AddEntry(GetSampleImageData(kTestUrl1), &db_model_); 198 AddEntry(GetSampleImageData(kTestUrl1), &db_model_);
199 FakeDB<ImageData>* fake_db = new FakeDB<ImageData>(&db_model_); 199 FakeDB<ImageData>* fake_db = new FakeDB<ImageData>(&db_model_);
200 image_manager_.reset(CreateImageManager(fake_db)); 200 image_manager_.reset(CreateImageManager(fake_db));
201 image_manager_->Initialize(suggestions_profile); 201 image_manager_->Initialize(suggestions_profile);
202 fake_db->InitCallback(true); 202 fake_db->InitCallback(true);
203 fake_db->LoadCallback(true); 203 fake_db->LoadCallback(true);
204 // Expect something in the cache. 204 // Expect something in the cache.
205 auto encoded_image = 205 auto encoded_image =
206 image_manager_->GetEncodedImageFromCache(GURL(kTestUrl1)); 206 image_manager_->GetEncodedImageFromCache(GURL(kTestUrl1));
207 EXPECT_NE(nullptr, encoded_image); 207 EXPECT_TRUE(encoded_image);
208 208
209 base::RunLoop run_loop; 209 base::RunLoop run_loop;
210 image_manager_->GetImageForURL(GURL(kTestUrl1), 210 image_manager_->GetImageForURL(GURL(kTestUrl1),
211 base::Bind(&ImageManagerTest::OnImageAvailable, 211 base::Bind(&ImageManagerTest::OnImageAvailable,
212 base::Unretained(this), &run_loop)); 212 base::Unretained(this), &run_loop));
213 run_loop.Run(); 213 run_loop.Run();
214 214
215 EXPECT_EQ(0, num_callback_null_called_); 215 EXPECT_EQ(0, num_callback_null_called_);
216 EXPECT_EQ(1, num_callback_valid_called_); 216 EXPECT_EQ(1, num_callback_valid_called_);
217 } 217 }
218 218
219 } // namespace suggestions 219 } // namespace suggestions
OLDNEW
« no previous file with comments | « components/drive/drive_uploader.cc ('k') | components/tracing/child_memory_dump_manager_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698