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

Unified Diff: chrome/browser/apps/app_browsertest_util.cc

Issue 2525563003: mash: Change CastConfigDelegate to a mojoified CastConfigClient. (Closed)
Patch Set: Add more RunAllPendingInMessageLoop to the tray tests. Created 4 years 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/apps/app_browsertest_util.cc
diff --git a/chrome/browser/apps/app_browsertest_util.cc b/chrome/browser/apps/app_browsertest_util.cc
index c511f101c6241044c1d29a26f80464ec77e8f4fb..e30a5f24fd8fb06c70f3c63833f449935881f0f5 100644
--- a/chrome/browser/apps/app_browsertest_util.cc
+++ b/chrome/browser/apps/app_browsertest_util.cc
@@ -4,6 +4,9 @@
#include "chrome/browser/apps/app_browsertest_util.h"
+#include <memory>
+#include <string>
+
#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/api/tabs/tabs_api.h"
@@ -24,6 +27,12 @@
#include "extensions/common/switches.h"
#include "extensions/test/extension_test_message_listener.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/media/router/media_routes_observer.h"
+#include "chrome/browser/ui/ash/cast_config_client_media_router.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#endif
+
using content::WebContents;
namespace {
@@ -49,6 +58,27 @@ void PlatformAppBrowserTest::SetUpCommandLine(base::CommandLine* command_line) {
ProcessManager::SetEventPageSuspendingTimeForTesting(1000);
}
+void PlatformAppBrowserTest::SetUpInProcessBrowserTestFixture() {
+ ExtensionApiTest::SetUpInProcessBrowserTestFixture();
+#if defined(OS_CHROMEOS)
+ // Mock the Media Router in extension api tests. Several of the
+ // PlatformAppBrowserTest suites call RunAllPendingInMessageLoop() when there
+ // are mojo messages that will call back into Profile creation through the
+ // media router.
+ ON_CALL(media_router_, RegisterMediaSinksObserver(testing::_))
+ .WillByDefault(testing::Return(true));
+
+ CastConfigClientMediaRouter::SetMediaRouterForTest(&media_router_);
+#endif
+}
+
+void PlatformAppBrowserTest::TearDownInProcessBrowserTestFixture() {
+ ExtensionApiTest::TearDownInProcessBrowserTestFixture();
James Cook 2016/12/02 04:15:52 maybe do this after the SetMediaRouterForTest call
Elliot Glaysher 2016/12/02 19:23:11 Done.
+#if defined(OS_CHROMEOS)
+ CastConfigClientMediaRouter::SetMediaRouterForTest(nullptr);
+#endif
+}
+
// static
AppWindow* PlatformAppBrowserTest::GetFirstAppWindowForBrowser(
Browser* browser) {

Powered by Google App Engine
This is Rietveld 408576698