-
Notifications
You must be signed in to change notification settings - Fork 895
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test to ensure we don't send url at HistoryDeleteDirectiveSpeci…
…fics::UrlDirective
- Loading branch information
1 parent
94082ef
commit 577c76f
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include_rules = [ | ||
"+src/components/history/core/browser/sync/delete_directive_handler_unittest.cc", | ||
] |
41 changes: 41 additions & 0 deletions
41
chromium_src/components/history/core/browser/sync/delete_directive_handler_unittest.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "src/components/history/core/browser/sync/delete_directive_handler_unittest.cc" | ||
|
||
namespace history { | ||
namespace { | ||
|
||
// Check if patch for DeleteDirectiveHandler::CreateUrlDeleteDirective works. | ||
// Create UrlDeleteDirective and ensure that url is in fact empty. | ||
TEST_F(HistoryDeleteDirectiveHandlerTest, | ||
BraveCreateUrlDeleteDirectiveOmitsUrl) { | ||
syncer::FakeSyncChangeProcessor change_processor; | ||
|
||
EXPECT_FALSE( | ||
handler() | ||
->MergeDataAndStartSyncing( | ||
syncer::HISTORY_DELETE_DIRECTIVES, syncer::SyncDataList(), | ||
std::make_unique<syncer::SyncChangeProcessorWrapperForTest>( | ||
&change_processor)) | ||
.has_value()); | ||
|
||
bool create_directive_result = | ||
handler()->CreateUrlDeleteDirective(GURL("https://brave.com")); | ||
EXPECT_TRUE(create_directive_result); | ||
|
||
ASSERT_EQ(1u, change_processor.changes().size()); | ||
|
||
const auto& specifics = | ||
change_processor.changes()[0].sync_data().GetSpecifics(); | ||
ASSERT_TRUE(specifics.has_history_delete_directive()); | ||
const auto& history_delete_directive = specifics.history_delete_directive(); | ||
ASSERT_TRUE(history_delete_directive.has_url_directive()); | ||
EXPECT_FALSE(history_delete_directive.url_directive().has_url()); | ||
EXPECT_EQ(history_delete_directive.url_directive().url(), std::string()); | ||
} | ||
|
||
} // namespace | ||
} // namespace history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
source_set("unit_tests") { | ||
testonly = true | ||
sources = [ "//components/history/core/browser/sync/delete_directive_handler_unittest.cc" ] | ||
deps = [ | ||
"//base", | ||
"//base/test:test_support", | ||
"//components/history/core/browser:browser", | ||
"//components/history/core/common", | ||
"//components/history/core/test", | ||
"//components/prefs:test_support", | ||
"//components/sync", | ||
"//components/sync:test_support", | ||
"//testing/gtest", | ||
"//url", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters