1 // Copyright (c) 2011 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.
4 #ifndef CHROME_TEST_DATA_WEBUI_ASYNC_GEN_H_
5 #define CHROME_TEST_DATA_WEBUI_ASYNC_GEN_H_
7 #include "chrome/test/base/web_ui_browser_test.h"
8 #include "content/public/browser/web_ui_message_handler.h"
9 #include "testing/gmock/include/gmock/gmock.h"
15 // C++ support class for javascript-generated asynchronous tests.
16 class WebUIBrowserAsyncGenTest
: public WebUIBrowserTest
{
18 WebUIBrowserAsyncGenTest();
19 ~WebUIBrowserAsyncGenTest() override
;
22 class AsyncWebUIMessageHandler
: public content::WebUIMessageHandler
{
24 AsyncWebUIMessageHandler();
25 ~AsyncWebUIMessageHandler();
27 MOCK_METHOD1(HandleTearDown
, void(const base::ListValue
*));
30 void HandleCallJS(const base::ListValue
* list_value
);
32 // WebUIMessageHandler implementation.
33 void RegisterMessages() override
;
36 // Handler for this test fixture.
37 ::testing::StrictMock
<AsyncWebUIMessageHandler
> message_handler_
;
40 // Provide this object's handler.
41 content::WebUIMessageHandler
* GetMockMessageHandler() override
{
42 return &message_handler_
;
45 void SetUpOnMainThread() override
{
46 WebUIBrowserTest::SetUpOnMainThread();
47 EXPECT_CALL(message_handler_
, HandleTearDown(::testing::_
));
50 DISALLOW_COPY_AND_ASSIGN(WebUIBrowserAsyncGenTest
);
53 #endif // CHROME_TEST_DATA_WEBUI_ASYNC_GEN_H_