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

Side by Side Diff: chrome/browser/apps/app_browsertest_util.cc

Issue 2525563003: mash: Change CastConfigDelegate to a mojoified CastConfigClient. (Closed)
Patch Set: move dep to chromeos section 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/apps/app_browsertest_util.h" 5 #include "chrome/browser/apps/app_browsertest_util.h"
6 6
7 #include <memory>
8 #include <string>
9
7 #include "base/command_line.h" 10 #include "base/command_line.h"
8 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/extensions/api/tabs/tabs_api.h" 12 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
10 #include "chrome/browser/extensions/extension_function_test_utils.h" 13 #include "chrome/browser/extensions/extension_function_test_utils.h"
11 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 14 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
12 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/extensions/app_launch_params.h" 16 #include "chrome/browser/ui/extensions/app_launch_params.h"
14 #include "chrome/browser/ui/extensions/application_launch.h" 17 #include "chrome/browser/ui/extensions/application_launch.h"
15 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
16 #include "content/public/browser/notification_types.h" 19 #include "content/public/browser/notification_types.h"
17 #include "content/public/test/browser_test_utils.h" 20 #include "content/public/test/browser_test_utils.h"
18 #include "content/public/test/test_utils.h" 21 #include "content/public/test/test_utils.h"
19 #include "extensions/browser/app_window/app_window_contents.h" 22 #include "extensions/browser/app_window/app_window_contents.h"
20 #include "extensions/browser/app_window/app_window_registry.h" 23 #include "extensions/browser/app_window/app_window_registry.h"
21 #include "extensions/browser/app_window/native_app_window.h" 24 #include "extensions/browser/app_window/native_app_window.h"
22 #include "extensions/browser/process_manager.h" 25 #include "extensions/browser/process_manager.h"
23 #include "extensions/common/constants.h" 26 #include "extensions/common/constants.h"
24 #include "extensions/common/switches.h" 27 #include "extensions/common/switches.h"
25 #include "extensions/test/extension_test_message_listener.h" 28 #include "extensions/test/extension_test_message_listener.h"
26 29
30 #if defined(OS_CHROMEOS)
31 #include "chrome/browser/media/router/media_routes_observer.h"
32 #include "chrome/browser/ui/ash/cast_config_client_media_router.h"
33 #include "testing/gmock/include/gmock/gmock.h"
34 #endif
35
27 using content::WebContents; 36 using content::WebContents;
28 37
29 namespace { 38 namespace {
30 39
31 const char kAppWindowTestApp[] = "app_window/generic"; 40 const char kAppWindowTestApp[] = "app_window/generic";
32 41
33 } // namespace 42 } // namespace
34 43
35 namespace utils = extension_function_test_utils; 44 namespace utils = extension_function_test_utils;
36 45
37 namespace extensions { 46 namespace extensions {
38 47
39 PlatformAppBrowserTest::PlatformAppBrowserTest() { 48 PlatformAppBrowserTest::PlatformAppBrowserTest() {
40 ChromeAppDelegate::DisableExternalOpenForTesting(); 49 ChromeAppDelegate::DisableExternalOpenForTesting();
41 } 50 }
42 51
43 void PlatformAppBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { 52 void PlatformAppBrowserTest::SetUpCommandLine(base::CommandLine* command_line) {
44 // Skips ExtensionApiTest::SetUpCommandLine. 53 // Skips ExtensionApiTest::SetUpCommandLine.
45 ExtensionBrowserTest::SetUpCommandLine(command_line); 54 ExtensionBrowserTest::SetUpCommandLine(command_line);
46 55
47 // Make event pages get suspended quicker. 56 // Make event pages get suspended quicker.
48 ProcessManager::SetEventPageIdleTimeForTesting(1000); 57 ProcessManager::SetEventPageIdleTimeForTesting(1000);
49 ProcessManager::SetEventPageSuspendingTimeForTesting(1000); 58 ProcessManager::SetEventPageSuspendingTimeForTesting(1000);
50 } 59 }
51 60
61 void PlatformAppBrowserTest::SetUpInProcessBrowserTestFixture() {
62 ExtensionApiTest::SetUpInProcessBrowserTestFixture();
63 #if defined(OS_CHROMEOS)
64 // Mock the Media Router in extension api tests. Several of the
65 // PlatformAppBrowserTest suites call RunAllPendingInMessageLoop() when there
66 // are mojo messages that will call back into Profile creation through the
67 // media router.
68 ON_CALL(media_router_, RegisterMediaSinksObserver(testing::_))
69 .WillByDefault(testing::Return(true));
70
71 CastConfigClientMediaRouter::SetMediaRouterForTest(&media_router_);
72 #endif
73 }
74
75 void PlatformAppBrowserTest::TearDownInProcessBrowserTestFixture() {
76 #if defined(OS_CHROMEOS)
77 CastConfigClientMediaRouter::SetMediaRouterForTest(nullptr);
78 #endif
79 ExtensionApiTest::TearDownInProcessBrowserTestFixture();
80 }
81
52 // static 82 // static
53 AppWindow* PlatformAppBrowserTest::GetFirstAppWindowForBrowser( 83 AppWindow* PlatformAppBrowserTest::GetFirstAppWindowForBrowser(
54 Browser* browser) { 84 Browser* browser) {
55 AppWindowRegistry* app_registry = AppWindowRegistry::Get(browser->profile()); 85 AppWindowRegistry* app_registry = AppWindowRegistry::Get(browser->profile());
56 const AppWindowRegistry::AppWindowList& app_windows = 86 const AppWindowRegistry::AppWindowList& app_windows =
57 app_registry->app_windows(); 87 app_registry->app_windows();
58 88
59 AppWindowRegistry::const_iterator iter = app_windows.begin(); 89 AppWindowRegistry::const_iterator iter = app_windows.begin();
60 if (iter != app_windows.end()) 90 if (iter != app_windows.end())
61 return *iter; 91 return *iter;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 return app_window; 288 return app_window;
259 } 289 }
260 290
261 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( 291 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine(
262 base::CommandLine* command_line) { 292 base::CommandLine* command_line) {
263 PlatformAppBrowserTest::SetUpCommandLine(command_line); 293 PlatformAppBrowserTest::SetUpCommandLine(command_line);
264 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); 294 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
265 } 295 }
266 296
267 } // namespace extensions 297 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/apps/app_browsertest_util.h ('k') | chrome/browser/chrome_content_browser_manifest_overlay.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698