0

[unseasoned-pdf] Fix nits in PdfViewWebPluginTest.ChangeTextSelection.

Following up on https://crrev.com/c/2889914/ regarding test
PdfViewWebPluginTest.ChangeTextSelection:

- Replace the custom matcher EqualsWebString() with
  blink::WebString::FromUTF8().

- Remove the InSequence variable since there is no need to keep
  EXPECT_CALL() calls in order.

- Remove an extra header.

Bug: 1199558
Change-Id: Id829588f2d9cc7572e492219267fd2d9ae770853
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2898153
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#883181}
This commit is contained in:
Hui Yingst
2021-05-14 22:43:19 +00:00
committed by Chromium LUCI CQ
parent c9511accc3
commit af1684479b

@ -5,7 +5,6 @@
#include "pdf/pdf_view_web_plugin.h"
#include <memory>
#include <string>
#include <utility>
#include "cc/paint/paint_canvas.h"
@ -69,10 +68,6 @@ SkBitmap GenerateExpectedBitmapForPaint(float device_scale,
return expected_bitmap;
}
MATCHER_P(EqualsWebString, selected_string, "") {
return arg.Utf8() == selected_string;
}
class FakeContainerWrapper final : public PdfViewWebPlugin::ContainerWrapper {
public:
explicit FakeContainerWrapper(PdfViewWebPlugin* web_plugin)
@ -293,10 +288,9 @@ TEST_F(PdfViewWebPluginTest, ChangeTextSelection) {
ASSERT_TRUE(plugin_->SelectionAsText().IsEmpty());
ASSERT_TRUE(plugin_->SelectionAsMarkup().IsEmpty());
testing::InSequence s;
static constexpr char kSelectedText[] = "1234";
EXPECT_CALL(*wrapper_ptr_,
TextSelectionChanged(EqualsWebString(kSelectedText), 0,
TextSelectionChanged(blink::WebString::FromUTF8(kSelectedText), 0,
gfx::Range(0, 4)));
plugin_->SetSelectedText(kSelectedText);
@ -305,8 +299,9 @@ TEST_F(PdfViewWebPluginTest, ChangeTextSelection) {
EXPECT_EQ(kSelectedText, plugin_->SelectionAsMarkup().Utf8());
static constexpr char kEmptyText[] = "";
EXPECT_CALL(*wrapper_ptr_, TextSelectionChanged(EqualsWebString(kEmptyText),
0, gfx::Range(0, 0)));
EXPECT_CALL(*wrapper_ptr_,
TextSelectionChanged(blink::WebString::FromUTF8(kEmptyText), 0,
gfx::Range(0, 0)));
plugin_->SetSelectedText(kEmptyText);
EXPECT_FALSE(plugin_->HasSelection());
EXPECT_TRUE(plugin_->SelectionAsText().IsEmpty());