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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 // Closes the app list. This sets |view_| to NULL. | 124 // Closes the app list. This sets |view_| to NULL. |
125 void Close(); | 125 void Close(); |
126 | 126 |
127 // Gets the PaginationModel owned by |view_|. | 127 // Gets the PaginationModel owned by |view_|. |
128 PaginationModel* GetPaginationModel(); | 128 PaginationModel* GetPaginationModel(); |
129 | 129 |
130 const TestType test_type_; | 130 const TestType test_type_; |
131 scoped_ptr<base::RunLoop> run_loop_; | 131 scoped_ptr<base::RunLoop> run_loop_; |
132 app_list::AppListView* view_; // Owned by native widget. | 132 app_list::AppListView* view_; // Owned by native widget. |
133 app_list::test::AppListTestViewDelegate* delegate_; // Owned by |view_|; | 133 scoped_ptr<app_list::test::AppListTestViewDelegate> delegate_; |
134 | 134 |
135 DISALLOW_COPY_AND_ASSIGN(AppListViewTestContext); | 135 DISALLOW_COPY_AND_ASSIGN(AppListViewTestContext); |
136 }; | 136 }; |
137 | 137 |
138 // Extend the regular AppListTestViewDelegate to communicate back to the test | 138 // Extend the regular AppListTestViewDelegate to communicate back to the test |
139 // 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 |
140 // delegate is owned by the view. | 140 // delegate is owned by the view. |
141 class UnitTestViewDelegate : public app_list::test::AppListTestViewDelegate { | 141 class UnitTestViewDelegate : public app_list::test::AppListTestViewDelegate { |
142 public: | 142 public: |
143 UnitTestViewDelegate(AppListViewTestContext* parent) : parent_(parent) {} | 143 UnitTestViewDelegate(AppListViewTestContext* parent) : parent_(parent) {} |
(...skipping 24 matching lines...) Expand all Loading... |
168 break; | 168 break; |
169 case EXPERIMENTAL: | 169 case EXPERIMENTAL: |
170 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 170 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
171 switches::kEnableExperimentalAppList); | 171 switches::kEnableExperimentalAppList); |
172 break; | 172 break; |
173 default: | 173 default: |
174 NOTREACHED(); | 174 NOTREACHED(); |
175 break; | 175 break; |
176 } | 176 } |
177 | 177 |
178 delegate_ = new UnitTestViewDelegate(this); | 178 delegate_.reset(new UnitTestViewDelegate(this)); |
179 view_ = new app_list::AppListView(delegate_); | 179 view_ = new app_list::AppListView(delegate_.get()); |
180 | 180 |
181 // Initialize centered around a point that ensures the window is wholly shown. | 181 // Initialize centered around a point that ensures the window is wholly shown. |
182 view_->InitAsBubbleAtFixedLocation(parent, | 182 view_->InitAsBubbleAtFixedLocation(parent, |
183 0, | 183 0, |
184 gfx::Point(300, 300), | 184 gfx::Point(300, 300), |
185 views::BubbleBorder::FLOAT, | 185 views::BubbleBorder::FLOAT, |
186 false /* border_accepts_events */); | 186 false /* border_accepts_events */); |
187 } | 187 } |
188 | 188 |
189 AppListViewTestContext::~AppListViewTestContext() { | 189 AppListViewTestContext::~AppListViewTestContext() { |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 INSTANTIATE_TEST_CASE_P(AppListViewTestAuraInstance, | 693 INSTANTIATE_TEST_CASE_P(AppListViewTestAuraInstance, |
694 AppListViewTestAura, | 694 AppListViewTestAura, |
695 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); | 695 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); |
696 | 696 |
697 INSTANTIATE_TEST_CASE_P(AppListViewTestDesktopInstance, | 697 INSTANTIATE_TEST_CASE_P(AppListViewTestDesktopInstance, |
698 AppListViewTestDesktop, | 698 AppListViewTestDesktop, |
699 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); | 699 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); |
700 | 700 |
701 } // namespace test | 701 } // namespace test |
702 } // namespace app_list | 702 } // namespace app_list |
OLD | NEW |