Make sure webrtc::VideoSourceInterface is released on the main render thread.
[chromium-blink-merge.git] / content / public / test / content_browser_test_utils.h
blob8c6d7bdc364467f5f1bbee8fb989eea1f23aa7e6
1 // Copyright (c) 2012 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 CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_
6 #define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_
8 #include "base/memory/ref_counted.h"
9 #include "ui/gfx/native_widget_types.h"
10 #include "url/gurl.h"
12 namespace base {
13 class FilePath;
16 namespace gfx {
17 class Rect;
20 // A collections of functions designed for use with content_shell based browser
21 // tests.
22 // Note: if a function here also works with browser_tests, it should be in
23 // content\public\test\browser_test_utils.h
25 namespace content {
27 class MessageLoopRunner;
28 class Shell;
30 // Generate the file path for testing a particular test.
31 // The file for the tests is all located in
32 // content/test/data/dir/<file>
33 // The returned path is FilePath format.
34 base::FilePath GetTestFilePath(const char* dir, const char* file);
36 // Generate the URL for testing a particular test.
37 // HTML for the tests is all located in
38 // test_root_directory/dir/<file>
39 // The returned path is GURL format.
40 GURL GetTestUrl(const char* dir, const char* file);
42 // Navigates the selected tab of |window| to |url|, blocking until the
43 // navigation finishes.
44 void NavigateToURL(Shell* window, const GURL& url);
45 void LoadDataWithBaseURL(Shell* window,
46 const GURL& url,
47 const std::string data,
48 const GURL& base_url);
50 // Navigates the selected tab of |window| to |url|, blocking until the given
51 // number of navigations finishes.
52 void NavigateToURLBlockUntilNavigationsComplete(Shell* window,
53 const GURL& url,
54 int number_of_navigations);
56 // Wait until an application modal dialog is requested.
57 void WaitForAppModalDialog(Shell* window);
59 // Used to wait for a new Shell window to be created. Instantiate this object
60 // before the operation that will create the window.
61 class ShellAddedObserver {
62 public:
63 ShellAddedObserver();
64 ~ShellAddedObserver();
66 // Will run a message loop to wait for the new window if it hasn't been
67 // created since the constructor.
68 Shell* GetShell();
70 private:
71 void ShellCreated(Shell* shell);
73 Shell* shell_;
74 scoped_refptr<MessageLoopRunner> runner_;
76 DISALLOW_COPY_AND_ASSIGN(ShellAddedObserver);
79 #if defined OS_MACOSX
80 void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds);
81 #endif
83 } // namespace content
85 #endif // CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_