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

Side by Side Diff: ios/chrome/browser/ui/side_swipe/side_swipe_controller_unittest.mm

Issue 2587023002: Upstream Chrome on iOS source code [8/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
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 #include "base/mac/scoped_nsobject.h"
6 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
7 #import "ios/chrome/browser/ui/side_swipe/side_swipe_controller.h"
8 #include "ios/web/public/test/test_web_thread_bundle.h"
9 #include "testing/platform_test.h"
10 #import "third_party/ocmock/OCMock/OCMock.h"
11 #import "third_party/ocmock/gtest_support.h"
12 #include "third_party/ocmock/ocmock_extensions.h"
13
14 namespace {
15
16 class SideSwipeControllerTest : public PlatformTest {
17 public:
18 void SetUp() override {
19 // Create a mock for the TabModel that owns the object under test.
20 tab_model_.reset([[OCMockObject niceMockForClass:[TabModel class]] retain]);
21
22 TestChromeBrowserState::Builder builder;
23 browser_state_ = builder.Build();
24 // Create the object to test.
25 side_swipe_controller_.reset([[SideSwipeController alloc]
26 initWithTabModel:tab_model_
27 browserState:browser_state_.get()]);
28
29 view_.reset([[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 240)]);
30
31 [side_swipe_controller_ addHorizontalGesturesToView:view_];
32 };
33
34 web::TestWebThreadBundle thread_bundle_;
35 std::unique_ptr<TestChromeBrowserState> browser_state_;
36 base::scoped_nsobject<UIView> view_;
37 base::scoped_nsobject<TabModel> tab_model_;
38 base::scoped_nsobject<SideSwipeController> side_swipe_controller_;
39 };
40
41 TEST_F(SideSwipeControllerTest, TestConstructor) {
42 EXPECT_TRUE(side_swipe_controller_.get());
43 }
44
45 TEST_F(SideSwipeControllerTest, TestSwipeRecognizers) {
46 NSSet* recognizers = [side_swipe_controller_ swipeRecognizers];
47 BOOL hasRecognizer = NO;
48 for (UISwipeGestureRecognizer* swipeRecognizer in recognizers) {
49 hasRecognizer = YES;
50 EXPECT_TRUE(swipeRecognizer);
51 }
52 EXPECT_TRUE(hasRecognizer);
53 }
54
55 } // anonymous namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698