| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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/web/public/web_state/web_state_delegate_bridge.h" |
| 6 |
| 7 #include <memory> |
| 8 |
| 9 #import "base/mac/scoped_nsobject.h" |
| 10 #import "ios/web/web_state/web_state_delegate_stub.h" |
| 11 #include "testing/platform_test.h" |
| 12 #import "third_party/ocmock/gtest_support.h" |
| 13 |
| 14 namespace web { |
| 15 |
| 16 // Test fixture to test WebStateDelegateBridge class. |
| 17 class WebStateDelegateBridgeTest : public PlatformTest { |
| 18 protected: |
| 19 void SetUp() override { |
| 20 PlatformTest::SetUp(); |
| 21 |
| 22 id originalMockDelegate = |
| 23 [OCMockObject niceMockForProtocol:@protocol(CRWWebStateDelegate)]; |
| 24 delegate_.reset([[CRWWebStateDelegateStub alloc] |
| 25 initWithRepresentedObject:originalMockDelegate]); |
| 26 |
| 27 bridge_.reset(new WebStateDelegateBridge(delegate_.get())); |
| 28 } |
| 29 |
| 30 void TearDown() override { |
| 31 EXPECT_OCMOCK_VERIFY(delegate_); |
| 32 PlatformTest::TearDown(); |
| 33 } |
| 34 |
| 35 base::scoped_nsprotocol<id> delegate_; |
| 36 std::unique_ptr<WebStateDelegateBridge> bridge_; |
| 37 }; |
| 38 |
| 39 // Tests |LoadProgressChanged| forwarding. |
| 40 TEST_F(WebStateDelegateBridgeTest, LoadProgressChanged) { |
| 41 ASSERT_EQ(0.0, [delegate_ changedProgress]); |
| 42 bridge_->LoadProgressChanged(nullptr, 1.0); |
| 43 EXPECT_EQ(1.0, [delegate_ changedProgress]); |
| 44 } |
| 45 |
| 46 } // namespace web |
| OLD | NEW |