Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(956)

Side by Side Diff: chrome/test/data/webui/chrome_send_browsertest.h

Issue 8515016: WebUI test framework: fix Mock4JS verification, allow chrome.send passthrough. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/webui/chrome_send_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_CHROME_SEND_BROWSERTEST_H_
5 #define CHROME_TEST_DATA_WEBUI_CHROME_SEND_BROWSERTEST_H_
6 #pragma once
7
8 #include "chrome/browser/ui/webui/web_ui_browsertest.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10
11 // Test fixture for testing chrome.send. This class registers the "checkSend"
12 // message, but should NOT receive it.
13 class ChromeSendWebUITest : public WebUIBrowserTest {
14 public:
15 ChromeSendWebUITest();
16 virtual ~ChromeSendWebUITest();
17
18 // Mocked message handler class to register expects using gmock framework.
19 class ChromeSendWebUIMessageHandler : public WebUIMessageHandler {
20 public:
21 ChromeSendWebUIMessageHandler();
22 ~ChromeSendWebUIMessageHandler();
23
24 MOCK_METHOD1(HandleCheckSend, void(const base::ListValue*));
25
26 private:
27 virtual void RegisterMessages() OVERRIDE;
28 };
29
30
31 protected:
32 // Strict mock will fail when unexpected chrome.send messages are received.
33 ::testing::StrictMock<ChromeSendWebUIMessageHandler> message_handler_;
34
35 private:
36 virtual WebUIMessageHandler* GetMockMessageHandler() OVERRIDE;
37
38 DISALLOW_COPY_AND_ASSIGN(ChromeSendWebUITest);
39 };
40
41 // Test fixture for verifying chrome.send messages are passed through. This
42 // class DOES expect to receive the "checkSend" message.
43 class ChromeSendPassthroughWebUITest : public ChromeSendWebUITest {
44 public:
45 ChromeSendPassthroughWebUITest();
46 virtual ~ChromeSendPassthroughWebUITest();
47
48 private:
49 virtual void SetUpOnMainThread() OVERRIDE;
50
51 DISALLOW_COPY_AND_ASSIGN(ChromeSendPassthroughWebUITest);
52 };
53
54 #endif // CHROME_TEST_DATA_WEBUI_CHROME_SEND_BROWSERTEST_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/webui/chrome_send_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698