Roll src/third_party/skia 5141d90:0e6ff38
[chromium-blink-merge.git] / chrome / test / media_router / media_router_integration_browsertest.h
blob0968b1278b3ea5bd5e463971e9d126f579ba628a
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_
6 #define CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_
8 #include <string>
10 #include "base/debug/stack_trace.h"
11 #include "base/files/file_path.h"
12 #include "chrome/browser/ui/toolbar/media_router_action.h"
13 #include "chrome/test/media_router/media_router_base_browsertest.h"
14 #include "content/public/test/browser_test_utils.h"
15 #include "content/public/test/test_navigation_observer.h"
18 namespace media_router {
20 class MediaRouter;
22 class MediaRouterIntegrationBrowserTest : public MediaRouterBaseBrowserTest {
23 public:
24 MediaRouterIntegrationBrowserTest();
25 ~MediaRouterIntegrationBrowserTest() override;
27 protected:
28 // InProcessBrowserTest Overrides
29 void TearDownOnMainThread() override;
31 // Simulate user action to choose one sink in the popup dialog.
32 // |web_contents|: The web contents of the test page which invokes the popup
33 // dialog.
34 // |sink_id|: The sink id.
35 // |current_route|: The JSON string which represents current route.
36 void ChooseSink(content::WebContents* web_contents,
37 const std::string& sink_id, const std::string& current_route);
39 // Execute javascript and check the return value.
40 static void ExecuteJavaScriptAPI(content::WebContents* web_contents,
41 const std::string& script);
43 static int ExecuteScriptAndExtractInt(
44 const content::ToRenderFrameHost& adapter,
45 const std::string& script);
47 static std::string ExecuteScriptAndExtractString(
48 const content::ToRenderFrameHost& adapter, const std::string& script);
50 // Get the chrome modal dialog.
51 // |web_contents|: The web contents of the test page which invokes the popup
52 // dialog.
53 content::WebContents* GetMRDialog(content::WebContents* web_contents);
55 void OpenTestPage(base::FilePath::StringPieceType file);
56 void OpenTestPageInNewTab(base::FilePath::StringPieceType file);
58 void SetTestData(base::FilePath::StringPieceType test_data_file);
60 // Start session and wait until the pop dialog shows up.
61 // |web_contents|: The web contents of the test page which invokes the popup
62 // dialog.
63 void StartSession(content::WebContents* web_contents);
65 // Open the chrome modal dialog.
66 // |web_contents|: The web contents of the test page which invokes the popup
67 // dialog.
68 content::WebContents* OpenMRDialog(content::WebContents* web_contents);
70 bool IsRouteCreatedOnUI();
72 void WaitUntilRouteCreated();
74 private:
75 // Get the full path of the resource file.
76 // |relative_path|: The relative path to
77 // <chromium src>/out/<build config>/media_router/
78 // browser_test_resources/
79 base::FilePath GetResourceFile(
80 base::FilePath::StringPieceType relative_path) const;
82 scoped_ptr<content::TestNavigationObserver> test_navigation_observer_;
85 } // namespace media_router
87 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_