Use base::FilePath::StringType for GetInkTestDataFilePath()
Update GetInkTestDataFilePath() to accept the platform-varying base::FilePath::StringType as the filename parameter type. This makes the method more usable for filename manipulation, such as with GetTestDataPathWithPlatformSuffix(). Change-Id: I7c1b6307d4fa6fb8f49d10f8986d82be6665c3a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6353336 Reviewed-by: Andy Phan <andyphan@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Alan Screen <awscreen@chromium.org> Cr-Commit-Position: refs/heads/main@{#1432397}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
6202af70ce
commit
3977e99b1d
@ -3004,8 +3004,9 @@ TEST_F(PdfViewWebPluginInkTest, DrawInProgressStroke) {
|
||||
|
||||
// Draw the canvas for the in-progress stroke.
|
||||
plugin_->Paint(canvas_.sk_canvas(), kScreenRect);
|
||||
EXPECT_TRUE(MatchesPngFile(canvas_.GetBitmap().asImage().get(),
|
||||
GetInkTestDataFilePath("diagonal_stroke.png")));
|
||||
EXPECT_TRUE(MatchesPngFile(
|
||||
canvas_.GetBitmap().asImage().get(),
|
||||
GetInkTestDataFilePath(FILE_PATH_LITERAL("diagonal_stroke.png"))));
|
||||
|
||||
// Finish the stroke. After a stroke is finished there is nothing more to
|
||||
// be drawn by PdfInkModule, as the completed stroke is provided by a
|
||||
|
@ -2288,7 +2288,7 @@ TEST_P(PDFiumEngineInkDrawTest, StrokeData) {
|
||||
|
||||
// Verify the visibility of strokes for in-memory PDF.
|
||||
const base::FilePath kAppliedStroke2FilePath(
|
||||
GetInkTestDataFilePath("applied_stroke2.png"));
|
||||
GetInkTestDataFilePath(FILE_PATH_LITERAL("applied_stroke2.png")));
|
||||
CheckPdfRendering(page.GetPage(), kPageSizeInPoints, kAppliedStroke2FilePath);
|
||||
EXPECT_TRUE(engine->stroked_pages_unload_preventers_for_testing().contains(
|
||||
kPageIndex));
|
||||
@ -2310,7 +2310,7 @@ TEST_P(PDFiumEngineInkDrawTest, StrokeData) {
|
||||
engine->UpdateStrokeActive(kPageIndex, kHighlighterStrokeId,
|
||||
/*active=*/false);
|
||||
const base::FilePath kAppliedStroke1FilePath(
|
||||
GetInkTestDataFilePath("applied_stroke1.png"));
|
||||
GetInkTestDataFilePath(FILE_PATH_LITERAL("applied_stroke1.png")));
|
||||
CheckPdfRendering(page.GetPage(), kPageSizeInPoints, kAppliedStroke1FilePath);
|
||||
saved_pdf_data = engine->GetSaveData();
|
||||
ASSERT_FALSE(saved_pdf_data.empty());
|
||||
@ -2376,7 +2376,7 @@ TEST_P(PDFiumEngineInkDrawTest, StrokeDiscardStroke) {
|
||||
|
||||
// Verify the visibility of strokes for in-memory PDF.
|
||||
const base::FilePath kAppliedStroke1FilePath(
|
||||
GetInkTestDataFilePath("applied_stroke1.png"));
|
||||
GetInkTestDataFilePath(FILE_PATH_LITERAL("applied_stroke1.png")));
|
||||
CheckPdfRendering(page.GetPage(), kPageSizeInPoints, kAppliedStroke1FilePath);
|
||||
EXPECT_TRUE(engine->stroked_pages_unload_preventers_for_testing().contains(
|
||||
kPageIndex));
|
||||
@ -2416,7 +2416,7 @@ TEST_P(PDFiumEngineInkDrawTest, StrokeDiscardStroke) {
|
||||
|
||||
// Verify the visibility of strokes for in-memory PDF.
|
||||
const base::FilePath kAppliedStroke3FilePath(
|
||||
GetInkTestDataFilePath("applied_stroke3.png"));
|
||||
GetInkTestDataFilePath(FILE_PATH_LITERAL("applied_stroke3.png")));
|
||||
CheckPdfRendering(page.GetPage(), kPageSizeInPoints, kAppliedStroke3FilePath);
|
||||
EXPECT_EQ(FPDFPage_CountObjects(page.GetPage()), 1);
|
||||
EXPECT_TRUE(engine->stroked_pages_unload_preventers_for_testing().contains(
|
||||
@ -2433,7 +2433,8 @@ TEST_P(PDFiumEngineInkDrawTest, LoadedV2InkPathsAndUpdateShapeActive) {
|
||||
// Check the initial loaded PDF.
|
||||
constexpr int kPageIndex = 0;
|
||||
constexpr gfx::Size kPageSizeInPoints(200, 200);
|
||||
const base::FilePath kInkV2PngPath = GetInkTestDataFilePath("ink_v2.png");
|
||||
const base::FilePath kInkV2PngPath =
|
||||
GetInkTestDataFilePath(FILE_PATH_LITERAL("ink_v2.png"));
|
||||
PDFiumPage& page = GetPDFiumPageForTest(*engine, kPageIndex);
|
||||
CheckPdfRendering(page.GetPage(), kPageSizeInPoints, kInkV2PngPath);
|
||||
EXPECT_EQ(GetPdfMarkObjCountForTesting(engine->doc(),
|
||||
|
@ -108,9 +108,10 @@ TEST_P(PDFiumInkWriterTest, BasicWriteAndRead) {
|
||||
std::vector<uint8_t> saved_pdf_data = engine->GetSaveData();
|
||||
ASSERT_TRUE(!saved_pdf_data.empty());
|
||||
|
||||
CheckPdfRendering(saved_pdf_data,
|
||||
/*page_index=*/0, gfx::Size(200, 200),
|
||||
GetInkTestDataFilePath("ink_writer_basic.png"));
|
||||
CheckPdfRendering(
|
||||
saved_pdf_data,
|
||||
/*page_index=*/0, gfx::Size(200, 200),
|
||||
GetInkTestDataFilePath(FILE_PATH_LITERAL("ink_writer_basic.png")));
|
||||
|
||||
// Load `saved_pdf_data` into `saved_engine` and get a handle to the one and
|
||||
// only page.
|
||||
|
@ -67,8 +67,8 @@ base::Value::Dict CreateSetAnnotationUndoRedoMessageForTesting(
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
base::FilePath GetInkTestDataFilePath(std::string_view filename) {
|
||||
return base::FilePath(FILE_PATH_LITERAL("ink")).AppendASCII(filename);
|
||||
base::FilePath GetInkTestDataFilePath(base::FilePath::StringViewType filename) {
|
||||
return base::FilePath(FILE_PATH_LITERAL("ink")).Append(filename);
|
||||
}
|
||||
|
||||
} // namespace chrome_pdf
|
||||
|
@ -72,7 +72,7 @@ MATCHER_P6(InkAffineTransformEq,
|
||||
}
|
||||
|
||||
// Generate the path for test files specific to Ink.
|
||||
base::FilePath GetInkTestDataFilePath(std::string_view filename);
|
||||
base::FilePath GetInkTestDataFilePath(base::FilePath::StringViewType filename);
|
||||
|
||||
} // namespace chrome_pdf
|
||||
|
||||
|
Reference in New Issue
Block a user