Remove support for specifying version on command line.
[chromium-blink-merge.git] / content / test / content_browser_test_utils.h
blob09f44b8f90156e7ab5dc32e4f1686e6fc78a385d
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_TEST_CONTENT_BROWSER_TEST_UTILS_H_
6 #define CONTENT_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_browsertests.
21 // Note: if a function here also works with browser_tests, it should be in
22 // content\public\test\browser_test_utils.h
24 namespace content {
26 class MessageLoopRunner;
27 class Shell;
29 // Generate the file path for testing a particular test.
30 // The file for the tests is all located in
31 // content/test/data/dir/<file>
32 // The returned path is FilePath format.
33 base::FilePath GetTestFilePath(const char* dir, const char* file);
35 // Generate the URL for testing a particular test.
36 // HTML for the tests is all located in
37 // test_root_directory/dir/<file>
38 // The returned path is GURL format.
39 GURL GetTestUrl(const char* dir, const char* file);
41 // Navigates the selected tab of |window| to |url|, blocking until the
42 // navigation finishes.
43 void NavigateToURL(Shell* window, const GURL& url);
45 // Navigates the selected tab of |window| to |url|, blocking until the given
46 // number of navigations finishes.
47 void NavigateToURLBlockUntilNavigationsComplete(Shell* window,
48 const GURL& url,
49 int number_of_navigations);
51 // Wait until an application modal dialog is requested.
52 void WaitForAppModalDialog(Shell* window);
54 // Used to wait for a new Shell window to be created. Instantiate this object
55 // before the operation that will create the window.
56 class ShellAddedObserver {
57 public:
58 ShellAddedObserver();
59 ~ShellAddedObserver();
61 // Will run a message loop to wait for the new window if it hasn't been
62 // created since the constructor.
63 Shell* GetShell();
65 private:
66 void ShellCreated(Shell* shell);
68 Shell* shell_;
69 scoped_refptr<MessageLoopRunner> runner_;
71 DISALLOW_COPY_AND_ASSIGN(ShellAddedObserver);
74 #if defined OS_MACOSX
75 void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds);
76 #endif
78 } // namespace content
80 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_H_