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

Unified Diff: ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item_unittest.mm

Issue 2808433002: Create a MostVisited cell for ContentSuggestions (Closed)
Patch Set: Address comment Created 3 years, 8 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 | « ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item_unittest.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item_unittest.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..50a147c999a8c1c21f004ee255c6d74cc3401602
--- /dev/null
+++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item_unittest.mm
@@ -0,0 +1,81 @@
+// Copyright 2017 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 "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.h"
+
+#include "ios/chrome/browser/ui/ui_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+namespace {
+
+TEST(ContentSuggestionsMostVisitedItemTest, Configure) {
+ // Setup.
+ ContentSuggestionsMostVisitedItem* item =
+ [[ContentSuggestionsMostVisitedItem alloc] initWithType:0];
+
+ // Action.
+ ContentSuggestionsMostVisitedCell* cell = [[[item cellClass] alloc] init];
+
+ // Test.
+ ASSERT_EQ([ContentSuggestionsMostVisitedCell class], [cell class]);
+}
+
+TEST(ContentSuggestionsMostVisitedItemTest, SizeIPhone6) {
+ // Setup.
+ if (IsIPadIdiom())
+ return;
+
+ ContentSuggestionsMostVisitedCell* cell =
+ [[ContentSuggestionsMostVisitedCell alloc] init];
+ cell.frame = CGRectMake(0, 0, 360, 0);
+ [cell layoutIfNeeded];
+
+ // Test.
+ EXPECT_EQ(4U, [cell numberOfTilesPerLine]);
+}
+
+TEST(ContentSuggestionsMostVisitedItemTest, SizeIPhone5) {
+ // Setup.
+ if (IsIPadIdiom())
+ return;
+
+ ContentSuggestionsMostVisitedCell* cell =
+ [[ContentSuggestionsMostVisitedCell alloc] init];
+ cell.frame = CGRectMake(0, 0, 320, 0);
+ [cell layoutIfNeeded];
+
+ // Test.
+ EXPECT_EQ(3U, [cell numberOfTilesPerLine]);
+}
+
+// Test for iPad portrait and iPhone landscape.
+TEST(ContentSuggestionsMostVisitedItemTest, SizeLarge) {
+ // Setup.
+ ContentSuggestionsMostVisitedCell* cell =
+ [[ContentSuggestionsMostVisitedCell alloc] init];
+ cell.frame = CGRectMake(0, 0, 720, 0);
+ [cell layoutIfNeeded];
+
+ // Test.
+ EXPECT_EQ(4U, [cell numberOfTilesPerLine]);
+}
+
+TEST(ContentSuggestionsMostVisitedItemTest, SizeIPadSplit) {
+ // Setup.
+ if (!IsIPadIdiom())
+ return;
+
+ ContentSuggestionsMostVisitedCell* cell =
+ [[ContentSuggestionsMostVisitedCell alloc] init];
+ cell.frame = CGRectMake(0, 0, 360, 0);
+ [cell layoutIfNeeded];
+
+ // Test.
+ EXPECT_EQ(3U, [cell numberOfTilesPerLine]);
+}
+}
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698