1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/app_list/views/test/apps_grid_view_test_api.h"
7 #include "ui/app_list/views/app_list_item_view.h"
8 #include "ui/app_list/views/apps_grid_view.h"
9 #include "ui/events/event.h"
14 AppsGridViewTestApi::AppsGridViewTestApi(AppsGridView* view)
18 AppsGridViewTestApi::~AppsGridViewTestApi() {
21 views::View* AppsGridViewTestApi::GetViewAtModelIndex(int index) const {
22 return view_->view_model_.view_at(index);
25 void AppsGridViewTestApi::LayoutToIdealBounds() {
26 view_->bounds_animator_.Cancel();
30 void AppsGridViewTestApi::SetPageFlipDelay(int page_flip_delay_in_ms) {
31 view_->page_flip_delay_in_ms_ = page_flip_delay_in_ms;
34 void AppsGridViewTestApi::PressItemAt(int index) {
35 GetViewAtModelIndex(index)->OnKeyPressed(
36 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_RETURN, ui::EF_NONE));
39 void AppsGridViewTestApi::DisableSynchronousDrag() {
41 DCHECK(view_->synchronous_drag_ == NULL) << "DisableSynchronousDrag needs to "
43 "synchronous_drag_ is set up.";
44 view_->use_synchronous_drag_ = false;
48 bool AppsGridViewTestApi::HasPendingPageFlip() const {
49 return view_->page_flip_timer_.IsRunning() ||
50 view_->pagination_model()->has_transition();
54 } // namespace app_list