Skip to content

Commit

Permalink
Fixed codereview notice for CreateUrlDeleteDirective patch
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyBarabash committed Oct 16, 2023
1 parent 0db92ab commit fa0fe5f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* 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 "components/history/core/browser/sync/delete_directive_handler.h"

#define CreateUrlDeleteDirective CreateUrlDeleteDirective_ChromiumImpl
#include "src/components/history/core/browser/sync/delete_directive_handler.cc"
#undef CreateUrlDeleteDirective

namespace history {

bool DeleteDirectiveHandler::CreateUrlDeleteDirective(const GURL& url) {
return false;
}

} // namespace history
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* 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/. */

#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_DELETE_DIRECTIVE_HANDLER_H_
#define BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_DELETE_DIRECTIVE_HANDLER_H_

#define CreateTimeRangeDeleteDirective \
CreateUrlDeleteDirective_ChromiumImpl(const GURL& url); \
bool CreateTimeRangeDeleteDirective

#include "src/components/history/core/browser/sync/delete_directive_handler.h" // IWYU pragma: export

#undef CreateTimeRangeDeleteDirective

#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_DELETE_DIRECTIVE_HANDLER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,9 @@
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());
BraveCreateUrlDeleteDirectiveReturnsFalse) {
EXPECT_FALSE(handler()->CreateUrlDeleteDirective(GURL("https://brave.com")));
}

} // namespace
Expand Down

This file was deleted.

0 comments on commit fa0fe5f

Please sign in to comment.