1 // Copyright 2013 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 #ifndef UI_APP_LIST_COCOA_TEST_APPS_GRID_CONTROLLER_TEST_HELPER_H_
6 #define UI_APP_LIST_COCOA_TEST_APPS_GRID_CONTROLLER_TEST_HELPER_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h"
12 #import "ui/gfx/test/ui_cocoa_test_helper.h"
14 @class AppsGridController;
20 class AppsGridControllerTestHelper : public ui::CocoaTest {
22 static const size_t kItemsPerPage;
24 AppsGridControllerTestHelper();
25 virtual ~AppsGridControllerTestHelper();
27 void SetUpWithGridController(AppsGridController* grid_controller);
30 // Send a click to the test window in the centre of |view|.
31 void SimulateClick(NSView* view);
33 // Send a key action using handleCommandBySelector.
34 void SimulateKeyAction(SEL c);
36 void SimulateMouseEnterItemAt(size_t index);
37 void SimulateMouseExitItemAt(size_t index);
39 // Get a string representation of the items as they are currently ordered in
40 // the view. Each page will start and end with a | character.
41 std::string GetViewContent() const;
43 // Find the page containing |item_id|, and return the index of that page.
44 // Return NSNotFound if the item is not found, or if the item appears more
46 size_t GetPageIndexForItem(int item_id) const;
48 void DelayForCollectionView();
51 NSButton* GetItemViewAt(size_t index);
52 NSCollectionView* GetPageAt(size_t index);
53 NSView* GetSelectedView();
55 AppsGridController* apps_grid_controller_;
58 base::MessageLoopForUI message_loop_;
60 DISALLOW_COPY_AND_ASSIGN(AppsGridControllerTestHelper);
64 } // namespace app_list
66 #endif // UI_APP_LIST_COCOA_TEST_APPS_GRID_CONTROLLER_TEST_HELPER_H_