Commit d77621f1 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Misc. cleanup

Found while working on AshTestHelper.

Bug: none
Change-Id: Ia942c7662dea4b3194a31930efe9ce244286effe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2125396Reviewed-by: default avatarMike West <mkwst@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarYuchen Liu <yucliu@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754697}
parent e5bfd81a
...@@ -101,7 +101,6 @@ class MultipleTapDetectorTest : public aura::test::AuraTestBase { ...@@ -101,7 +101,6 @@ class MultipleTapDetectorTest : public aura::test::AuraTestBase {
// Verify that a simple correct triple tap triggers the delegate. // Verify that a simple correct triple tap triggers the delegate.
TEST_F(MultipleTapDetectorTest, TripleTap) { TEST_F(MultipleTapDetectorTest, TripleTap) {
EXPECT_CALL(delegate(), OnTripleTap(Eq(kTestTapLocation))).Times(1); EXPECT_CALL(delegate(), OnTripleTap(Eq(kTestTapLocation))).Times(1);
;
EXPECT_CALL(delegate(), OnDoubleTap(Eq(kTestTapLocation))).Times(0); EXPECT_CALL(delegate(), OnDoubleTap(Eq(kTestTapLocation))).Times(0);
detector().set_enabled(true); detector().set_enabled(true);
......
...@@ -12,14 +12,8 @@ ...@@ -12,14 +12,8 @@
namespace chromeos { namespace chromeos {
namespace network_config { namespace network_config {
CrosNetworkConfigTestHelper::CrosNetworkConfigTestHelper() { CrosNetworkConfigTestHelper::CrosNetworkConfigTestHelper()
network_state_helper_ = std::make_unique<NetworkStateTestHelper>( : CrosNetworkConfigTestHelper(true) {}
false /* use_default_devices_and_services */);
network_device_handler_ =
chromeos::NetworkDeviceHandler::InitializeForTesting(
network_state_helper_->network_state_handler());
Initialize(/*network_configuration_handler=*/nullptr);
}
CrosNetworkConfigTestHelper::CrosNetworkConfigTestHelper(bool initialize) { CrosNetworkConfigTestHelper::CrosNetworkConfigTestHelper(bool initialize) {
network_state_helper_ = std::make_unique<NetworkStateTestHelper>( network_state_helper_ = std::make_unique<NetworkStateTestHelper>(
......
...@@ -28,8 +28,8 @@ namespace { ...@@ -28,8 +28,8 @@ namespace {
class DialogContents : public views::DialogDelegateView { class DialogContents : public views::DialogDelegateView {
public: public:
DialogContents() {} DialogContents() = default;
~DialogContents() override {} ~DialogContents() override = default;
void set_modal_type(ui::ModalType modal_type) { modal_type_ = modal_type; } void set_modal_type(ui::ModalType modal_type) { modal_type_ = modal_type; }
...@@ -50,7 +50,7 @@ class DialogContents : public views::DialogDelegateView { ...@@ -50,7 +50,7 @@ class DialogContents : public views::DialogDelegateView {
class TestConstrainedWindowViewsClient class TestConstrainedWindowViewsClient
: public constrained_window::ConstrainedWindowViewsClient { : public constrained_window::ConstrainedWindowViewsClient {
public: public:
TestConstrainedWindowViewsClient() {} TestConstrainedWindowViewsClient() = default;
// ConstrainedWindowViewsClient: // ConstrainedWindowViewsClient:
web_modal::ModalDialogHost* GetModalDialogHost( web_modal::ModalDialogHost* GetModalDialogHost(
...@@ -70,7 +70,7 @@ class TestConstrainedWindowViewsClient ...@@ -70,7 +70,7 @@ class TestConstrainedWindowViewsClient
// pass a null |context| argument to DialogDelegate::CreateDialogWidget(). // pass a null |context| argument to DialogDelegate::CreateDialogWidget().
class TestViewsDelegateWithContext : public views::TestViewsDelegate { class TestViewsDelegateWithContext : public views::TestViewsDelegate {
public: public:
TestViewsDelegateWithContext() {} TestViewsDelegateWithContext() = default;
void set_context(gfx::NativeWindow context) { context_ = context; } void set_context(gfx::NativeWindow context) { context_ = context; }
...@@ -91,12 +91,11 @@ class TestViewsDelegateWithContext : public views::TestViewsDelegate { ...@@ -91,12 +91,11 @@ class TestViewsDelegateWithContext : public views::TestViewsDelegate {
class ConstrainedWindowViewsTest : public views::ViewsTestBase { class ConstrainedWindowViewsTest : public views::ViewsTestBase {
public: public:
ConstrainedWindowViewsTest() : contents_(nullptr), dialog_(nullptr) {} ConstrainedWindowViewsTest() = default;
~ConstrainedWindowViewsTest() override {} ~ConstrainedWindowViewsTest() override = default;
void SetUp() override { void SetUp() override {
std::unique_ptr<TestViewsDelegateWithContext> views_delegate( auto views_delegate = std::make_unique<TestViewsDelegateWithContext>();
new TestViewsDelegateWithContext);
// set_views_delegate() must be called before SetUp(), and GetContext() is // set_views_delegate() must be called before SetUp(), and GetContext() is
// null before that, so take a reference. // null before that, so take a reference.
...@@ -137,9 +136,9 @@ class ConstrainedWindowViewsTest : public views::ViewsTestBase { ...@@ -137,9 +136,9 @@ class ConstrainedWindowViewsTest : public views::ViewsTestBase {
Widget* dialog() { return dialog_; } Widget* dialog() { return dialog_; }
private: private:
DialogContents* contents_; DialogContents* contents_ = nullptr;
std::unique_ptr<web_modal::TestWebContentsModalDialogHost> dialog_host_; std::unique_ptr<web_modal::TestWebContentsModalDialogHost> dialog_host_;
Widget* dialog_; Widget* dialog_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViewsTest); DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViewsTest);
}; };
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "components/exo/test/exo_test_base.h" #include "components/exo/test/exo_test_base.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "components/exo/test/exo_test_helper.h"
#include "components/exo/wm_helper.h" #include "components/exo/wm_helper.h"
#include "components/exo/wm_helper_chromeos.h" #include "components/exo/wm_helper_chromeos.h"
#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
...@@ -21,11 +20,9 @@ namespace test { ...@@ -21,11 +20,9 @@ namespace test {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// ExoTestBase, public: // ExoTestBase, public:
ExoTestBase::ExoTestBase() ExoTestBase::ExoTestBase() = default;
: exo_test_helper_(new ExoTestHelper),
scale_mode_(ui::ScopedAnimationDurationScaleMode::ZERO_DURATION) {}
ExoTestBase::~ExoTestBase() {} ExoTestBase::~ExoTestBase() = default;
void ExoTestBase::SetUp() { void ExoTestBase::SetUp() {
AshTestBase::SetUp(); AshTestBase::SetUp();
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "base/macros.h" #include "base/macros.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h" #include "components/exo/test/exo_test_helper.h"
namespace viz { namespace viz {
class SurfaceManager; class SurfaceManager;
...@@ -26,18 +26,17 @@ class ExoTestBase : public ash::AshTestBase { ...@@ -26,18 +26,17 @@ class ExoTestBase : public ash::AshTestBase {
ExoTestBase(); ExoTestBase();
~ExoTestBase() override; ~ExoTestBase() override;
// Overridden from testing::Test: // ash::AshTestBase:
void SetUp() override; void SetUp() override;
void TearDown() override; void TearDown() override;
viz::SurfaceManager* GetSurfaceManager(); viz::SurfaceManager* GetSurfaceManager();
ExoTestHelper* exo_test_helper() { return exo_test_helper_.get(); } ExoTestHelper* exo_test_helper() { return &exo_test_helper_; }
private: private:
std::unique_ptr<ExoTestHelper> exo_test_helper_; ExoTestHelper exo_test_helper_;
std::unique_ptr<WMHelper> wm_helper_; std::unique_ptr<WMHelper> wm_helper_;
ui::ScopedAnimationDurationScaleMode scale_mode_;
DISALLOW_COPY_AND_ASSIGN(ExoTestBase); DISALLOW_COPY_AND_ASSIGN(ExoTestBase);
}; };
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "ash/session/session_controller_impl.h" #include "ash/session/session_controller_impl.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/test/ash_test_helper.h" #include "ash/test/ash_test_helper.h"
#include "ash/test/ash_test_views_delegate.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/scoped_temp_dir.h" #include "base/files/scoped_temp_dir.h"
......
...@@ -492,18 +492,18 @@ class RenderWidgetHostViewAuraTest : public testing::Test { ...@@ -492,18 +492,18 @@ class RenderWidgetHostViewAuraTest : public testing::Test {
void SetUpEnvironment() { void SetUpEnvironment() {
ImageTransportFactory::SetFactory( ImageTransportFactory::SetFactory(
std::make_unique<TestImageTransportFactory>()); std::make_unique<TestImageTransportFactory>());
aura_test_helper_.reset(new aura::test::AuraTestHelper( aura_test_helper_ = std::make_unique<aura::test::AuraTestHelper>(
ImageTransportFactory::GetInstance()->GetContextFactory())); ImageTransportFactory::GetInstance()->GetContextFactory());
aura_test_helper_->SetUp(); aura_test_helper_->SetUp();
browser_context_.reset(new TestBrowserContext); browser_context_ = std::make_unique<TestBrowserContext>();
process_host_ = new MockRenderProcessHost(browser_context_.get()); process_host_ = new MockRenderProcessHost(browser_context_.get());
process_host_->Init(); process_host_->Init();
sink_ = &process_host_->sink(); sink_ = &process_host_->sink();
int32_t routing_id = process_host_->GetNextRoutingID(); int32_t routing_id = process_host_->GetNextRoutingID();
delegates_.push_back(base::WrapUnique(new MockRenderWidgetHostDelegate)); delegates_.push_back(std::make_unique<MockRenderWidgetHostDelegate>());
parent_host_ = MockRenderWidgetHostImpl::Create(delegates_.back().get(), parent_host_ = MockRenderWidgetHostImpl::Create(delegates_.back().get(),
process_host_, routing_id); process_host_, routing_id);
delegates_.back()->set_widget_host(parent_host_); delegates_.back()->set_widget_host(parent_host_);
...@@ -4833,10 +4833,9 @@ TEST_F(RenderWidgetHostViewAuraTest, VirtualKeyboardFocusEnsureCaretInRect) { ...@@ -4833,10 +4833,9 @@ TEST_F(RenderWidgetHostViewAuraTest, VirtualKeyboardFocusEnsureCaretInRect) {
// TODO (oshima): Test that overscroll occurs. // TODO (oshima): Test that overscroll occurs.
view_->InitAsChild(nullptr); view_->InitAsChild(nullptr);
aura::client::ParentWindowWithContext(
view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
gfx::Rect());
aura::Window* root_window = parent_view_->GetNativeView()->GetRootWindow(); aura::Window* root_window = parent_view_->GetNativeView()->GetRootWindow();
aura::client::ParentWindowWithContext(view_->GetNativeView(), root_window,
gfx::Rect());
const gfx::Rect orig_view_bounds = gfx::Rect(0, 300, 400, 200); const gfx::Rect orig_view_bounds = gfx::Rect(0, 300, 400, 200);
const gfx::Rect shifted_view_bounds = gfx::Rect(0, 200, 400, 200); const gfx::Rect shifted_view_bounds = gfx::Rect(0, 200, 400, 200);
......
...@@ -205,10 +205,10 @@ std::unique_ptr<WebContents> ...@@ -205,10 +205,10 @@ std::unique_ptr<WebContents>
RenderViewHostTestHarness::CreateTestWebContents() { RenderViewHostTestHarness::CreateTestWebContents() {
// Make sure we ran SetUp() already. // Make sure we ran SetUp() already.
#if defined(OS_WIN) #if defined(OS_WIN)
DCHECK(ole_initializer_ != NULL); DCHECK(ole_initializer_);
#endif #endif
#if defined(USE_AURA) #if defined(USE_AURA)
DCHECK(aura_test_helper_ != nullptr); DCHECK(aura_test_helper_);
#endif #endif
scoped_refptr<SiteInstance> instance = scoped_refptr<SiteInstance> instance =
...@@ -232,22 +232,20 @@ void RenderViewHostTestHarness::NavigateAndCommit( ...@@ -232,22 +232,20 @@ void RenderViewHostTestHarness::NavigateAndCommit(
} }
void RenderViewHostTestHarness::SetUp() { void RenderViewHostTestHarness::SetUp() {
rvh_test_enabler_.reset(new RenderViewHostTestEnabler); rvh_test_enabler_ = std::make_unique<RenderViewHostTestEnabler>();
if (factory_) if (factory_)
rvh_test_enabler_->rvh_factory_->set_render_process_host_factory(factory_); rvh_test_enabler_->rvh_factory_->set_render_process_host_factory(factory_);
#if defined(OS_WIN) #if defined(OS_WIN)
ole_initializer_.reset(new ui::ScopedOleInitializer()); ole_initializer_ = std::make_unique<ui::ScopedOleInitializer>();
#endif #endif
#if defined(USE_AURA) #if defined(USE_AURA)
ui::ContextFactory* context_factory = aura_test_helper_ = std::make_unique<aura::test::AuraTestHelper>(
ImageTransportFactory::GetInstance()->GetContextFactory(); ImageTransportFactory::GetInstance()->GetContextFactory());
aura_test_helper_.reset(new aura::test::AuraTestHelper(context_factory));
aura_test_helper_->SetUp(); aura_test_helper_->SetUp();
#endif #endif
sanity_checker_.reset(new ContentBrowserSanityChecker()); sanity_checker_ = std::make_unique<ContentBrowserSanityChecker>();
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
network_change_notifier_ = net::test::MockNetworkChangeNotifier::Create(); network_change_notifier_ = net::test::MockNetworkChangeNotifier::Create();
......
...@@ -108,13 +108,14 @@ ShellPlatformDataAura::ShellPlatformDataAura(const gfx::Size& initial_size) { ...@@ -108,13 +108,14 @@ ShellPlatformDataAura::ShellPlatformDataAura(const gfx::Size& initial_size) {
host_->window()->Show(); host_->window()->Show();
host_->window()->SetLayoutManager(new FillLayout(host_->window())); host_->window()->SetLayoutManager(new FillLayout(host_->window()));
focus_client_.reset(new aura::test::TestFocusClient(host_->window())); focus_client_ =
std::make_unique<aura::test::TestFocusClient>(host_->window());
new wm::DefaultActivationClient(host_->window()); new wm::DefaultActivationClient(host_->window());
capture_client_.reset( capture_client_ =
new aura::client::DefaultCaptureClient(host_->window())); std::make_unique<aura::client::DefaultCaptureClient>(host_->window());
window_parenting_client_.reset( window_parenting_client_ =
new aura::test::TestWindowParentingClient(host_->window())); std::make_unique<aura::test::TestWindowParentingClient>(host_->window());
} }
ShellPlatformDataAura::~ShellPlatformDataAura() { ShellPlatformDataAura::~ShellPlatformDataAura() {
......
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