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

Unified Diff: ios/chrome/browser/ui/ntp/most_visited_cell_unittest.mm

Issue 2590473002: Upstream Chrome on iOS source code [5/11]. (Closed)
Patch Set: Created 4 years 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/ntp/most_visited_cell.mm ('k') | ios/chrome/browser/ui/ntp/most_visited_layout.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/ntp/most_visited_cell_unittest.mm
diff --git a/ios/chrome/browser/ui/ntp/most_visited_cell_unittest.mm b/ios/chrome/browser/ui/ntp/most_visited_cell_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..9e12b2bab31037c2754a8aec8d52f802f76d267b
--- /dev/null
+++ b/ios/chrome/browser/ui/ntp/most_visited_cell_unittest.mm
@@ -0,0 +1,34 @@
+// Copyright 2016 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.
+
+#include "base/mac/scoped_nsobject.h"
+#import "ios/chrome/browser/ui/ntp/most_visited_cell.h"
+#include "testing/platform_test.h"
+
+static NSString* title = @"Most Visited Cell Title";
+const GURL URL = GURL("http://example.com");
+
+// Fixture to test MostVisitedCell.
+class MostVisitedCellTest : public PlatformTest {
+ protected:
+ base::scoped_nsobject<MostVisitedCell> cell_;
+};
+
+TEST_F(MostVisitedCellTest, TestConstructor) {
+ CGRect rect = CGRectMake(0, 0, 100, 100);
+ cell_.reset([[MostVisitedCell alloc] initWithFrame:rect]);
+ [cell_ setURL:URL];
+ EXPECT_TRUE(cell_.get());
+ UIGraphicsBeginImageContext([cell_ bounds].size);
+ [cell_ drawRect:[cell_ bounds]];
+ UIGraphicsEndImageContext();
+ EXPECT_EQ(URL, [cell_ URL]);
+}
+
+TEST_F(MostVisitedCellTest, ValidateTitle) {
+ CGRect rect = CGRectMake(0, 0, 100, 100);
+ cell_.reset([[MostVisitedCell alloc] initWithFrame:rect]);
+ [cell_ setText:title];
+ EXPECT_EQ(title, [cell_ accessibilityLabel]);
+}
« no previous file with comments | « ios/chrome/browser/ui/ntp/most_visited_cell.mm ('k') | ios/chrome/browser/ui/ntp/most_visited_layout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698