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

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: Put method definitions in same order as declarations, include gmock since it's used. 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_
flackr 2011/11/11 15:34:54 + #pragma once
Sheridan Rawlins 2011/11/11 17:04:51 Done.
6
7 #include "chrome/browser/ui/webui/web_ui_browsertest.h"
8 #include "testing/gmock/include/gmock/gmock.h"
9
10 // Test fixture for testing chrome.send. This class registers the "checkSend"
11 // message, but should NOT receive it.
12 class ChromeSendWebUITest : public WebUIBrowserTest {
13 public:
14 ChromeSendWebUITest();
15 virtual ~ChromeSendWebUITest();
16
17 // Mocked message handler class to register expects using gmock framework.
18 class ChromeSendWebUIMessageHandler : public WebUIMessageHandler {
19 public:
20 ChromeSendWebUIMessageHandler();
21 ~ChromeSendWebUIMessageHandler();
22
23 MOCK_METHOD1(HandleCheckSend, void(const base::ListValue*));
24
25 private:
26 virtual void RegisterMessages() OVERRIDE;
27 };
28
29
30 protected:
31 // Strict mock will fail when unexpected chrome.send messages are received.
32 ::testing::StrictMock<ChromeSendWebUIMessageHandler> message_handler_;
33
34 private:
35 virtual WebUIMessageHandler* GetMockMessageHandler() OVERRIDE;
36
37 DISALLOW_COPY_AND_ASSIGN(ChromeSendWebUITest);
38 };
39
40 // Test fixture for verifying chrome.send messages are passed through. This
41 // class DOES expect to receive the "checkSend" message.
42 class ChromeSendPassthroughWebUITest : public ChromeSendWebUITest {
43 public:
44 ChromeSendPassthroughWebUITest();
45 virtual ~ChromeSendPassthroughWebUITest();
46
47 private:
48 virtual void SetUpOnMainThread() OVERRIDE;
49
50 DISALLOW_COPY_AND_ASSIGN(ChromeSendPassthroughWebUITest);
51 };
52
53 #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