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

Unified Diff: blimp/client/core/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: Addressed code review comments Created 4 years, 5 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/blimp_navigation_controller_impl_unittest.cc
diff --git a/blimp/client/core/blimp_navigation_controller_impl_unittest.cc b/blimp/client/core/blimp_navigation_controller_impl_unittest.cc
index 2b2d7319e240526ed646ed8a69c00952ecbd938e..9b9edd11d995a7b77cb5961dcf7b0eeb22c5222d 100644
--- a/blimp/client/core/blimp_navigation_controller_impl_unittest.cc
+++ b/blimp/client/core/blimp_navigation_controller_impl_unittest.cc
@@ -4,11 +4,14 @@
#include "blimp/client/core/blimp_navigation_controller_impl.h"
-#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "blimp/client/core/blimp_navigation_controller_delegate.h"
+#include "blimp/client/feature/mock_navigation_feature.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+using testing::_;
+
namespace blimp {
namespace client {
namespace {
@@ -21,7 +24,7 @@ class TestBlimpNavigationControllerDelegate
TestBlimpNavigationControllerDelegate() = default;
~TestBlimpNavigationControllerDelegate() override = default;
- void NotifyURLLoaded(const GURL& url) override { last_loaded_url_ = url; }
+ MOCK_METHOD0(OnNavigationStateChanged, void());
GURL GetLastLoadedURL() { return last_loaded_url_; }
@@ -37,11 +40,24 @@ TEST(BlimpNavigationControllerImplTest, Basic) {
TestBlimpNavigationControllerDelegate delegate;
BlimpNavigationControllerImpl navigation_controller(&delegate);
+ MockNavigationFeature feature;
+ feature.SetDelegate(1, &navigation_controller);
+ navigation_controller.SetNavigationFeatureForTesting(&feature);
+
+ EXPECT_CALL(delegate, OnNavigationStateChanged()).Times(1);
+
navigation_controller.LoadURL(kExampleURL);
EXPECT_EQ(kExampleURL, navigation_controller.GetURL());
+ EXPECT_CALL(feature, GoBack(_)).Times(1);
+ EXPECT_CALL(feature, GoForward(_)).Times(1);
+ EXPECT_CALL(feature, Reload(_)).Times(1);
+
+ navigation_controller.GoBack();
+ navigation_controller.GoForward();
+ navigation_controller.Reload();
+
loop.RunUntilIdle();
- EXPECT_EQ(kExampleURL, delegate.GetLastLoadedURL());
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698