blob: 795923447b370ce50f88adf0251fea4ee0216a5a (
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
|
// Copyright (c) 2011 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 CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_
#define CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_
#pragma once
#include "base/compiler_specific.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
class WebUI;
// For browser_tests, which run on the UI thread, run a second message
// MessageLoop to detect HtmlDialog creation and quit when the constructed
// WebUI instance is captured and ready.
class TestHtmlDialogObserver : public content::NotificationObserver {
public:
// Create and register a new TestHtmlDialogObserver.
TestHtmlDialogObserver();
virtual ~TestHtmlDialogObserver();
// Waits for an HtmlDialog to be created. The WebUI instance is captured
// and the method returns it when the navigation on the dialog is complete.
WebUI* GetWebUI();
private:
// content::NotificationObserver:
virtual void Observe(int type, const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
content::NotificationRegistrar registrar_;
WebUI* web_ui_;
bool done_;
bool running_;
DISALLOW_COPY_AND_ASSIGN(TestHtmlDialogObserver);
};
#endif // CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_
|