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

Unified Diff: chrome_frame/test/net/test_automation_resource_message_filter.h

Issue 218019: Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 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
Index: chrome_frame/test/net/test_automation_resource_message_filter.h
===================================================================
--- chrome_frame/test/net/test_automation_resource_message_filter.h (revision 0)
+++ chrome_frame/test/net/test_automation_resource_message_filter.h (revision 0)
@@ -0,0 +1,50 @@
+// Copyright (c) 2009 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.
+#ifndef CHROME_FRAME_TEST_NET_TEST_AUTOMATION_RESOURCE_MESSAGE_FILTER_H_
+#define CHROME_FRAME_TEST_NET_TEST_AUTOMATION_RESOURCE_MESSAGE_FILTER_H_
+
+#include "chrome/browser/automation/automation_provider.h"
+#include "chrome/browser/automation/url_request_automation_job.h"
+
+// Performs the same duties as AutomationResourceMessageFilter but with one
+// difference. Instead of being tied to an IPC channel running on Chrome's
+// IO thread, this instance runs on the unit test's IO thread (all URL request
+// tests have their own IO loop) and is tied to an instance of
+// AutomationProvider (TestAutomationProvider to be exact).
+//
+// Messages from the AutomationProvider that are destined to request objects
+// owned by this class are marshaled over to the request's IO thread instead
+// of using the thread the messages are received on. This way we allow the
+// URL request tests to run sequentially as they were written while still
+// allowing the automation layer to work as it normally does (i.e. process
+// its messages on the receiving thread).
+class TestAutomationResourceMessageFilter
+ : public AutomationResourceMessageFilter {
+ public:
+ TestAutomationResourceMessageFilter(AutomationProvider* automation);
+
+ virtual bool Send(IPC::Message* message);
+
+ static void OnRequestMessage(URLRequestAutomationJob* job,
+ IPC::Message* msg);
+
+ virtual bool OnMessageReceived(const IPC::Message& message);
+
+ // Add request to the list of outstanding requests.
+ virtual bool RegisterRequest(URLRequestAutomationJob* job);
+ // Remove request from the list of outstanding requests.
+ virtual void UnRegisterRequest(URLRequestAutomationJob* job);
+
+ protected:
+ AutomationProvider* automation_;
+ // declare the request map.
+ struct RequestJob {
+ MessageLoop* loop_;
+ scoped_refptr<URLRequestAutomationJob> job_;
+ };
+ typedef std::map<int, RequestJob> RequestMap;
+ RequestMap requests_;
+};
+
+#endif // CHROME_FRAME_TEST_NET_TEST_AUTOMATION_RESOURCE_MESSAGE_FILTER_H_
« no previous file with comments | « chrome_frame/test/net/test_automation_provider.cc ('k') | chrome_frame/test/net/test_automation_resource_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698