| Index: components/ntp_snippets/ntp_snippets_database_unittest.cc
|
| diff --git a/components/ntp_snippets/ntp_snippets_database_unittest.cc b/components/ntp_snippets/ntp_snippets_database_unittest.cc
|
| index a20133bbc17d52366d2abb584784e1f88c52b183..1c7c8f86bcd10592674d41a04c20b1b32ed0a734 100644
|
| --- a/components/ntp_snippets/ntp_snippets_database_unittest.cc
|
| +++ b/components/ntp_snippets/ntp_snippets_database_unittest.cc
|
| @@ -249,7 +249,7 @@ TEST_F(NTPSnippetsDatabaseTest, Delete) {
|
| base::RunLoop().RunUntilIdle();
|
| }
|
|
|
| -TEST_F(NTPSnippetsDatabaseTest, DeleteSnippetAlsoDeletesImage) {
|
| +TEST_F(NTPSnippetsDatabaseTest, DeleteSnippetDoesNotDeleteImage) {
|
| CreateDatabase();
|
| base::RunLoop().RunUntilIdle();
|
| ASSERT_TRUE(db()->IsInitialized());
|
| @@ -278,6 +278,38 @@ TEST_F(NTPSnippetsDatabaseTest, DeleteSnippetAlsoDeletesImage) {
|
| // Delete the snippet.
|
| db()->DeleteSnippet(snippet->id());
|
|
|
| + // Make sure the image is still there.
|
| + EXPECT_CALL(*this, OnImageLoaded(image_data));
|
| + db()->LoadImage(snippet->id(),
|
| + base::Bind(&NTPSnippetsDatabaseTest::OnImageLoaded,
|
| + base::Unretained(this)));
|
| + base::RunLoop().RunUntilIdle();
|
| +}
|
| +
|
| +TEST_F(NTPSnippetsDatabaseTest, DeleteImage) {
|
| + CreateDatabase();
|
| + base::RunLoop().RunUntilIdle();
|
| + ASSERT_TRUE(db()->IsInitialized());
|
| +
|
| + std::unique_ptr<NTPSnippet> snippet = CreateTestSnippet();
|
| + std::string image_data("pretty image");
|
| +
|
| + // Store the image.
|
| + db()->SaveImage(snippet->id(), image_data);
|
| + base::RunLoop().RunUntilIdle();
|
| +
|
| + // Make sure the image is there.
|
| + EXPECT_CALL(*this, OnImageLoaded(image_data));
|
| + db()->LoadImage(snippet->id(),
|
| + base::Bind(&NTPSnippetsDatabaseTest::OnImageLoaded,
|
| + base::Unretained(this)));
|
| + base::RunLoop().RunUntilIdle();
|
| +
|
| + Mock::VerifyAndClearExpectations(this);
|
| +
|
| + // Delete the snippet.
|
| + db()->DeleteImage(snippet->id());
|
| +
|
| // Make sure the image is gone.
|
| EXPECT_CALL(*this, OnImageLoaded(std::string()));
|
| db()->LoadImage(snippet->id(),
|
|
|