summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/mock_render_process.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-05 19:17:24 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-05 19:17:24 +0000
commit81a34415cb55543b8f8db86ee6872cd70cd24445 (patch)
tree6eaf45857f6a4a03d4f2ef55fe352b5bfe7bd233 /chrome/renderer/mock_render_process.h
parent52381d5530f56b905fb752e90e6ba24029eac199 (diff)
downloadchromium_src-81a34415cb55543b8f8db86ee6872cd70cd24445.zip
chromium_src-81a34415cb55543b8f8db86ee6872cd70cd24445.tar.gz
chromium_src-81a34415cb55543b8f8db86ee6872cd70cd24445.tar.bz2
Refactor the render widget unittest so it can be reused to create a render view
unit test. Change the mock render thread to save all IPC messages it is asked to send so that tests can verify that the correct ones were sent. There are some new functions that support this checking. Plumb the form state change notification through the render view so that we will correctly update the form state to the browser. Write two RenderView unit tests. One arbitrarily tests OnLoadAlternateHTMLText which I used as a testcase for my testing framework. The other tests the above form state change notification. I had to expose the timeout of this message through the RenderView API so that the test can change it. Review URL: http://codereview.chromium.org/16482 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/mock_render_process.h')
-rw-r--r--chrome/renderer/mock_render_process.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/renderer/mock_render_process.h b/chrome/renderer/mock_render_process.h
new file mode 100644
index 0000000..d7bd178
--- /dev/null
+++ b/chrome/renderer/mock_render_process.h
@@ -0,0 +1,25 @@
+// Copyright (c) 2008 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_RENDERER_MOCK_RENDER_PROCESS_H_
+#define CHROME_RENDERER_MOCK_RENDER_PROCESS_H_
+
+#include <string>
+
+#include "chrome/common/child_process.h"
+
+// This class is a trivial mock of the child process singleton. It is necessary
+// so we don't trip DCHECKs in ChildProcess::ReleaseProcess() when destroying
+// a render widget instance.
+class MockProcess : public ChildProcess {
+ public:
+ explicit MockProcess(const std::wstring& channel_name) {}
+ static void GlobalInit() {
+ ChildProcessFactory<MockProcess> factory;
+ ChildProcess::GlobalInit(L"dummy", &factory);
+ }
+};
+
+#endif // CHROME_RENDERER_MOCK_RENDER_PROCESS_H_
+