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

Side by Side Diff: ios/chrome/browser/ui/browser_container_view_unittest.mm

Issue 2588713002: Upstream Chrome on iOS source code [4/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 unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/ui/browser_container_view.mm ('k') | ios/chrome/browser/ui/browser_ios.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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.
4
5 #import "ios/chrome/browser/ui/browser_container_view.h"
6
7 #import "base/mac/scoped_nsobject.h"
8 #include "testing/platform_test.h"
9
10 // Fixture for BrowserContainerView testing.
11 class BrowserContainerViewTest : public PlatformTest {
12 protected:
13 void SetUp() override {
14 PlatformTest::SetUp();
15
16 browser_container_view_.reset([[BrowserContainerView alloc] init]);
17 ASSERT_TRUE(browser_container_view_);
18 content_view_.reset([[UIView alloc] init]);
19 ASSERT_TRUE(content_view_);
20 }
21 base::scoped_nsobject<BrowserContainerView> browser_container_view_;
22 base::scoped_nsobject<UIView> content_view_;
23 };
24
25 // Tests adding a new content view when BrowserContainerView does not currently
26 // have a content view.
27 TEST_F(BrowserContainerViewTest, AddingContentView) {
28 ASSERT_FALSE([content_view_ superview]);
29
30 [browser_container_view_ displayContentView:content_view_];
31 EXPECT_EQ(static_cast<UIView*>(browser_container_view_),
32 [content_view_ superview]);
33 }
34
35 // Tests removing previously added content view.
36 TEST_F(BrowserContainerViewTest, RemovingContentView) {
37 [browser_container_view_ displayContentView:content_view_];
38 ASSERT_EQ(static_cast<UIView*>(browser_container_view_),
39 [content_view_ superview]);
40
41 [browser_container_view_ displayContentView:nil];
42 EXPECT_FALSE([content_view_ superview]);
43 }
44
45 // Tests adding a new content view when BrowserContainerView already has a
46 // content view.
47 TEST_F(BrowserContainerViewTest, ReplacingContentView) {
48 [browser_container_view_ displayContentView:content_view_];
49 ASSERT_EQ(static_cast<UIView*>(browser_container_view_),
50 [content_view_ superview]);
51
52 base::scoped_nsobject<UIView> content_view2([[UIView alloc] init]);
53 [browser_container_view_ displayContentView:content_view2];
54 EXPECT_FALSE([content_view_ superview]);
55 EXPECT_EQ(static_cast<UIView*>(browser_container_view_),
56 [content_view2 superview]);
57 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/browser_container_view.mm ('k') | ios/chrome/browser/ui/browser_ios.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698