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

Side by Side Diff: chrome/test/data/webui/async_gen-inl.h

Issue 7645007: WebUI Testing: async support - global mocking, deferred runs, continued run. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor comment fix. Created 9 years, 4 months 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/test/data/webui/async_gen.js ('k') | chrome/test/data/webui/options.js » ('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
5 #include "base/values.h"
6 #include "chrome/browser/ui/webui/web_ui_browsertest.h"
7 #include "testing/gmock/include/gmock/gmock.h"
8
9 // C++ support class for javascript-generated asynchronous tests.
10 class WebUIBrowserAsyncGenTest : public WebUIBrowserTest {
11 public:
12 WebUIBrowserAsyncGenTest();
13 virtual ~WebUIBrowserAsyncGenTest();
14
15 protected:
16 class AsyncWebUIMessageHandler : public WebUIMessageHandler {
17 public:
18 AsyncWebUIMessageHandler();
19 ~AsyncWebUIMessageHandler();
20
21 MOCK_METHOD1(HandleTornDown, void(const base::ListValue*));
22
23 private:
24 void HandleCallJS(const base::ListValue* list_value) {
25 std::string call_js;
26 ASSERT_TRUE(list_value->GetString(0, &call_js));
27 web_ui_->CallJavascriptFunction(call_js);
28 }
29
30 virtual void RegisterMessages() OVERRIDE {
31 web_ui_->RegisterMessageCallback("callJS", NewCallback(
32 this, &AsyncWebUIMessageHandler::HandleCallJS));
33 web_ui_->RegisterMessageCallback("tornDown", NewCallback(
34 this, &AsyncWebUIMessageHandler::HandleTornDown));
35 }
36 };
37
38 // Handler for this test fixture.
39 ::testing::StrictMock<AsyncWebUIMessageHandler> message_handler_;
40
41 private:
42 // Provide this object's handler.
43 virtual WebUIMessageHandler* GetMockMessageHandler() OVERRIDE {
44 return &message_handler_;
45 }
46
47 virtual void SetUpOnMainThread() OVERRIDE {
48 WebUIBrowserTest::SetUpOnMainThread();
49 EXPECT_CALL(message_handler_, HandleTornDown(::testing::_));
50 }
51
52 DISALLOW_COPY_AND_ASSIGN(WebUIBrowserAsyncGenTest);
53 };
OLDNEW
« no previous file with comments | « chrome/test/data/webui/async_gen.js ('k') | chrome/test/data/webui/options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698