Skip to content

Commit

Permalink
Revert 259580 "Move wm/public into wm target"
Browse files Browse the repository at this point in the history
> Move wm/public into wm target
> 
> TBR=sky@chromium.org
> http://crbug/com/308710
> 
> Review URL: https://codereview.chromium.org/209383003

TBR=ben@chromium.org

Review URL: https://codereview.chromium.org/213033002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259589 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
ben@chromium.org committed Mar 26, 2014
1 parent 14be8a2 commit 4cc33f4
Show file tree
Hide file tree
Showing 81 changed files with 401 additions and 342 deletions.
4 changes: 2 additions & 2 deletions ash/ash.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
'../ui/views/controls/webview/webview.gyp:webview',
'../ui/views/views.gyp:views',
'../ui/web_dialogs/web_dialogs.gyp:web_dialogs',
'../ui/wm/wm.gyp:wm',
'../ui/wm/wm.gyp:wm_core',
'../url/url.gyp:url_lib',
'ash_strings.gyp:ash_strings',
'ash_resources',
Expand Down Expand Up @@ -852,7 +852,7 @@
'../ui/views/views.gyp:views',
'../ui/views/views.gyp:views_test_support',
'../ui/web_dialogs/web_dialogs.gyp:web_dialogs_test_support',
'../ui/wm/wm.gyp:wm',
'../ui/wm/wm.gyp:wm_core',
'../url/url.gyp:url_lib',
'ash_strings.gyp:ash_strings',
'ash',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#endif

#if defined(USE_AURA)
#include "ui/aura/test/aura_test_helper.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/compositor/test/context_factories_for_test.h"
#include "ui/wm/test/wm_test_helper.h"
#endif

using base::ASCIIToUTF16;
Expand Down Expand Up @@ -111,16 +111,16 @@ class AccessibilityEventRouterViewsTest
bool enable_pixel_output = false;
ui::InitializeContextFactoryForTests(enable_pixel_output);

wm_test_helper_.reset(new wm::WMTestHelper);
wm_test_helper_->SetUp();
aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
aura_test_helper_->SetUp();
#endif // USE_AURA
EnableAccessibilityAndListenToFocusNotifications();
}

virtual void TearDown() {
ClearCallback();
#if defined(USE_AURA)
wm_test_helper_->TearDown();
aura_test_helper_->TearDown();
ui::TerminateContextFactoryForTests();
#endif
delete views::ViewsDelegate::views_delegate;
Expand All @@ -139,7 +139,7 @@ class AccessibilityEventRouterViewsTest
views::Widget* CreateWindowWithContents(views::View* contents) {
gfx::NativeView context = NULL;
#if defined(USE_AURA)
context = wm_test_helper_->root_window();
context = aura_test_helper_->root_window();
#endif
views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
new AccessibilityWindowDelegate(contents),
Expand Down Expand Up @@ -188,7 +188,7 @@ class AccessibilityEventRouterViewsTest
scoped_ptr<ui::ScopedOleInitializer> ole_initializer_;
#endif
#if defined(USE_AURA)
scoped_ptr<wm::WMTestHelper> wm_test_helper_;
scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_;
#endif
};

Expand Down
25 changes: 12 additions & 13 deletions chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
#include "chrome/browser/ui/views/apps/shaped_app_window_targeter.h"

#include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/events/event_processor.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/views/controls/webview/webview.h"
#include "ui/views/test/views_test_base.h"
#include "ui/wm/core/easy_resize_window_targeter.h"

class ShapedAppWindowTargeterTest : public views::ViewsTestBase {
class ShapedAppWindowTargeterTest : public aura::test::AuraTestBase {
public:
ShapedAppWindowTargeterTest()
: web_view_(NULL) {
Expand All @@ -27,12 +26,12 @@ class ShapedAppWindowTargeterTest : public views::ViewsTestBase {

protected:
virtual void SetUp() OVERRIDE {
views::ViewsTestBase::SetUp();
aura::test::AuraTestBase::SetUp();
widget_.reset(new views::Widget);
views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
params.remove_standard_frame = true;
params.bounds = gfx::Rect(30, 30, 100, 100);
params.context = host()->window();
params.context = root_window();
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
widget_->Init(params);

Expand All @@ -44,7 +43,7 @@ class ShapedAppWindowTargeterTest : public views::ViewsTestBase {

virtual void TearDown() OVERRIDE {
widget_.reset();
views::ViewsTestBase::TearDown();
aura::test::AuraTestBase::TearDown();
}

private:
Expand Down Expand Up @@ -82,7 +81,7 @@ TEST_F(ShapedAppWindowTargeterTest, HitTestBasic) {
ui::EventDispatchDetails details =
event_processor()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(host()->window(), move.target());
EXPECT_EQ(root_window(), move.target());

// But events within the shape will still reach the window.
ui::MouseEvent move2(ui::ET_MOUSE_MOVED,
Expand All @@ -99,8 +98,8 @@ TEST_F(ShapedAppWindowTargeterTest, HitTestOnlyForShapedWindow) {
// receive events outside of its bounds. Verify that this window-targeter is
// active unless the window has a custom shape.
gfx::Insets inset(-30, -30, -30, -30);
host()->window()->SetEventTargeter(scoped_ptr<ui::EventTargeter>(
new wm::EasyResizeWindowTargeter(host()->window(), inset, inset)));
root_window()->SetEventTargeter(scoped_ptr<ui::EventTargeter>(
new wm::EasyResizeWindowTargeter(root_window(), inset, inset)));

aura::Window* window = widget()->GetNativeWindow();
{
Expand Down Expand Up @@ -140,7 +139,7 @@ TEST_F(ShapedAppWindowTargeterTest, HitTestOnlyForShapedWindow) {
ui::EventDispatchDetails details =
event_processor()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(host()->window(), move.target());
EXPECT_EQ(root_window(), move.target());
}

// Remove the custom shape. This should restore the behaviour of targeting the
Expand Down Expand Up @@ -202,13 +201,13 @@ TEST_F(ShapedAppWindowTargeterTest, ResizeInsetsWithinBounds) {
{
// With an EasyResizeTargeter on the container, an event
// inside the window and within 5px of an edge should have
// host()->window() as its target.
// root_window() as its target.
ui::MouseEvent move(ui::ET_MOUSE_MOVED,
gfx::Point(32, 37), gfx::Point(32, 37),
ui::EF_NONE, ui::EF_NONE);
ui::EventDispatchDetails details =
event_processor()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(host()->window(), move.target());
EXPECT_EQ(root_window(), move.target());
}
}
2 changes: 1 addition & 1 deletion chrome/chrome_browser_ui.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -2821,7 +2821,7 @@
}],
['toolkit_views == 1', {
'dependencies': [
'../ui/wm/wm.gyp:wm',
'../ui/wm/wm.gyp:wm_core',
],
'sources!': [
'browser/ui/profile_reset_bubble_stub.cc',
Expand Down
2 changes: 1 addition & 1 deletion chrome/chrome_tests_unit.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,7 @@
['use_aura==1 or toolkit_views==1', {
'dependencies': [
'../ui/events/events.gyp:events_test_support',
'../ui/wm/wm.gyp:wm',
'../ui/wm/wm.gyp:wm_core',
],
}],
['use_aura==1 and component=="shared_library"', {
Expand Down
11 changes: 6 additions & 5 deletions chrome/test/base/browser_with_test_window_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include "content/public/test/test_renderer_host.h"

#if defined(USE_AURA)
#include "ui/aura/test/aura_test_helper.h"
#include "ui/compositor/test/context_factories_for_test.h"
#include "ui/wm/test/wm_test_helper.h"
#endif

#if defined(USE_ASH)
Expand Down Expand Up @@ -57,7 +57,7 @@ void BrowserWithTestWindowTest::SetUp() {
testing::Test::SetUp();
#if defined(OS_CHROMEOS)
// TODO(jamescook): Windows Ash support. This will require refactoring
// AshTestHelper and WMTestHelper so they can be used at the same time,
// AshTestHelper and AuraTestHelper so they can be used at the same time,
// perhaps by AshTestHelper owning an AuraTestHelper.
ash_test_helper_.reset(new ash::test::AshTestHelper(
base::MessageLoopForUI::current()));
Expand All @@ -67,8 +67,9 @@ void BrowserWithTestWindowTest::SetUp() {
bool enable_pixel_output = false;
ui::InitializeContextFactoryForTests(enable_pixel_output);

wm_test_helper_.reset(new wm::WMTestHelper);
wm_test_helper_->SetUp();
aura_test_helper_.reset(new aura::test::AuraTestHelper(
base::MessageLoopForUI::current()));
aura_test_helper_->SetUp();
#endif // USE_AURA
#if defined(TOOLKIT_VIEWS)
views_delegate_.reset(CreateViewsDelegate());
Expand Down Expand Up @@ -98,7 +99,7 @@ void BrowserWithTestWindowTest::TearDown() {
#if defined(OS_CHROMEOS)
ash_test_helper_->TearDown();
#elif defined(USE_AURA)
wm_test_helper_->TearDown();
aura_test_helper_->TearDown();
ui::TerminateContextFactoryForTests();
#endif
testing::Test::TearDown();
Expand Down
8 changes: 5 additions & 3 deletions chrome/test/base/browser_with_test_window_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ class AshTestHelper;
#endif

#if defined(USE_AURA)
namespace wm {
class WMTestHelper;
namespace aura {
namespace test {
class AuraTestHelper;
}
}
#endif

Expand Down Expand Up @@ -187,7 +189,7 @@ class BrowserWithTestWindowTest : public testing::Test {
scoped_ptr<ash::test::AshTestHelper> ash_test_helper_;
#endif
#if defined(USE_AURA)
scoped_ptr<wm::WMTestHelper> wm_test_helper_;
scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_;
#endif

#if defined(TOOLKIT_VIEWS)
Expand Down
13 changes: 7 additions & 6 deletions chrome/test/base/view_event_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#if defined(USE_AURA)
#include "ui/aura/client/event_client.h"
#include "ui/aura/env.h"
#include "ui/aura/test/aura_test_helper.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tree_host.h"
#include "ui/compositor/test/context_factories_for_test.h"
#include "ui/wm/core/wm_state.h"
#include "ui/wm/test/wm_test_helper.h"
#endif

#if defined(OS_CHROMEOS)
Expand Down Expand Up @@ -141,11 +141,12 @@ void ViewEventTestBase::SetUp() {
#endif // !OS_WIN
aura::Env::CreateInstance();
#elif defined(USE_AURA)
// Instead of using the ash shell, use an WMTestHelper to create and manage
// Instead of using the ash shell, use an AuraTestHelper to create and manage
// the test screen.
wm_test_helper_.reset(new wm::WMTestHelper);
wm_test_helper_->SetUp();
context = wm_test_helper_->root_window();
aura_test_helper_.reset(
new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
aura_test_helper_->SetUp();
context = aura_test_helper_->root_window();
#endif // !USE_ASH && USE_AURA

window_ = views::Widget::CreateWindowWithContext(this, context);
Expand Down Expand Up @@ -174,7 +175,7 @@ void ViewEventTestBase::TearDown() {
#endif // !OS_WIN
aura::Env::DeleteInstance();
#elif defined(USE_AURA)
wm_test_helper_->TearDown();
aura_test_helper_->TearDown();
#endif // !USE_ASH && USE_AURA

#if defined(USE_AURA)
Expand Down
9 changes: 7 additions & 2 deletions chrome/test/base/view_event_test_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@
#include "ui/base/win/scoped_ole_initializer.h"
#endif

namespace aura {
namespace test {
class AuraTestHelper;
}
}

namespace gfx {
class Size;
}

namespace wm {
class WMState;
class WMTestHelper;
}

// Base class for Views based tests that dispatch events.
Expand Down Expand Up @@ -150,7 +155,7 @@ class ViewEventTestBase : public views::WidgetDelegate,
#endif

#if defined(USE_AURA)
scoped_ptr<wm::WMTestHelper> wm_test_helper_;
scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_;
scoped_ptr<wm::WMState> wm_state_;
#endif

Expand Down
1 change: 0 additions & 1 deletion content/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ include_rules = [
"+ui/snapshot",
"+ui/surface",
"+ui/wm/public",
"+ui/wm/test",
# Content knows about grd files, but the specifics of how to get a resource
# given its id is left to the embedder.
"-ui/base/l10n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/test/aura_test_helper.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window.h"
#include "ui/compositor/test/context_factories_for_test.h"
#include "ui/wm/test/wm_test_helper.h"

using ::testing::_;
using ::testing::AnyNumber;
Expand Down Expand Up @@ -63,7 +63,7 @@ class DesktopCaptureDeviceAuraTest : public testing::Test {
// The ContextFactory must exist before any Compositors are created.
bool enable_pixel_output = false;
ui::InitializeContextFactoryForTests(enable_pixel_output);
helper_.reset(new wm::WMTestHelper);
helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
helper_->SetUp();

// We need a window to cover desktop area so that DesktopCaptureDeviceAura
Expand Down Expand Up @@ -93,7 +93,7 @@ class DesktopCaptureDeviceAuraTest : public testing::Test {
private:
base::MessageLoopForUI message_loop_;
BrowserThreadImpl browser_thread_for_ui_;
scoped_ptr<wm::WMTestHelper> helper_;
scoped_ptr<aura::test::AuraTestHelper> helper_;
scoped_ptr<aura::Window> desktop_window_;
scoped_ptr<aura::test::TestWindowDelegate> window_delegate_;

Expand Down
Loading

0 comments on commit 4cc33f4

Please sign in to comment.