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

Unified Diff: components/safe_browsing_db/v4_store_unittest.cc

Issue 2103693002: SafeBrowsing PVer4: Send mutable response to the database and the stores (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@02_ReadFromDisk
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: components/safe_browsing_db/v4_store_unittest.cc
diff --git a/components/safe_browsing_db/v4_store_unittest.cc b/components/safe_browsing_db/v4_store_unittest.cc
index 5754a39ab7997ae1d11d222634c396f503471c92..ca603ec802b23186f064637bf04fa6345a262789 100644
--- a/components/safe_browsing_db/v4_store_unittest.cc
+++ b/components/safe_browsing_db/v4_store_unittest.cc
@@ -4,6 +4,7 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
+#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/test/test_simple_task_runner.h"
#include "base/time/time.h"
@@ -113,26 +114,26 @@ TEST_F(V4StoreTest, TestReadFromNoHashPrefixesFile) {
}
TEST_F(V4StoreTest, TestWriteNoResponseType) {
- ListUpdateResponse list_update_response;
- EXPECT_EQ(
- INVALID_RESPONSE_TYPE_FAILURE,
- V4Store(task_runner_, store_path_).WriteToDisk(list_update_response));
+ EXPECT_EQ(INVALID_RESPONSE_TYPE_FAILURE,
+ V4Store(task_runner_, store_path_)
+ .WriteToDisk(base::WrapUnique(new ListUpdateResponse)));
}
TEST_F(V4StoreTest, TestWritePartialResponseType) {
- ListUpdateResponse list_update_response;
- list_update_response.set_response_type(ListUpdateResponse::PARTIAL_UPDATE);
- EXPECT_EQ(
- INVALID_RESPONSE_TYPE_FAILURE,
- V4Store(task_runner_, store_path_).WriteToDisk(list_update_response));
+ ListUpdateResponse* list_update_response = new ListUpdateResponse;
Scott Hess - ex-Googler 2016/06/28 03:58:43 This leaves the pointer unowned for a bit. Instea
vakh (use Gerrit instead) 2016/06/28 21:34:14 Done.
+ list_update_response->set_response_type(ListUpdateResponse::PARTIAL_UPDATE);
+ EXPECT_EQ(INVALID_RESPONSE_TYPE_FAILURE,
+ V4Store(task_runner_, store_path_)
+ .WriteToDisk(base::WrapUnique(list_update_response)));
}
TEST_F(V4StoreTest, TestWriteFullResponseType) {
- ListUpdateResponse list_update_response;
- list_update_response.set_response_type(ListUpdateResponse::FULL_UPDATE);
- list_update_response.set_new_client_state("test_client_state");
+ ListUpdateResponse* list_update_response = new ListUpdateResponse;
Scott Hess - ex-Googler 2016/06/28 03:58:43 Likewise here.
vakh (use Gerrit instead) 2016/06/28 21:34:14 Done.
+ list_update_response->set_response_type(ListUpdateResponse::FULL_UPDATE);
+ list_update_response->set_new_client_state("test_client_state");
V4Store* write_store = new V4Store(task_runner_, store_path_);
- EXPECT_EQ(WRITE_SUCCESS, write_store->WriteToDisk(list_update_response));
+ EXPECT_EQ(WRITE_SUCCESS,
+ write_store->WriteToDisk(base::WrapUnique(list_update_response)));
V4Store* read_store = new V4Store(task_runner_, store_path_);
EXPECT_EQ(READ_SUCCESS, read_store->ReadFromDisk());

Powered by Google App Engine
This is Rietveld 408576698