| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "blimp/client/core/contents/blimp_contents_impl.h" | 5 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "blimp/client/core/contents/fake_navigation_feature.h" | 9 #include "blimp/client/core/contents/fake_navigation_feature.h" |
| 10 #include "blimp/client/core/contents/tab_control_feature.h" | 10 #include "blimp/client/core/contents/tab_control_feature.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 ~MockTabControlFeature() override = default; | 38 ~MockTabControlFeature() override = default; |
| 39 MOCK_METHOD2(SetSizeAndScale, void(const gfx::Size&, float)); | 39 MOCK_METHOD2(SetSizeAndScale, void(const gfx::Size&, float)); |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 DISALLOW_COPY_AND_ASSIGN(MockTabControlFeature); | 42 DISALLOW_COPY_AND_ASSIGN(MockTabControlFeature); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 TEST(BlimpContentsImplTest, LoadURLAndNotifyObservers) { | 45 TEST(BlimpContentsImplTest, LoadURLAndNotifyObservers) { |
| 46 base::MessageLoop loop; | 46 base::MessageLoop loop; |
| 47 FakeNavigationFeature feature; | 47 FakeNavigationFeature feature; |
| 48 BlimpContentsImpl blimp_contents(kDummyTabId, nullptr, &feature, nullptr); | 48 BlimpContentsImpl blimp_contents(kDummyTabId, nullptr, nullptr, &feature, |
| 49 nullptr); |
| 49 | 50 |
| 50 BlimpNavigationControllerImpl& navigation_controller = | 51 BlimpNavigationControllerImpl& navigation_controller = |
| 51 blimp_contents.GetNavigationController(); | 52 blimp_contents.GetNavigationController(); |
| 52 | 53 |
| 53 testing::StrictMock<MockBlimpContentsObserver> observer1(&blimp_contents); | 54 testing::StrictMock<MockBlimpContentsObserver> observer1(&blimp_contents); |
| 54 testing::StrictMock<MockBlimpContentsObserver> observer2(&blimp_contents); | 55 testing::StrictMock<MockBlimpContentsObserver> observer2(&blimp_contents); |
| 55 | 56 |
| 56 EXPECT_CALL(observer1, OnNavigationStateChanged()); | 57 EXPECT_CALL(observer1, OnNavigationStateChanged()); |
| 57 EXPECT_CALL(observer2, OnNavigationStateChanged()).Times(2); | 58 EXPECT_CALL(observer2, OnNavigationStateChanged()).Times(2); |
| 58 | 59 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 70 EXPECT_EQ(kOtherExampleURL, navigation_controller.GetURL().spec()); | 71 EXPECT_EQ(kOtherExampleURL, navigation_controller.GetURL().spec()); |
| 71 } | 72 } |
| 72 | 73 |
| 73 TEST(BlimpContentsImplTest, SetSizeAndScaleThroughTabControlFeature) { | 74 TEST(BlimpContentsImplTest, SetSizeAndScaleThroughTabControlFeature) { |
| 74 int width = 10; | 75 int width = 10; |
| 75 int height = 15; | 76 int height = 15; |
| 76 float dp_to_px = 1.23f; | 77 float dp_to_px = 1.23f; |
| 77 | 78 |
| 78 MockTabControlFeature tab_control_feature; | 79 MockTabControlFeature tab_control_feature; |
| 79 base::MessageLoop loop; | 80 base::MessageLoop loop; |
| 80 BlimpContentsImpl blimp_contents(kDummyTabId, nullptr, nullptr, | 81 BlimpContentsImpl blimp_contents(kDummyTabId, nullptr, nullptr, nullptr, |
| 81 &tab_control_feature); | 82 &tab_control_feature); |
| 82 | 83 |
| 83 EXPECT_CALL(tab_control_feature, | 84 EXPECT_CALL(tab_control_feature, |
| 84 SetSizeAndScale(gfx::Size(width, height), dp_to_px)).Times(1); | 85 SetSizeAndScale(gfx::Size(width, height), dp_to_px)).Times(1); |
| 85 | 86 |
| 86 blimp_contents.SetSizeAndScale(gfx::Size(width, height), dp_to_px); | 87 blimp_contents.SetSizeAndScale(gfx::Size(width, height), dp_to_px); |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace | 90 } // namespace |
| 90 } // namespace client | 91 } // namespace client |
| 91 } // namespace blimp | 92 } // namespace blimp |
| OLD | NEW |