#include "base/logging.h"
#include "base/run_loop.h"
#include "base/values.h"
#include "components/shared_highlighting/core/common/shared_highlighting_data_driven_test.h"
#include "components/shared_highlighting/core/common/shared_highlighting_data_driven_test_results.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/annotation/annotation_agent_container_impl.h"
#include "third_party/blink/renderer/core/annotation/annotation_agent_impl.h"
#include "third_party/blink/renderer/core/editing/iterators/text_iterator.h"
#include "third_party/blink/renderer/core/editing/markers/document_marker_controller.h"
#include "third_party/blink/renderer/core/fragment_directive/text_directive.h"
#include "third_party/blink/renderer/core/fragment_directive/text_fragment_anchor.h"
#include "third_party/blink/renderer/core/fragment_directive/text_fragment_handler.h"
#include "third_party/blink/renderer/core/fragment_directive/text_fragment_selector_generator.h"
#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/core/testing/sim/sim_request.h"
#include "third_party/blink/renderer/core/testing/sim/sim_test.h"
#include "third_party/blink/renderer/platform/scheduler/public/main_thread_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
RunPendingTasks;
class TextFragmentGenerationNavigationTest
: public shared_highlighting::SharedHighlightingDataDrivenTest,
public testing::WithParamInterface<base::FilePath>,
public SimTest { … };
void TextFragmentGenerationNavigationTest::SetUp() { … }
void TextFragmentGenerationNavigationTest::RunAsyncMatchingTasks() { … }
TextFragmentAnchor*
TextFragmentGenerationNavigationTest::GetTextFragmentAnchor() { … }
void TextFragmentGenerationNavigationTest::LoadHTML(String url,
String html_content) { … }
RangeInFlatTree* TextFragmentGenerationNavigationTest::GetSelectionRange(
std::string* start_parent_id,
int start_offset_in_parent,
std::optional<int> start_text_offset,
std::string* end_parent_id,
int end_offset_in_parent,
std::optional<int> end_text_offset) { … }
String TextFragmentGenerationNavigationTest::GenerateSelector(
const RangeInFlatTree& selection_range) { … }
String TextFragmentGenerationNavigationTest::GetHighlightedText() { … }
shared_highlighting::SharedHighlightingDataDrivenTestResults
TextFragmentGenerationNavigationTest::GenerateAndNavigate(
std::string html_content,
std::string* start_parent_id,
int start_offset_in_parent,
std::optional<int> start_text_offset,
std::string* end_parent_id,
int end_offset_in_parent,
std::optional<int> end_text_offset,
std::string selected_text,
std::string* highlight_text) { … }
TEST_P(TextFragmentGenerationNavigationTest,
DataDrivenGenerationAndNavigation) { … }
INSTANTIATE_TEST_SUITE_P(…);
}