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

Unified Diff: chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc

Issue 1862913004: [Media Router] Wire through a new MRPM call to update media sinks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed (and simplified) tests. Created 4 years, 8 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: chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
index 9079344b26a021b1025ec9b62bd271a5dcf25f69..ae2e51a6d1ca7ab417ca1e66501bdd22846a993f 100644
--- a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
+++ b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
@@ -20,6 +20,7 @@
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/media/router/issue.h"
#include "chrome/browser/media/router/media_route.h"
+#include "chrome/browser/media/router/media_source_helper.h"
#include "chrome/browser/media/router/mock_media_router.h"
#include "chrome/browser/media/router/mojo/media_router_mojo_metrics.h"
#include "chrome/browser/media/router/mojo/media_router_mojo_test.h"
@@ -1524,4 +1525,31 @@ TEST_F(MediaRouterMojoExtensionTest, EnableMdnsAfterEachRegister) {
}
#endif
+TEST_F(MediaRouterMojoExtensionTest, UpdateMediaSinksOnUserGesture) {
+ BindMediaRouteProvider();
+
+ base::RunLoop run_loop;
+ EXPECT_CALL(provide_handler_, Invoke(testing::Not("")))
+ .WillOnce(InvokeWithoutArgs([&run_loop]() {
+ run_loop.Quit();
+ }));
+ // Called once for registration, and once for the user gesture.
+ EXPECT_CALL(*process_manager_, IsEventPageSuspended(extension_->id()))
+ .WillOnce(Return(false)).WillOnce(Return(false));
+ RegisterMediaRouteProvider();
+ run_loop.Run();
+
+ media_router_->OnUserGesture();
+
+ base::RunLoop run_loop2;
+
+ EXPECT_CALL(mock_media_route_provider_,
+ UpdateMediaSinks(mojo::String(MediaSourceForDesktop().id())))
+ .WillOnce(InvokeWithoutArgs([&run_loop2]() {
+ run_loop2.Quit();
+ }));
+
+ run_loop2.Run();
+}
+
} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698