| Index: chrome/browser/instant/instant_test_utils.h
|
| diff --git a/chrome/browser/instant/instant_test_utils.h b/chrome/browser/instant/instant_test_utils.h
|
| index 60738b7e99ea0b40594d5393c62656b2e501705b..e09d27603f62d623820707ea3ca73822118f864d 100644
|
| --- a/chrome/browser/instant/instant_test_utils.h
|
| +++ b/chrome/browser/instant/instant_test_utils.h
|
| @@ -7,6 +7,8 @@
|
|
|
| #include <string>
|
|
|
| +#include "base/basictypes.h"
|
| +#include "base/compiler_specific.h"
|
| #include "base/run_loop.h"
|
| #include "chrome/browser/instant/instant_controller.h"
|
| #include "chrome/browser/instant/instant_overlay_model_observer.h"
|
| @@ -14,9 +16,17 @@
|
| #include "chrome/browser/ui/browser_instant_controller.h"
|
| #include "chrome/browser/ui/browser_window.h"
|
| #include "chrome/browser/ui/omnibox/location_bar.h"
|
| -#include "chrome/browser/ui/omnibox/omnibox_view.h"
|
| #include "chrome/common/search_types.h"
|
| -#include "chrome/test/base/in_process_browser_test.h"
|
| +#include "googleurl/src/gurl.h"
|
| +#include "net/test/test_server.h"
|
| +
|
| +class InstantController;
|
| +class InstantModel;
|
| +class OmniboxView;
|
| +
|
| +namespace content {
|
| +class WebContents;
|
| +};
|
|
|
| class InstantTestModelObserver : public InstantOverlayModelObserver {
|
| public:
|
| @@ -37,30 +47,39 @@ class InstantTestModelObserver : public InstantOverlayModelObserver {
|
| DISALLOW_COPY_AND_ASSIGN(InstantTestModelObserver);
|
| };
|
|
|
| -class InstantTestBase : public InProcessBrowserTest {
|
| - public:
|
| +// This utility class is meant to be used in a "mix-in" fashion, giving the
|
| +// derived test class additional Instant-related functionality.
|
| +class InstantTestBase {
|
| + protected:
|
| InstantTestBase()
|
| : https_test_server_(
|
| net::TestServer::TYPE_HTTPS,
|
| net::BaseTestServer::SSLOptions(),
|
| base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) {
|
| }
|
| + virtual ~InstantTestBase() {}
|
|
|
| protected:
|
| - void SetupInstant();
|
| + void SetupInstant(Browser* browser);
|
| + void Init(const GURL& instant_url);
|
|
|
| InstantController* instant() {
|
| - return browser()->instant_controller()->instant();
|
| + return browser_->instant_controller()->instant();
|
| }
|
|
|
| OmniboxView* omnibox() {
|
| - return browser()->window()->GetLocationBar()->GetLocationEntry();
|
| + return browser_->window()->GetLocationBar()->GetLocationEntry();
|
| }
|
|
|
| + const GURL& instant_url() const { return instant_url_; }
|
| +
|
| + net::TestServer& https_test_server() { return https_test_server_; }
|
| +
|
| void KillInstantRenderView();
|
|
|
| void FocusOmnibox();
|
| void FocusOmniboxAndWaitForInstantSupport();
|
| + void FocusOmniboxAndWaitForInstantExtendedSupport();
|
|
|
| void SetOmniboxText(const std::string& text);
|
| void SetOmniboxTextAndWaitForOverlayToShow(const std::string& text);
|
| @@ -80,10 +99,22 @@ class InstantTestBase : public InProcessBrowserTest {
|
| bool HasUserInputInProgress();
|
| bool HasTemporaryText();
|
|
|
| + // Loads a named image from url |image| from the given |rvh| host. |loaded|
|
| + // returns whether the image was able to load without error.
|
| + // The method returns true if the JavaScript executed cleanly.
|
| + bool LoadImage(content::RenderViewHost* rvh,
|
| + const std::string& image,
|
| + bool* loaded);
|
| +
|
| + private:
|
| GURL instant_url_;
|
|
|
| + Browser* browser_;
|
| +
|
| // HTTPS Testing server, started on demand.
|
| net::TestServer https_test_server_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(InstantTestBase);
|
| };
|
|
|
| #endif // CHROME_BROWSER_INSTANT_INSTANT_TEST_UTILS_H_
|
|
|