blob: aa548ef901c8b079b5b967c5cd73919f723605ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// 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() {
}
virtual void cryptographicallyRandomValues(
unsigned char* buffer, size_t length) {
memset(buffer, 0, length);
}
};
// 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 UnitTestTestSuite(argc, argv).Run();
}
|