Commit b7994506 authored by tapted@chromium.org's avatar tapted@chromium.org

MacViews: Changes to allow app_list_unittests to compile

It needs a better compositor setup for the tests to actually pass, but
it compiles now. Changes were to fix the concept of "parent", which is a
container aura::Window in Ash, and NULL on other platforms. However, the
parent type for Widgets is a NativeView, not a NativeWindow.

Gyp changes are required to resolve undefined symbols
"ui::{Terminate,Initialize}ContextFactoryForTests()". This is called
from ViewsTestBase in views_test_support, but views_test_support is
missing the dependency on compositor_test_support where these are
defined. On other platforms, this leaks in via aura stuff.

BUG=365977, 399191
TBR=sky@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287291 0039d316-1c4b-4281-b951-d872f2087c98
parent 7e77dc6c
......@@ -73,7 +73,10 @@ class AppListMainViewTest : public views::ViewsTestBase {
views::ViewsTestBase::SetUp();
delegate_.reset(new AppListTestViewDelegate);
main_view_ = new AppListMainView(delegate_.get(), 0, GetContext());
// In Ash, the third argument is a container aura::Window, but it is always
// NULL on Windows, and not needed for tests. It is only used to determine
// the scale factor for preloading icons.
main_view_ = new AppListMainView(delegate_.get(), 0, NULL);
main_view_->SetPaintToLayer(true);
main_view_->model()->SetFoldersEnabled(true);
......
......@@ -25,8 +25,6 @@
#include "ui/app_list/views/start_page_view.h"
#include "ui/app_list/views/test/apps_grid_view_test_api.h"
#include "ui/app_list/views/tile_item_view.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/window.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/views_delegate.h"
......@@ -67,7 +65,7 @@ const int kInitialItems = 34;
// root window or a desktop window tree host.
class AppListViewTestContext {
public:
AppListViewTestContext(int test_type, aura::Window* parent);
AppListViewTestContext(int test_type, gfx::NativeView parent);
~AppListViewTestContext();
// Test displaying the app list and performs a standard set of checks on its
......@@ -150,7 +148,7 @@ class UnitTestViewDelegate : public app_list::test::AppListTestViewDelegate {
};
AppListViewTestContext::AppListViewTestContext(int test_type,
aura::Window* parent)
gfx::NativeView parent)
: test_type_(static_cast<TestType>(test_type)) {
switch (test_type_) {
case NORMAL:
......@@ -530,7 +528,17 @@ class AppListViewTestAura : public views::ViewsTestBase,
// testing::Test overrides:
virtual void SetUp() OVERRIDE {
views::ViewsTestBase::SetUp();
test_context_.reset(new AppListViewTestContext(GetParam(), GetContext()));
// On Ash (only) the app list is placed into an aura::Window "container",
// which is also used to determine the context. In tests, use the ash root
// window as the parent. This only works on aura where the root window is a
// NativeView as well as a NativeWindow.
gfx::NativeView container = NULL;
#if defined(USE_AURA)
container = GetContext();
#endif
test_context_.reset(new AppListViewTestContext(GetParam(), container));
}
virtual void TearDown() OVERRIDE {
......
......@@ -115,6 +115,7 @@ static_library("test_support") {
"//ui/aura",
"//ui/base",
"//ui/compositor",
"//ui/compositor:test_support",
"//ui/events",
"//ui/events/platform",
"//ui/gfx",
......@@ -154,7 +155,6 @@ test("views_unittests") {
"//ui/base",
"//ui/base:test_support",
"//ui/compositor",
"//ui/compositor:test_support",
"//ui/events",
"//ui/events:events_base",
"//ui/events/platform",
......
......@@ -695,6 +695,7 @@
'../../testing/gtest.gyp:gtest',
'../base/ui_base.gyp:ui_base',
'../compositor/compositor.gyp:compositor',
'../compositor/compositor.gyp:compositor_test_support',
'../events/events.gyp:events',
'../events/platform/events_platform.gyp:events_platform',
'../gfx/gfx.gyp:gfx',
......@@ -741,7 +742,6 @@
'../base/ui_base.gyp:ui_base',
'../base/ui_base.gyp:ui_base_test_support',
'../compositor/compositor.gyp:compositor',
'../compositor/compositor.gyp:compositor_test_support',
'../events/events.gyp:events',
'../events/events.gyp:events_base',
'../events/events.gyp:events_test_support',
......
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