Commit 2a76d152 authored by pcc's avatar pcc Committed by Commit bot

Move TestExtraData classes to anonymous namespace.

We were previously declaring two different classes with the name
blink::TestExtraData, which is an ODR violation. As it happens,
their implementations compiled to the same machine code, which
allowed the tests to pass in most normal circumstances. However,
the ODR violation causes test failures in CFI mode (e.g. [1]) as a
result of stricter type checking. The fix is to move both classes to
an anonymous namespace which makes them internal to their TUs.

[1] https://build.chromium.org/p/chromium.fyi/builders/CFI%20Linux/builds/5924/steps/webkit_unit_tests/logs/WebURLResponseTest.ExtraData

BUG=464797
R=thakis@chromium.org

Review-Url: https://codereview.chromium.org/2119683002
Cr-Commit-Position: refs/heads/master@{#403338}
parent 6ad9d629
......@@ -34,6 +34,8 @@
namespace blink {
namespace {
class TestExtraData : public WebURLRequest::ExtraData {
public:
explicit TestExtraData(bool* alive)
......@@ -48,6 +50,8 @@ private:
bool* m_alive;
};
} // anonymous namespace
TEST(WebURLRequestTest, ExtraData)
{
bool alive = false;
......
......@@ -34,6 +34,8 @@
namespace blink {
namespace {
class TestExtraData : public WebURLResponse::ExtraData {
public:
explicit TestExtraData(bool* alive)
......@@ -48,6 +50,8 @@ private:
bool* m_alive;
};
} // anonymous namespace
TEST(WebURLResponseTest, ExtraData)
{
bool alive = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment