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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/async_gen-inl.h
diff --git a/chrome/test/data/webui/async_gen-inl.h b/chrome/test/data/webui/async_gen-inl.h
new file mode 100644
index 0000000000000000000000000000000000000000..5abe7555882ebcb9a0cfd689e80ec5f38d650635
--- /dev/null
+++ b/chrome/test/data/webui/async_gen-inl.h
@@ -0,0 +1,53 @@
+// 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.
+
+#include "base/values.h"
+#include "chrome/browser/ui/webui/web_ui_browsertest.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+// C++ support class for javascript-generated asynchronous tests.
+class WebUIBrowserAsyncGenTest : public WebUIBrowserTest {
+ public:
+ WebUIBrowserAsyncGenTest();
+ virtual ~WebUIBrowserAsyncGenTest();
+
+ protected:
+ class AsyncWebUIMessageHandler : public WebUIMessageHandler {
+ public:
+ AsyncWebUIMessageHandler();
+ ~AsyncWebUIMessageHandler();
+
+ MOCK_METHOD1(HandleTornDown, void(const base::ListValue*));
+
+ private:
+ void HandleCallJS(const base::ListValue* list_value) {
+ std::string call_js;
+ ASSERT_TRUE(list_value->GetString(0, &call_js));
+ web_ui_->CallJavascriptFunction(call_js);
+ }
+
+ virtual void RegisterMessages() OVERRIDE {
+ web_ui_->RegisterMessageCallback("callJS", NewCallback(
+ this, &AsyncWebUIMessageHandler::HandleCallJS));
+ web_ui_->RegisterMessageCallback("tornDown", NewCallback(
+ this, &AsyncWebUIMessageHandler::HandleTornDown));
+ }
+ };
+
+ // Handler for this test fixture.
+ ::testing::StrictMock<AsyncWebUIMessageHandler> message_handler_;
+
+ private:
+ // Provide this object's handler.
+ virtual WebUIMessageHandler* GetMockMessageHandler() OVERRIDE {
+ return &message_handler_;
+ }
+
+ virtual void SetUpOnMainThread() OVERRIDE {
+ WebUIBrowserTest::SetUpOnMainThread();
+ EXPECT_CALL(message_handler_, HandleTornDown(::testing::_));
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(WebUIBrowserAsyncGenTest);
+};
« 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