OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "ui/app_list/views/test/apps_grid_view_test_api.h" | 26 #include "ui/app_list/views/test/apps_grid_view_test_api.h" |
27 #include "ui/app_list/views/tile_item_view.h" | 27 #include "ui/app_list/views/tile_item_view.h" |
28 #include "ui/views/controls/textfield/textfield.h" | 28 #include "ui/views/controls/textfield/textfield.h" |
29 #include "ui/views/test/views_test_base.h" | 29 #include "ui/views/test/views_test_base.h" |
30 #include "ui/views/views_delegate.h" | 30 #include "ui/views/views_delegate.h" |
31 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 31 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
32 | 32 |
33 namespace app_list { | 33 namespace app_list { |
34 namespace test { | 34 namespace test { |
35 | 35 |
36 namespace { | |
37 | |
38 enum TestType { | 36 enum TestType { |
39 TEST_TYPE_START = 0, | 37 TEST_TYPE_START = 0, |
40 NORMAL = TEST_TYPE_START, | 38 NORMAL = TEST_TYPE_START, |
41 LANDSCAPE, | 39 LANDSCAPE, |
42 EXPERIMENTAL, | 40 EXPERIMENTAL, |
43 TEST_TYPE_END, | 41 TEST_TYPE_END, |
44 }; | 42 }; |
45 | 43 |
46 bool IsViewAtOrigin(views::View* view) { | |
47 return view->bounds().origin().IsOrigin(); | |
48 } | |
49 | |
50 size_t GetVisibleTileItemViews(const std::vector<TileItemView*>& tiles) { | |
51 size_t count = 0; | |
52 for (std::vector<TileItemView*>::const_iterator it = tiles.begin(); | |
53 it != tiles.end(); | |
54 ++it) { | |
55 if ((*it)->visible()) | |
56 count++; | |
57 } | |
58 return count; | |
59 } | |
60 | |
61 // Choose a set that is 3 regular app list pages and 2 landscape app list pages. | |
62 const int kInitialItems = 34; | |
63 | |
64 // Allows the same tests to run with different contexts: either an Ash-style | 44 // Allows the same tests to run with different contexts: either an Ash-style |
65 // root window or a desktop window tree host. | 45 // root window or a desktop window tree host. |
66 class AppListViewTestContext { | 46 class AppListViewTestContext { |
67 public: | 47 public: |
68 AppListViewTestContext(int test_type, gfx::NativeView parent); | 48 AppListViewTestContext(int test_type, gfx::NativeView parent); |
69 ~AppListViewTestContext(); | 49 ~AppListViewTestContext(); |
70 | 50 |
71 // Test displaying the app list and performs a standard set of checks on its | 51 // Test displaying the app list and performs a standard set of checks on its |
72 // top level views. Then closes the window. | 52 // top level views. Then closes the window. |
73 void RunDisplayTest(); | 53 void RunDisplayTest(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 PaginationModel* GetPaginationModel(); | 99 PaginationModel* GetPaginationModel(); |
120 | 100 |
121 const TestType test_type_; | 101 const TestType test_type_; |
122 scoped_ptr<base::RunLoop> run_loop_; | 102 scoped_ptr<base::RunLoop> run_loop_; |
123 app_list::AppListView* view_; // Owned by native widget. | 103 app_list::AppListView* view_; // Owned by native widget. |
124 app_list::test::AppListTestViewDelegate* delegate_; // Owned by |view_|; | 104 app_list::test::AppListTestViewDelegate* delegate_; // Owned by |view_|; |
125 | 105 |
126 DISALLOW_COPY_AND_ASSIGN(AppListViewTestContext); | 106 DISALLOW_COPY_AND_ASSIGN(AppListViewTestContext); |
127 }; | 107 }; |
128 | 108 |
| 109 namespace { |
| 110 |
| 111 bool IsViewAtOrigin(views::View* view) { |
| 112 return view->bounds().origin().IsOrigin(); |
| 113 } |
| 114 |
| 115 size_t GetVisibleTileItemViews(const std::vector<TileItemView*>& tiles) { |
| 116 size_t count = 0; |
| 117 for (std::vector<TileItemView*>::const_iterator it = tiles.begin(); |
| 118 it != tiles.end(); |
| 119 ++it) { |
| 120 if ((*it)->visible()) |
| 121 count++; |
| 122 } |
| 123 return count; |
| 124 } |
| 125 |
| 126 // Choose a set that is 3 regular app list pages and 2 landscape app list pages. |
| 127 const int kInitialItems = 34; |
| 128 |
| 129 class TestTileSearchResult : public SearchResult { |
| 130 public: |
| 131 TestTileSearchResult() { set_display_type(DISPLAY_TILE); } |
| 132 virtual ~TestTileSearchResult() {} |
| 133 |
| 134 private: |
| 135 DISALLOW_COPY_AND_ASSIGN(TestTileSearchResult); |
| 136 }; |
| 137 |
129 // Extend the regular AppListTestViewDelegate to communicate back to the test | 138 // Extend the regular AppListTestViewDelegate to communicate back to the test |
130 // context. Note the test context doesn't simply inherit this, because the | 139 // context. Note the test context doesn't simply inherit this, because the |
131 // delegate is owned by the view. | 140 // delegate is owned by the view. |
132 class UnitTestViewDelegate : public app_list::test::AppListTestViewDelegate { | 141 class UnitTestViewDelegate : public app_list::test::AppListTestViewDelegate { |
133 public: | 142 public: |
134 UnitTestViewDelegate(AppListViewTestContext* parent) : parent_(parent) {} | 143 UnitTestViewDelegate(AppListViewTestContext* parent) : parent_(parent) {} |
135 | 144 |
136 // Overridden from app_list::AppListViewDelegate: | 145 // Overridden from app_list::AppListViewDelegate: |
137 virtual bool ShouldCenterWindow() const OVERRIDE { | 146 virtual bool ShouldCenterWindow() const OVERRIDE { |
138 return app_list::switches::IsCenteredAppListEnabled(); | 147 return app_list::switches::IsCenteredAppListEnabled(); |
139 } | 148 } |
140 | 149 |
141 // Overridden from app_list::test::AppListTestViewDelegate: | 150 // Overridden from app_list::test::AppListTestViewDelegate: |
142 virtual void ViewClosing() OVERRIDE { parent_->NativeWidgetClosing(); } | 151 virtual void ViewClosing() OVERRIDE { parent_->NativeWidgetClosing(); } |
143 | 152 |
144 private: | 153 private: |
145 AppListViewTestContext* parent_; | 154 AppListViewTestContext* parent_; |
146 | 155 |
147 DISALLOW_COPY_AND_ASSIGN(UnitTestViewDelegate); | 156 DISALLOW_COPY_AND_ASSIGN(UnitTestViewDelegate); |
148 }; | 157 }; |
149 | 158 |
| 159 class AppListViewTestAura : public views::ViewsTestBase, |
| 160 public ::testing::WithParamInterface<int> { |
| 161 public: |
| 162 AppListViewTestAura() {} |
| 163 virtual ~AppListViewTestAura() {} |
| 164 |
| 165 // testing::Test overrides: |
| 166 virtual void SetUp() OVERRIDE { |
| 167 views::ViewsTestBase::SetUp(); |
| 168 |
| 169 // On Ash (only) the app list is placed into an aura::Window "container", |
| 170 // which is also used to determine the context. In tests, use the ash root |
| 171 // window as the parent. This only works on aura where the root window is a |
| 172 // NativeView as well as a NativeWindow. |
| 173 gfx::NativeView container = NULL; |
| 174 #if defined(USE_AURA) |
| 175 container = GetContext(); |
| 176 #endif |
| 177 |
| 178 test_context_.reset(new AppListViewTestContext(GetParam(), container)); |
| 179 } |
| 180 |
| 181 virtual void TearDown() OVERRIDE { |
| 182 test_context_.reset(); |
| 183 views::ViewsTestBase::TearDown(); |
| 184 } |
| 185 |
| 186 protected: |
| 187 scoped_ptr<AppListViewTestContext> test_context_; |
| 188 |
| 189 private: |
| 190 DISALLOW_COPY_AND_ASSIGN(AppListViewTestAura); |
| 191 }; |
| 192 |
| 193 class AppListViewTestDesktop : public views::ViewsTestBase, |
| 194 public ::testing::WithParamInterface<int> { |
| 195 public: |
| 196 AppListViewTestDesktop() {} |
| 197 virtual ~AppListViewTestDesktop() {} |
| 198 |
| 199 // testing::Test overrides: |
| 200 virtual void SetUp() OVERRIDE { |
| 201 set_views_delegate(new AppListViewTestViewsDelegate(this)); |
| 202 views::ViewsTestBase::SetUp(); |
| 203 test_context_.reset(new AppListViewTestContext(GetParam(), NULL)); |
| 204 } |
| 205 |
| 206 virtual void TearDown() OVERRIDE { |
| 207 test_context_.reset(); |
| 208 views::ViewsTestBase::TearDown(); |
| 209 } |
| 210 |
| 211 protected: |
| 212 scoped_ptr<AppListViewTestContext> test_context_; |
| 213 |
| 214 private: |
| 215 class AppListViewTestViewsDelegate : public views::TestViewsDelegate { |
| 216 public: |
| 217 AppListViewTestViewsDelegate(AppListViewTestDesktop* parent) |
| 218 : parent_(parent) {} |
| 219 |
| 220 // Overridden from views::ViewsDelegate: |
| 221 virtual void OnBeforeWidgetInit( |
| 222 views::Widget::InitParams* params, |
| 223 views::internal::NativeWidgetDelegate* delegate) OVERRIDE; |
| 224 |
| 225 private: |
| 226 AppListViewTestDesktop* parent_; |
| 227 |
| 228 DISALLOW_COPY_AND_ASSIGN(AppListViewTestViewsDelegate); |
| 229 }; |
| 230 |
| 231 DISALLOW_COPY_AND_ASSIGN(AppListViewTestDesktop); |
| 232 }; |
| 233 |
| 234 void AppListViewTestDesktop::AppListViewTestViewsDelegate::OnBeforeWidgetInit( |
| 235 views::Widget::InitParams* params, |
| 236 views::internal::NativeWidgetDelegate* delegate) { |
| 237 // Mimic the logic in ChromeViewsDelegate::OnBeforeWidgetInit(). Except, for |
| 238 // ChromeOS, use the root window from the AuraTestHelper rather than depending |
| 239 // on ash::Shell:GetPrimaryRootWindow(). Also assume non-ChromeOS is never the |
| 240 // Ash desktop, as that is covered by AppListViewTestAura. |
| 241 #if defined(OS_CHROMEOS) |
| 242 if (!params->parent && !params->context) |
| 243 params->context = parent_->GetContext(); |
| 244 #elif defined(USE_AURA) |
| 245 if (params->parent == NULL && params->context == NULL && !params->child) |
| 246 params->native_widget = new views::DesktopNativeWidgetAura(delegate); |
| 247 #endif |
| 248 } |
| 249 |
| 250 } // namespace |
| 251 |
150 AppListViewTestContext::AppListViewTestContext(int test_type, | 252 AppListViewTestContext::AppListViewTestContext(int test_type, |
151 gfx::NativeView parent) | 253 gfx::NativeView parent) |
152 : test_type_(static_cast<TestType>(test_type)) { | 254 : test_type_(static_cast<TestType>(test_type)) { |
153 switch (test_type_) { | 255 switch (test_type_) { |
154 case NORMAL: | 256 case NORMAL: |
155 break; | 257 break; |
156 case LANDSCAPE: | 258 case LANDSCAPE: |
157 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 259 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
158 switches::kEnableCenteredAppList); | 260 switches::kEnableCenteredAppList); |
159 break; | 261 break; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 EXPECT_NO_FATAL_FAILURE(CheckView(main_view)); | 408 EXPECT_NO_FATAL_FAILURE(CheckView(main_view)); |
307 EXPECT_NO_FATAL_FAILURE(CheckView(main_view->contents_view())); | 409 EXPECT_NO_FATAL_FAILURE(CheckView(main_view->contents_view())); |
308 if (test_type_ == EXPERIMENTAL) { | 410 if (test_type_ == EXPERIMENTAL) { |
309 EXPECT_NO_FATAL_FAILURE(CheckView(start_page_view)); | 411 EXPECT_NO_FATAL_FAILURE(CheckView(start_page_view)); |
310 | 412 |
311 // Show the start page view. | 413 // Show the start page view. |
312 ContentsView* contents_view = main_view->contents_view(); | 414 ContentsView* contents_view = main_view->contents_view(); |
313 ShowContentsViewPageAndVerify(contents_view->GetPageIndexForNamedPage( | 415 ShowContentsViewPageAndVerify(contents_view->GetPageIndexForNamedPage( |
314 ContentsView::NAMED_PAGE_START)); | 416 ContentsView::NAMED_PAGE_START)); |
315 EXPECT_FALSE(main_view->search_box_view()->visible()); | 417 EXPECT_FALSE(main_view->search_box_view()->visible()); |
316 EXPECT_EQ(3u, GetVisibleTileItemViews(start_page_view->tile_views())); | |
317 | 418 |
318 gfx::Size view_size(view_->GetPreferredSize()); | 419 gfx::Size view_size(view_->GetPreferredSize()); |
319 ShowContentsViewPageAndVerify( | 420 ShowContentsViewPageAndVerify( |
320 contents_view->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS)); | 421 contents_view->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS)); |
321 EXPECT_TRUE(main_view->search_box_view()->visible()); | 422 EXPECT_TRUE(main_view->search_box_view()->visible()); |
322 | 423 |
323 // Hiding and showing the search box should not affect the app list's | 424 // Hiding and showing the search box should not affect the app list's |
324 // preferred size. This is a regression test for http://crbug.com/386912. | 425 // preferred size. This is a regression test for http://crbug.com/386912. |
325 EXPECT_EQ(view_size.ToString(), view_->GetPreferredSize().ToString()); | 426 EXPECT_EQ(view_size.ToString(), view_->GetPreferredSize().ToString()); |
326 | 427 |
327 // Check tiles hide and show on deletion and addition. | 428 // Check tiles hide and show on deletion and addition. |
328 model->CreateAndAddItem("Test app"); | 429 model->results()->Add(new TestTileSearchResult()); |
329 EXPECT_EQ(4u, GetVisibleTileItemViews(start_page_view->tile_views())); | 430 start_page_view->Update(); |
330 model->DeleteItem(model->GetItemName(0)); | 431 EXPECT_EQ(1u, GetVisibleTileItemViews(start_page_view->tile_views())); |
331 EXPECT_EQ(3u, GetVisibleTileItemViews(start_page_view->tile_views())); | 432 model->results()->RemoveAll(); |
| 433 start_page_view->Update(); |
| 434 EXPECT_EQ(0u, GetVisibleTileItemViews(start_page_view->tile_views())); |
332 } else { | 435 } else { |
333 EXPECT_EQ(NULL, start_page_view); | 436 EXPECT_EQ(NULL, start_page_view); |
334 } | 437 } |
335 | 438 |
336 Close(); | 439 Close(); |
337 } | 440 } |
338 | 441 |
339 void AppListViewTestContext::RunPageSwitchingAnimationTest() { | 442 void AppListViewTestContext::RunPageSwitchingAnimationTest() { |
340 if (test_type_ == EXPERIMENTAL) { | 443 if (test_type_ == EXPERIMENTAL) { |
341 Show(); | 444 Show(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 506 |
404 StartPageView* start_page_view = | 507 StartPageView* start_page_view = |
405 view_->app_list_main_view()->contents_view()->start_page_view(); | 508 view_->app_list_main_view()->contents_view()->start_page_view(); |
406 ContentsSwitcherView* contents_switcher_view = | 509 ContentsSwitcherView* contents_switcher_view = |
407 view_->app_list_main_view()->contents_switcher_view(); | 510 view_->app_list_main_view()->contents_switcher_view(); |
408 if (test_type_ == EXPERIMENTAL) { | 511 if (test_type_ == EXPERIMENTAL) { |
409 EXPECT_NO_FATAL_FAILURE(CheckView(contents_switcher_view)); | 512 EXPECT_NO_FATAL_FAILURE(CheckView(contents_switcher_view)); |
410 EXPECT_EQ(view_->app_list_main_view()->contents_view(), | 513 EXPECT_EQ(view_->app_list_main_view()->contents_view(), |
411 contents_switcher_view->contents_view()); | 514 contents_switcher_view->contents_view()); |
412 EXPECT_NO_FATAL_FAILURE(CheckView(start_page_view)); | 515 EXPECT_NO_FATAL_FAILURE(CheckView(start_page_view)); |
413 EXPECT_EQ(1u, GetVisibleTileItemViews(start_page_view->tile_views())); | |
414 } else { | 516 } else { |
415 EXPECT_EQ(NULL, contents_switcher_view); | 517 EXPECT_EQ(NULL, contents_switcher_view); |
416 EXPECT_EQ(NULL, start_page_view); | 518 EXPECT_EQ(NULL, start_page_view); |
417 } | 519 } |
418 | 520 |
419 // New model updates should be processed by the start page view. | 521 // New model updates should be processed by the start page view. |
420 delegate_->GetTestModel()->CreateAndAddItem("Test App"); | 522 delegate_->GetTestModel()->results()->Add(new TestTileSearchResult()); |
421 if (test_type_ == EXPERIMENTAL) | 523 if (test_type_ == EXPERIMENTAL) { |
422 EXPECT_EQ(2u, GetVisibleTileItemViews(start_page_view->tile_views())); | 524 start_page_view->Update(); |
| 525 EXPECT_EQ(1u, GetVisibleTileItemViews(start_page_view->tile_views())); |
| 526 } |
423 | 527 |
424 // Old model updates should be ignored. | 528 // Old model updates should be ignored. |
425 original_test_model->CreateAndAddItem("Test App 2"); | 529 original_test_model->results()->Add(new TestTileSearchResult()); |
426 if (test_type_ == EXPERIMENTAL) | 530 original_test_model->results()->Add(new TestTileSearchResult()); |
427 EXPECT_EQ(2u, GetVisibleTileItemViews(start_page_view->tile_views())); | 531 if (test_type_ == EXPERIMENTAL) { |
| 532 start_page_view->Update(); |
| 533 EXPECT_EQ(1u, GetVisibleTileItemViews(start_page_view->tile_views())); |
| 534 } |
428 | 535 |
429 Close(); | 536 Close(); |
430 } | 537 } |
431 | 538 |
432 void AppListViewTestContext::RunSearchResultsTest() { | 539 void AppListViewTestContext::RunSearchResultsTest() { |
433 EXPECT_FALSE(view_->GetWidget()->IsVisible()); | 540 EXPECT_FALSE(view_->GetWidget()->IsVisible()); |
434 EXPECT_EQ(-1, GetPaginationModel()->total_pages()); | 541 EXPECT_EQ(-1, GetPaginationModel()->total_pages()); |
435 AppListTestModel* model = delegate_->GetTestModel(); | 542 AppListTestModel* model = delegate_->GetTestModel(); |
436 model->PopulateApps(3); | 543 model->PopulateApps(3); |
437 | 544 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 contents_view->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS)); | 619 contents_view->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS)); |
513 ShowContentsViewPageAndVerify(contents_view->GetPageIndexForNamedPage( | 620 ShowContentsViewPageAndVerify(contents_view->GetPageIndexForNamedPage( |
514 ContentsView::NAMED_PAGE_START)); | 621 ContentsView::NAMED_PAGE_START)); |
515 EXPECT_TRUE(dummy_search_box->IsDrawn()); | 622 EXPECT_TRUE(dummy_search_box->IsDrawn()); |
516 EXPECT_TRUE(dummy_search_box->search_box()->text().empty()); | 623 EXPECT_TRUE(dummy_search_box->search_box()->text().empty()); |
517 } | 624 } |
518 | 625 |
519 Close(); | 626 Close(); |
520 } | 627 } |
521 | 628 |
522 class AppListViewTestAura : public views::ViewsTestBase, | |
523 public ::testing::WithParamInterface<int> { | |
524 public: | |
525 AppListViewTestAura() {} | |
526 virtual ~AppListViewTestAura() {} | |
527 | |
528 // testing::Test overrides: | |
529 virtual void SetUp() OVERRIDE { | |
530 views::ViewsTestBase::SetUp(); | |
531 | |
532 // On Ash (only) the app list is placed into an aura::Window "container", | |
533 // which is also used to determine the context. In tests, use the ash root | |
534 // window as the parent. This only works on aura where the root window is a | |
535 // NativeView as well as a NativeWindow. | |
536 gfx::NativeView container = NULL; | |
537 #if defined(USE_AURA) | |
538 container = GetContext(); | |
539 #endif | |
540 | |
541 test_context_.reset(new AppListViewTestContext(GetParam(), container)); | |
542 } | |
543 | |
544 virtual void TearDown() OVERRIDE { | |
545 test_context_.reset(); | |
546 views::ViewsTestBase::TearDown(); | |
547 } | |
548 | |
549 protected: | |
550 scoped_ptr<AppListViewTestContext> test_context_; | |
551 | |
552 private: | |
553 DISALLOW_COPY_AND_ASSIGN(AppListViewTestAura); | |
554 }; | |
555 | |
556 class AppListViewTestDesktop : public views::ViewsTestBase, | |
557 public ::testing::WithParamInterface<int> { | |
558 public: | |
559 AppListViewTestDesktop() {} | |
560 virtual ~AppListViewTestDesktop() {} | |
561 | |
562 // testing::Test overrides: | |
563 virtual void SetUp() OVERRIDE { | |
564 set_views_delegate(new AppListViewTestViewsDelegate(this)); | |
565 views::ViewsTestBase::SetUp(); | |
566 test_context_.reset(new AppListViewTestContext(GetParam(), NULL)); | |
567 } | |
568 | |
569 virtual void TearDown() OVERRIDE { | |
570 test_context_.reset(); | |
571 views::ViewsTestBase::TearDown(); | |
572 } | |
573 | |
574 protected: | |
575 scoped_ptr<AppListViewTestContext> test_context_; | |
576 | |
577 private: | |
578 class AppListViewTestViewsDelegate : public views::TestViewsDelegate { | |
579 public: | |
580 AppListViewTestViewsDelegate(AppListViewTestDesktop* parent) | |
581 : parent_(parent) {} | |
582 | |
583 // Overridden from views::ViewsDelegate: | |
584 virtual void OnBeforeWidgetInit( | |
585 views::Widget::InitParams* params, | |
586 views::internal::NativeWidgetDelegate* delegate) OVERRIDE; | |
587 | |
588 private: | |
589 AppListViewTestDesktop* parent_; | |
590 | |
591 DISALLOW_COPY_AND_ASSIGN(AppListViewTestViewsDelegate); | |
592 }; | |
593 | |
594 DISALLOW_COPY_AND_ASSIGN(AppListViewTestDesktop); | |
595 }; | |
596 | |
597 void AppListViewTestDesktop::AppListViewTestViewsDelegate::OnBeforeWidgetInit( | |
598 views::Widget::InitParams* params, | |
599 views::internal::NativeWidgetDelegate* delegate) { | |
600 // Mimic the logic in ChromeViewsDelegate::OnBeforeWidgetInit(). Except, for | |
601 // ChromeOS, use the root window from the AuraTestHelper rather than depending | |
602 // on ash::Shell:GetPrimaryRootWindow(). Also assume non-ChromeOS is never the | |
603 // Ash desktop, as that is covered by AppListViewTestAura. | |
604 #if defined(OS_CHROMEOS) | |
605 if (!params->parent && !params->context) | |
606 params->context = parent_->GetContext(); | |
607 #elif defined(USE_AURA) | |
608 if (params->parent == NULL && params->context == NULL && !params->child) | |
609 params->native_widget = new views::DesktopNativeWidgetAura(delegate); | |
610 #endif | |
611 } | |
612 | |
613 } // namespace | |
614 | |
615 // Tests showing the app list with basic test model in an ash-style root window. | 629 // Tests showing the app list with basic test model in an ash-style root window. |
616 TEST_P(AppListViewTestAura, Display) { | 630 TEST_P(AppListViewTestAura, Display) { |
617 EXPECT_NO_FATAL_FAILURE(test_context_->RunDisplayTest()); | 631 EXPECT_NO_FATAL_FAILURE(test_context_->RunDisplayTest()); |
618 } | 632 } |
619 | 633 |
620 // Tests showing the app list on the desktop. Note on ChromeOS, this will still | 634 // Tests showing the app list on the desktop. Note on ChromeOS, this will still |
621 // use the regular root window. | 635 // use the regular root window. |
622 TEST_P(AppListViewTestDesktop, Display) { | 636 TEST_P(AppListViewTestDesktop, Display) { |
623 EXPECT_NO_FATAL_FAILURE(test_context_->RunDisplayTest()); | 637 EXPECT_NO_FATAL_FAILURE(test_context_->RunDisplayTest()); |
624 } | 638 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 INSTANTIATE_TEST_CASE_P(AppListViewTestAuraInstance, | 686 INSTANTIATE_TEST_CASE_P(AppListViewTestAuraInstance, |
673 AppListViewTestAura, | 687 AppListViewTestAura, |
674 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); | 688 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); |
675 | 689 |
676 INSTANTIATE_TEST_CASE_P(AppListViewTestDesktopInstance, | 690 INSTANTIATE_TEST_CASE_P(AppListViewTestDesktopInstance, |
677 AppListViewTestDesktop, | 691 AppListViewTestDesktop, |
678 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); | 692 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); |
679 | 693 |
680 } // namespace test | 694 } // namespace test |
681 } // namespace app_list | 695 } // namespace app_list |
OLD | NEW |