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

Side by Side Diff: blimp/client/core/contents/blimp_contents_impl_unittest.cc

Issue 2270323004: Add BlimpView to a Chrome tab when Blimp is enabled. (Closed)
Patch Set: Magic now happens Created 4 years, 3 months 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
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698