| OLD | NEW |
| (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 "chrome/test/unit/chrome_test_suite.h" | |
| 6 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | |
| 7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" | |
| 8 | |
| 9 namespace { | |
| 10 | |
| 11 // A stubbed out webkit client impl. | |
| 12 class UnitTestWebKitClient : public WebKit::WebKitClient { | |
| 13 public: | |
| 14 UnitTestWebKitClient() { | |
| 15 } | |
| 16 | |
| 17 virtual void cryptographicallyRandomValues( | |
| 18 unsigned char* buffer, size_t length) { | |
| 19 memset(buffer, 0, length); | |
| 20 } | |
| 21 }; | |
| 22 | |
| 23 // A special test suite that also initializes webkit once for all unittests. | |
| 24 // This is useful for two reasons: | |
| 25 // 1. It allows the use of some primitive webkit data types like WebString. | |
| 26 // 2. Individual unittests should not be initting webkit on their own, initting | |
| 27 // it here ensures attempts to do so within an individual test will fail. | |
| 28 class UnitTestTestSuite : public ChromeTestSuite { | |
| 29 public: | |
| 30 UnitTestTestSuite(int argc, char** argv) | |
| 31 : ChromeTestSuite(argc, argv) { | |
| 32 } | |
| 33 | |
| 34 protected: | |
| 35 virtual void Initialize() { | |
| 36 WebKit::initialize(&webkitclient_); | |
| 37 ChromeTestSuite::Initialize(); | |
| 38 } | |
| 39 virtual void Shutdown() { | |
| 40 ChromeTestSuite::Shutdown(); | |
| 41 WebKit::shutdown(); | |
| 42 } | |
| 43 | |
| 44 UnitTestWebKitClient webkitclient_; | |
| 45 }; | |
| 46 | |
| 47 } // namespace | |
| 48 | |
| 49 int main(int argc, char **argv) { | |
| 50 return UnitTestTestSuite(argc, argv).Run(); | |
| 51 } | |
| OLD | NEW |