diff options
author | raymes@google.com <raymes@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-14 02:43:59 +0000 |
---|---|---|
committer | raymes@google.com <raymes@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-14 02:43:59 +0000 |
commit | 984cb9c9dcbf1631b506edad498e174e9cec1385 (patch) | |
tree | dea2d1f6f7a0c3afccb19ee1c054191b5cb7b843 /ash/test | |
parent | 4fe1bec5e5427b73ef05cea950b3fc279dc2896b (diff) | |
download | chromium_src-984cb9c9dcbf1631b506edad498e174e9cec1385.zip chromium_src-984cb9c9dcbf1631b506edad498e174e9cec1385.tar.gz chromium_src-984cb9c9dcbf1631b506edad498e174e9cec1385.tar.bz2 |
Revert 270290 "Reduce creation of ViewsDelegate"
Speculatively reverting as it may have caused the tree to break: http://build.chromium.org/p/chromium.win/builders/Win%20Builder/builds/20345/steps/compile/logs/stdio
> Reduce creation of ViewsDelegate
>
> By consolidating override of OnBeforeWidgetInit that finds shell many
> of the places that were setting a viewsdelegate no longer need to.
>
> Also, made AshTestHelper install a ViewsDelegate so that tests don't have.
>
> Because of removed an include of views_delegate from ash_test_helper I had to update some includes.
>
> BUG=none
> TEST=none
> R=ben@chromium.org
>
> Review URL: https://codereview.chromium.org/280863002
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/286753002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270305 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test')
-rw-r--r-- | ash/test/ash_test_base.cc | 8 | ||||
-rw-r--r-- | ash/test/ash_test_base.h | 13 | ||||
-rw-r--r-- | ash/test/ash_test_helper.cc | 6 | ||||
-rw-r--r-- | ash/test/ash_test_helper.h | 6 | ||||
-rw-r--r-- | ash/test/ash_test_views_delegate.cc | 38 | ||||
-rw-r--r-- | ash/test/ash_test_views_delegate.h | 37 |
6 files changed, 23 insertions, 85 deletions
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index cfd3142..61fa218 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -19,6 +19,7 @@ #include "ash/wm/coordinate_conversion.h" #include "ash/wm/window_positioner.h" #include "base/command_line.h" +#include "content/public/test/web_contents_tester.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/screen_position_client.h" #include "ui/aura/client/window_tree_client.h" @@ -80,6 +81,13 @@ class AshEventGeneratorDelegate : public aura::test::EventGeneratorDelegate { } // namespace +content::WebContents* AshTestViewsDelegate::CreateWebContents( + content::BrowserContext* browser_context, + content::SiteInstance* site_instance) { + return content::WebContentsTester::CreateTestWebContents(browser_context, + site_instance); +} + ///////////////////////////////////////////////////////////////////////////// AshTestBase::AshTestBase() diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h index 6ef1591..4ac828e 100644 --- a/ash/test/ash_test_base.h +++ b/ash/test/ash_test_base.h @@ -13,16 +13,13 @@ #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/views/test/test_views_delegate.h" #include "ui/wm/public/window_types.h" #if defined(OS_WIN) #include "ui/base/win/scoped_ole_initializer.h" #endif -namespace gfx { -class Rect; -} - namespace aura { class RootWindow; class Window; @@ -45,6 +42,14 @@ class TestSystemTrayDelegate; class TestMetroViewerProcessHost; #endif +class AshTestViewsDelegate : public views::TestViewsDelegate { + public: + // Overriden from TestViewsDelegate. + virtual content::WebContents* CreateWebContents( + content::BrowserContext* browser_context, + content::SiteInstance* site_instance) OVERRIDE; +}; + class AshTestBase : public testing::Test { public: AshTestBase(); diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index a59019b..9cf3488 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc @@ -7,7 +7,6 @@ #include "ash/accelerators/accelerator_controller.h" #include "ash/ash_switches.h" #include "ash/shell.h" -#include "ash/test/ash_test_views_delegate.h" #include "ash/test/display_manager_test_api.h" #include "ash/test/shell_test_api.h" #include "ash/test/test_screenshot_delegate.h" @@ -23,6 +22,7 @@ #include "ui/compositor/test/context_factories_for_test.h" #include "ui/message_center/message_center.h" #include "ui/wm/core/capture_controller.h" +#include "ui/wm/core/wm_state.h" #if defined(OS_CHROMEOS) #include "chromeos/audio/cras_audio_handler.h" @@ -56,7 +56,7 @@ AshTestHelper::~AshTestHelper() { } void AshTestHelper::SetUp(bool start_session) { - views_delegate_.reset(new AshTestViewsDelegate); + wm_state_.reset(new wm::WMState); // Disable animations during tests. zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( @@ -133,7 +133,7 @@ void AshTestHelper::TearDown() { CHECK(!wm::ScopedCaptureClient::IsActive()); - views_delegate_.reset(); + wm_state_.reset(); } void AshTestHelper::RunAllPendingInMessageLoop() { diff --git a/ash/test/ash_test_helper.h b/ash/test/ash_test_helper.h index b42cc72..6fb266f 100644 --- a/ash/test/ash_test_helper.h +++ b/ash/test/ash_test_helper.h @@ -20,8 +20,8 @@ namespace ui { class ScopedAnimationDurationScaleMode; } // namespace ui -namespace views { -class ViewsDelegate; +namespace wm { +class WMState; } namespace ash { @@ -77,7 +77,7 @@ class AshTestHelper { // Owned by ash::AcceleratorController TestScreenshotDelegate* test_screenshot_delegate_; - scoped_ptr<views::ViewsDelegate> views_delegate_; + scoped_ptr<wm::WMState> wm_state_; // Check if DBus Thread Manager was initialized here. bool dbus_thread_manager_initialized_; diff --git a/ash/test/ash_test_views_delegate.cc b/ash/test/ash_test_views_delegate.cc deleted file mode 100644 index c47bdba..0000000 --- a/ash/test/ash_test_views_delegate.cc +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/test/ash_test_views_delegate.h" - -#include "ash/shell.h" -#include "content/public/test/web_contents_tester.h" - -namespace ash { -namespace test { - -AshTestViewsDelegate::AshTestViewsDelegate() { -} - -AshTestViewsDelegate::~AshTestViewsDelegate() { -} - -content::WebContents* AshTestViewsDelegate::CreateWebContents( - content::BrowserContext* browser_context, - content::SiteInstance* site_instance) { - return content::WebContentsTester::CreateTestWebContents(browser_context, - site_instance); -} - -void AshTestViewsDelegate::OnBeforeWidgetInit( - views::Widget::InitParams* params, - views::internal::NativeWidgetDelegate* delegate) { - TestViewsDelegate::OnBeforeWidgetInit(params, delegate); - - if (!params->parent && !params->context && ash::Shell::HasInstance()) { - // If the window has neither a parent nor a context add to the root. - params->parent = ash::Shell::GetInstance()->GetPrimaryRootWindow(); - } -} - -} // namespace test -} // namespace ash diff --git a/ash/test/ash_test_views_delegate.h b/ash/test/ash_test_views_delegate.h deleted file mode 100644 index 6fd8bd4..0000000 --- a/ash/test/ash_test_views_delegate.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_TEST_ASH_TEST_VIEWS_DELEGATE_H_ -#define ASH_TEST_ASH_TEST_VIEWS_DELEGATE_H_ - -#include "ui/views/test/test_views_delegate.h" - -namespace ash { -namespace test { - -// Ash specific ViewsDelegate. In addition to creating a TestWebContents this -// parents widget with no parent/context to the shell. This is created by -// default AshTestHelper. -class AshTestViewsDelegate : public views::TestViewsDelegate { - public: - AshTestViewsDelegate(); - virtual ~AshTestViewsDelegate(); - - // Overriden from TestViewsDelegate. - virtual content::WebContents* CreateWebContents( - content::BrowserContext* browser_context, - content::SiteInstance* site_instance) OVERRIDE; - virtual void OnBeforeWidgetInit( - views::Widget::InitParams* params, - views::internal::NativeWidgetDelegate* delegate) OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(AshTestViewsDelegate); -}; - -} // namespace test -} // namespace ash - -#endif // ASH_TEST_ASH_TEST_VIEWS_DELEGATE_H_ - |