Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: ui/app_list/cocoa/test/apps_grid_controller_test_helper.mm

Issue 645853013: Remove some platform specific stuff from views. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/cocoa/test/apps_grid_controller_test_helper.h ('k') | ui/app_list/demo/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/cocoa/test/apps_grid_controller_test_helper.mm
diff --git a/ui/app_list/cocoa/test/apps_grid_controller_test_helper.mm b/ui/app_list/cocoa/test/apps_grid_controller_test_helper.mm
deleted file mode 100644
index cd2298ff70b2ba1ad265b0185f77a97aa4e88a31..0000000000000000000000000000000000000000
--- a/ui/app_list/cocoa/test/apps_grid_controller_test_helper.mm
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "ui/app_list/cocoa/test/apps_grid_controller_test_helper.h"
-
-#include "base/mac/foundation_util.h"
-#include "base/strings/stringprintf.h"
-#include "ui/app_list/app_list_item.h"
-#import "ui/app_list/cocoa/apps_grid_controller.h"
-#import "ui/app_list/cocoa/apps_grid_view_item.h"
-#import "ui/events/test/cocoa_test_event_utils.h"
-
-namespace app_list {
-namespace test {
-
-const size_t AppsGridControllerTestHelper::kItemsPerPage = 16;
-
-AppsGridControllerTestHelper::AppsGridControllerTestHelper() {
- Init();
- [AppsGridController setScrollAnimationDuration:0.0];
-}
-
-AppsGridControllerTestHelper::~AppsGridControllerTestHelper() {}
-
-void AppsGridControllerTestHelper::SetUpWithGridController(
- AppsGridController* grid_controller) {
- ui::CocoaTest::SetUp();
- apps_grid_controller_ = grid_controller;
-}
-
-void AppsGridControllerTestHelper::SimulateClick(NSView* view) {
- std::pair<NSEvent*, NSEvent*> events(
- cocoa_test_event_utils::MouseClickInView(view, 1));
- [NSApp postEvent:events.first atStart:NO];
- [NSApp postEvent:events.second atStart:NO];
-}
-
-void AppsGridControllerTestHelper::SimulateKeyAction(SEL c) {
- [apps_grid_controller_ handleCommandBySelector:c];
-}
-
-void AppsGridControllerTestHelper::SimulateMouseEnterItemAt(size_t index) {
- [[apps_grid_controller_ itemAtIndex:index] mouseEntered:
- cocoa_test_event_utils::EnterExitEventWithType(NSMouseEntered)];
-}
-
-void AppsGridControllerTestHelper::SimulateMouseExitItemAt(size_t index) {
- [[apps_grid_controller_ itemAtIndex:index] mouseExited:
- cocoa_test_event_utils::EnterExitEventWithType(NSMouseExited)];
-}
-
-std::string AppsGridControllerTestHelper::GetViewContent() const {
- std::string s;
- for (size_t page_index = 0; page_index < [apps_grid_controller_ pageCount];
- ++page_index) {
- s += '|';
- NSCollectionView* page_view =
- [apps_grid_controller_ collectionViewAtPageIndex:page_index];
- for (size_t i = 0; i < [[page_view content] count]; ++i) {
- AppsGridViewItem* item = base::mac::ObjCCastStrict<AppsGridViewItem>(
- [page_view itemAtIndex:i]);
- if (i != 0)
- s += ',';
- s += [item model]->id();
- }
- s += '|';
- }
- return s;
-}
-
-size_t AppsGridControllerTestHelper::GetPageIndexForItem(int item_id) const {
- const std::string search = base::StringPrintf("Item %d", item_id);
- size_t page_index = 0;
- NSUInteger found_at_page_index = NSNotFound;
- for (; page_index < [apps_grid_controller_ pageCount]; ++page_index) {
- NSCollectionView* page_view =
- [apps_grid_controller_ collectionViewAtPageIndex:page_index];
- for (NSUInteger i = 0; i < [[page_view content] count]; ++i) {
- AppsGridViewItem* item = base::mac::ObjCCastStrict<AppsGridViewItem>(
- [page_view itemAtIndex:i]);
- if ([item model]->id() == search) {
- if (found_at_page_index != NSNotFound)
- return NSNotFound; // Duplicate.
- found_at_page_index = page_index;
- }
- }
- }
- return found_at_page_index;
-}
-
-void AppsGridControllerTestHelper::DelayForCollectionView() {
- message_loop_.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(),
- base::TimeDelta::FromMilliseconds(100));
- message_loop_.Run();
-}
-
-void AppsGridControllerTestHelper::SinkEvents() {
- message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
- message_loop_.Run();
-}
-
-NSButton* AppsGridControllerTestHelper::GetItemViewAt(size_t index) {
- if (index == NSNotFound)
- return nil;
-
- return [[apps_grid_controller_ itemAtIndex:index] button];
-}
-
-NSCollectionView* AppsGridControllerTestHelper::GetPageAt(size_t index) {
- return [apps_grid_controller_ collectionViewAtPageIndex:index];
-}
-
-NSView* AppsGridControllerTestHelper::GetSelectedView() {
- return GetItemViewAt([apps_grid_controller_ selectedItemIndex]);
-}
-
-} // namespace test
-} // namespace app_list
« no previous file with comments | « ui/app_list/cocoa/test/apps_grid_controller_test_helper.h ('k') | ui/app_list/demo/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698