| 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 "blimp/client/core/contents/blimp_contents_impl.h" | 9 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| 9 #include "blimp/client/core/contents/fake_navigation_feature.h" | 10 #include "blimp/client/core/contents/fake_navigation_feature.h" |
| 10 #include "blimp/client/public/contents/blimp_contents_observer.h" | 11 #include "blimp/client/public/contents/blimp_contents_observer.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 14 |
| 14 namespace blimp { | 15 namespace blimp { |
| 15 namespace client { | 16 namespace client { |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 41 | 42 |
| 42 testing::StrictMock<MockBlimpContentsObserver> observer1; | 43 testing::StrictMock<MockBlimpContentsObserver> observer1; |
| 43 blimp_contents.AddObserver(&observer1); | 44 blimp_contents.AddObserver(&observer1); |
| 44 testing::StrictMock<MockBlimpContentsObserver> observer2; | 45 testing::StrictMock<MockBlimpContentsObserver> observer2; |
| 45 blimp_contents.AddObserver(&observer2); | 46 blimp_contents.AddObserver(&observer2); |
| 46 | 47 |
| 47 EXPECT_CALL(observer1, OnNavigationStateChanged()); | 48 EXPECT_CALL(observer1, OnNavigationStateChanged()); |
| 48 EXPECT_CALL(observer2, OnNavigationStateChanged()).Times(2); | 49 EXPECT_CALL(observer2, OnNavigationStateChanged()).Times(2); |
| 49 | 50 |
| 50 navigation_controller.LoadURL(GURL(kExampleURL)); | 51 navigation_controller.LoadURL(GURL(kExampleURL)); |
| 51 loop.RunUntilIdle(); | 52 base::RunLoop().RunUntilIdle(); |
| 52 | 53 |
| 53 EXPECT_EQ(kExampleURL, navigation_controller.GetURL().spec()); | 54 EXPECT_EQ(kExampleURL, navigation_controller.GetURL().spec()); |
| 54 | 55 |
| 55 // Observer should no longer receive callbacks. | 56 // Observer should no longer receive callbacks. |
| 56 blimp_contents.RemoveObserver(&observer1); | 57 blimp_contents.RemoveObserver(&observer1); |
| 57 | 58 |
| 58 navigation_controller.LoadURL(GURL(kOtherExampleURL)); | 59 navigation_controller.LoadURL(GURL(kOtherExampleURL)); |
| 59 loop.RunUntilIdle(); | 60 base::RunLoop().RunUntilIdle(); |
| 60 | 61 |
| 61 EXPECT_EQ(kOtherExampleURL, navigation_controller.GetURL().spec()); | 62 EXPECT_EQ(kOtherExampleURL, navigation_controller.GetURL().spec()); |
| 62 } | 63 } |
| 63 | 64 |
| 64 } // namespace | 65 } // namespace |
| 65 } // namespace client | 66 } // namespace client |
| 66 } // namespace blimp | 67 } // namespace blimp |
| OLD | NEW |