summaryrefslogtreecommitdiffstats
path: root/chrome/test/unit
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-04 02:26:56 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-04 02:26:56 +0000
commit5b088adf98cdd69d48500af0974c701cc3aa60a8 (patch)
tree8360b7785ff9a006a7092d5a334b4c33ccf667a5 /chrome/test/unit
parent806907a2790ade5b63daffad3e1ce2a0f43b32e2 (diff)
downloadchromium_src-5b088adf98cdd69d48500af0974c701cc3aa60a8.zip
chromium_src-5b088adf98cdd69d48500af0974c701cc3aa60a8.tar.gz
chromium_src-5b088adf98cdd69d48500af0974c701cc3aa60a8.tar.bz2
Call webkit init once for all chrome unit tests and move the only unittest
that was initting webkit itself to the browsertest harness where each test is expected to init webkit. Initting webkit is useful for two reasons: 1. It allows the use of some primitive webkit data types like WebString and WebSecurityOrigin. 2. Individual unittests should not be initting webkit on their own, initting it here ensures attempts to do so within an individual test will fail. BUG=52357 TEST=none Review URL: http://codereview.chromium.org/6291007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73743 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/unit')
-rw-r--r--chrome/test/unit/run_all_unittests.cc41
1 files changed, 39 insertions, 2 deletions
diff --git a/chrome/test/unit/run_all_unittests.cc b/chrome/test/unit/run_all_unittests.cc
index 5534dbe..3364306 100644
--- a/chrome/test/unit/run_all_unittests.cc
+++ b/chrome/test/unit/run_all_unittests.cc
@@ -1,9 +1,46 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 "chrome/test/unit/chrome_test_suite.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h"
+
+namespace {
+
+// A stubbed out webkit client impl.
+class UnitTestWebKitClient : public WebKit::WebKitClient {
+ public:
+ UnitTestWebKitClient() {
+ }
+};
+
+// A special test suite that also initializes webkit once for all unittests.
+// This is useful for two reasons:
+// 1. It allows the use of some primitive webkit data types like WebString.
+// 2. Individual unittests should not be initting webkit on their own, initting
+// it here ensures attempts to do so within an individual test will fail.
+class UnitTestTestSuite : public ChromeTestSuite {
+ public:
+ UnitTestTestSuite(int argc, char** argv)
+ : ChromeTestSuite(argc, argv) {
+ }
+
+ protected:
+ virtual void Initialize() {
+ WebKit::initialize(&webkitclient_);
+ ChromeTestSuite::Initialize();
+ }
+ virtual void Shutdown() {
+ ChromeTestSuite::Shutdown();
+ WebKit::shutdown();
+ }
+
+ UnitTestWebKitClient webkitclient_;
+};
+
+} // namespace
int main(int argc, char **argv) {
- return ChromeTestSuite(argc, argv).Run();
+ return UnitTestTestSuite(argc, argv).Run();
}