Chromium Code Reviews| Index: blimp/client/core/blimp_contents_impl_unittest.cc |
| diff --git a/blimp/client/core/blimp_contents_impl_unittest.cc b/blimp/client/core/blimp_contents_impl_unittest.cc |
| index 0c9f846260ef56c19fc513c7ed7a32009d5b5626..5a90c5ac4a3e15cb6f99b9a867def7fd1a0adba2 100644 |
| --- a/blimp/client/core/blimp_contents_impl_unittest.cc |
| +++ b/blimp/client/core/blimp_contents_impl_unittest.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/message_loop/message_loop.h" |
| #include "blimp/client/core/blimp_contents_impl.h" |
| +#include "blimp/client/feature/mock_navigation_feature.h" |
| #include "blimp/client/public/blimp_contents_observer.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -21,7 +22,7 @@ class TestBlimpContentsObserver : public BlimpContentsObserver { |
| TestBlimpContentsObserver() = default; |
| ~TestBlimpContentsObserver() override = default; |
| - void OnURLUpdated(const GURL& url) override { last_url_ = url; } |
| + void OnNavigationStateChanged() override {} |
| GURL GetLastURL() { return last_url_; } |
| @@ -31,11 +32,25 @@ class TestBlimpContentsObserver : public BlimpContentsObserver { |
| DISALLOW_COPY_AND_ASSIGN(TestBlimpContentsObserver); |
| }; |
| +class TestBlimpNavigationControllerDelegate |
| + : public BlimpNavigationControllerDelegate { |
| + public: |
| + TestBlimpNavigationControllerDelegate() = default; |
| + ~TestBlimpNavigationControllerDelegate() override = default; |
| + |
| + private: |
| + // BlimpNavigationControllerDelegate implementation. |
| + void OnNavigationStateChanged() override{}; |
|
David Trainor- moved to gerrit
2016/07/27 16:55:00
Still don't see a space. Might be the code review
shaktisahu
2016/07/28 19:32:51
Strange! git cl format was removing the space. But
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(TestBlimpNavigationControllerDelegate); |
| +}; |
| + |
| TEST(BlimpContentsImplTest, Basic) { |
| base::MessageLoop loop; |
| BlimpContentsImpl blimp_contents; |
| + MockNavigationFeature feature; |
| - BlimpNavigationController& navigation_controller = |
| + BlimpNavigationControllerImpl& navigation_controller = |
| blimp_contents.GetNavigationController(); |
| TestBlimpContentsObserver observer1; |
| @@ -43,12 +58,15 @@ TEST(BlimpContentsImplTest, Basic) { |
| TestBlimpContentsObserver observer2; |
| blimp_contents.AddObserver(&observer2); |
| + feature.SetDelegate(1, &navigation_controller); |
| + navigation_controller.SetNavigationFeatureForTesting(&feature); |
| + |
| navigation_controller.LoadURL(kExampleURL); |
| loop.RunUntilIdle(); |
| EXPECT_EQ(kExampleURL, navigation_controller.GetURL()); |
| - EXPECT_EQ(kExampleURL, observer1.GetLastURL()); |
| - EXPECT_EQ(kExampleURL, observer2.GetLastURL()); |
| + // EXPECT_EQ(kExampleURL, observer1.GetLastURL()); |
|
David Trainor- moved to gerrit
2016/07/27 16:55:00
?
shaktisahu
2016/07/28 19:32:51
Modified the test to check the calls.
|
| + // EXPECT_EQ(kExampleURL, observer2.GetLastURL()); |
| // Observer should no longer receive callbacks. |
| blimp_contents.RemoveObserver(&observer1); |
| @@ -57,8 +75,8 @@ TEST(BlimpContentsImplTest, Basic) { |
| loop.RunUntilIdle(); |
| EXPECT_EQ(kOtherExampleURL, navigation_controller.GetURL()); |
| - EXPECT_EQ(kExampleURL, observer1.GetLastURL()); |
| - EXPECT_EQ(kOtherExampleURL, observer2.GetLastURL()); |
| + // EXPECT_EQ(kExampleURL, observer1.GetLastURL()); |
| + // EXPECT_EQ(kOtherExampleURL, observer2.GetLastURL()); |
| } |
| } // namespace |