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

Unified Diff: blimp/client/core/contents/blimp_navigation_controller_impl_unittest.cc

Issue 2058263002: Tied up BlimpNavigationController to NavigationFeature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blimp_core
Patch Set: Removed BlimpContentsTest.java Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: blimp/client/core/contents/blimp_navigation_controller_impl_unittest.cc
diff --git a/blimp/client/core/contents/blimp_navigation_controller_impl_unittest.cc b/blimp/client/core/contents/blimp_navigation_controller_impl_unittest.cc
index b219b383430b6d7ecca01f2065f62a70a2d8b482..02fc86aeb35d880dae5e119dbce4a3aa05818f7f 100644
--- a/blimp/client/core/contents/blimp_navigation_controller_impl_unittest.cc
+++ b/blimp/client/core/contents/blimp_navigation_controller_impl_unittest.cc
@@ -2,46 +2,55 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "blimp/client/core/contents/blimp_navigation_controller_impl.h"
-
-#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "blimp/client/core/contents/blimp_navigation_controller_delegate.h"
+#include "blimp/client/core/contents/blimp_navigation_controller_impl.h"
+#include "blimp/client/core/contents/fake_navigation_feature.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+using testing::_;
+
namespace blimp {
namespace client {
namespace {
const GURL kExampleURL = GURL("https://www.example.com/");
-class TestBlimpNavigationControllerDelegate
+class MockBlimpNavigationControllerDelegate
: public BlimpNavigationControllerDelegate {
public:
- TestBlimpNavigationControllerDelegate() = default;
- ~TestBlimpNavigationControllerDelegate() override = default;
-
- void NotifyURLLoaded(const GURL& url) override { last_loaded_url_ = url; }
+ MockBlimpNavigationControllerDelegate() = default;
+ ~MockBlimpNavigationControllerDelegate() override = default;
- GURL GetLastLoadedURL() { return last_loaded_url_; }
+ MOCK_METHOD0(OnNavigationStateChanged, void());
private:
- GURL last_loaded_url_;
-
- DISALLOW_COPY_AND_ASSIGN(TestBlimpNavigationControllerDelegate);
+ DISALLOW_COPY_AND_ASSIGN(MockBlimpNavigationControllerDelegate);
};
-TEST(BlimpNavigationControllerImplTest, Basic) {
+TEST(BlimpNavigationControllerImplTest, BackForwardNavigation) {
base::MessageLoop loop;
- TestBlimpNavigationControllerDelegate delegate;
- BlimpNavigationControllerImpl navigation_controller(&delegate);
+ testing::StrictMock<MockBlimpNavigationControllerDelegate> delegate;
+ testing::StrictMock<FakeNavigationFeature> feature;
+ BlimpNavigationControllerImpl navigation_controller(&delegate, &feature);
+ feature.SetDelegate(1, &navigation_controller);
+
+ EXPECT_CALL(delegate, OnNavigationStateChanged());
navigation_controller.LoadURL(kExampleURL);
EXPECT_EQ(kExampleURL, navigation_controller.GetURL());
+ EXPECT_CALL(feature, GoBack(_));
+ EXPECT_CALL(feature, GoForward(_));
+ EXPECT_CALL(feature, Reload(_));
+
+ navigation_controller.GoBack();
+ navigation_controller.GoForward();
+ navigation_controller.Reload();
+
loop.RunUntilIdle();
- EXPECT_EQ(kExampleURL, delegate.GetLastLoadedURL());
}
} // namespace
« no previous file with comments | « blimp/client/core/contents/blimp_navigation_controller_impl.cc ('k') | blimp/client/core/contents/fake_navigation_feature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698