Commit 84bc2346 authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Commit Bot

Fix CFI bad casts in BackgroundLoaderOfflinerTest.

Previously these tests did not use the conventional TestRenderFrameHost
and TestRenderViewHost objects, but instead used RenderFrameHostImpl
and RenderViewHostImpl. This caused them to fail with CFI bad cast
errors when code in TestWebContents attempted to cast these objects
to the test classes.

This change eliminates the bad casts by creating
a RenderViewHostTestEnabler object in the scope of the test
fixture. This ensures that any Render*Host objects created for the
duration of the test are in fact of type TestRender*Host.

Bug: 469376
Change-Id: I9d4d048e7c8f1162fd4c8bc8e67ffc0932b6d220
Reviewed-on: https://chromium-review.googlesource.com/792450Reviewed-by: default avatarCathy Li <chili@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522212}
parent 6a50ec0d
......@@ -28,6 +28,7 @@
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/web_contents_tester.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
......@@ -223,6 +224,7 @@ class BackgroundLoaderOfflinerTest : public testing::Test {
void OnProgress(const SavePageRequest& request, int64_t bytes);
void OnCancel(const SavePageRequest& request);
content::TestBrowserThreadBundle thread_bundle_;
content::RenderViewHostTestEnabler rvhte_;
TestingProfile profile_;
std::unique_ptr<OfflinerPolicy> policy_;
TestLoadTerminationListener* load_termination_listener_;
......
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