blob: 09f44b8f90156e7ab5dc32e4f1686e6fc78a385d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_H_
#define CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_H_
#include "base/memory/ref_counted.h"
#include "ui/gfx/native_widget_types.h"
#include "url/gurl.h"
namespace base {
class FilePath;
}
namespace gfx {
class Rect;
}
// A collections of functions designed for use with content_browsertests.
// Note: if a function here also works with browser_tests, it should be in
// content\public\test\browser_test_utils.h
namespace content {
class MessageLoopRunner;
class Shell;
// Generate the file path for testing a particular test.
// The file for the tests is all located in
// content/test/data/dir/<file>
// The returned path is FilePath format.
base::FilePath GetTestFilePath(const char* dir, const char* file);
// Generate the URL for testing a particular test.
// HTML for the tests is all located in
// test_root_directory/dir/<file>
// The returned path is GURL format.
GURL GetTestUrl(const char* dir, const char* file);
// Navigates the selected tab of |window| to |url|, blocking until the
// navigation finishes.
void NavigateToURL(Shell* window, const GURL& url);
// Navigates the selected tab of |window| to |url|, blocking until the given
// number of navigations finishes.
void NavigateToURLBlockUntilNavigationsComplete(Shell* window,
const GURL& url,
int number_of_navigations);
// Wait until an application modal dialog is requested.
void WaitForAppModalDialog(Shell* window);
// Used to wait for a new Shell window to be created. Instantiate this object
// before the operation that will create the window.
class ShellAddedObserver {
public:
ShellAddedObserver();
~ShellAddedObserver();
// Will run a message loop to wait for the new window if it hasn't been
// created since the constructor.
Shell* GetShell();
private:
void ShellCreated(Shell* shell);
Shell* shell_;
scoped_refptr<MessageLoopRunner> runner_;
DISALLOW_COPY_AND_ASSIGN(ShellAddedObserver);
};
#if defined OS_MACOSX
void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds);
#endif
} // namespace content
#endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_H_
|