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

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: Minor: Add the explicit keyword for UpdateListIdentifier constructor 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
« no previous file with comments | « components/safe_browsing_db/v4_store.cc ('k') | components/safe_browsing_db/v4_update_protocol_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 58b2e154be5a7f9198d333865b984b48f2480df2..ec41208a73e923cc979744df2f9087d220df38e8 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,27 +114,27 @@ 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));
+ std::unique_ptr<ListUpdateResponse> list_update_response(
+ new ListUpdateResponse);
+ list_update_response->set_response_type(ListUpdateResponse::PARTIAL_UPDATE);
+ EXPECT_EQ(INVALID_RESPONSE_TYPE_FAILURE,
+ V4Store(task_runner_, store_path_)
+ .WriteToDisk(std::move(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");
- EXPECT_EQ(
- WRITE_SUCCESS,
- V4Store(task_runner_, store_path_).WriteToDisk(list_update_response));
+ std::unique_ptr<ListUpdateResponse> list_update_response(
+ new ListUpdateResponse);
+ list_update_response->set_response_type(ListUpdateResponse::FULL_UPDATE);
+ list_update_response->set_new_client_state("test_client_state");
+ EXPECT_EQ(WRITE_SUCCESS, V4Store(task_runner_, store_path_)
+ .WriteToDisk(std::move(list_update_response)));
std::unique_ptr<V4Store> read_store(new V4Store(task_runner_, store_path_));
EXPECT_EQ(READ_SUCCESS, read_store->ReadFromDisk());
« no previous file with comments | « components/safe_browsing_db/v4_store.cc ('k') | components/safe_browsing_db/v4_update_protocol_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698