| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_TEST_V8_UNIT_TEST_H_ | 5 #ifndef CHROME_TEST_V8_UNIT_TEST_H_ |
| 6 #define CHROME_TEST_V8_UNIT_TEST_H_ | 6 #define CHROME_TEST_V8_UNIT_TEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/string_piece.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "v8/include/v8.h" | 11 #include "v8/include/v8.h" |
| 13 | 12 |
| 13 class StringPiece; |
| 14 |
| 14 // A superclass for unit tests that involve running JavaScript. This class | 15 // A superclass for unit tests that involve running JavaScript. This class |
| 15 // sets up V8 context and has methods that make it easy to execute scripts in | 16 // sets up V8 context and has methods that make it easy to execute scripts in |
| 16 // this context as well as call functions in the context. | 17 // this context as well as call functions in the context. |
| 17 class V8UnitTest : public testing::Test { | 18 class V8UnitTest : public testing::Test { |
| 18 public: | 19 public: |
| 19 V8UnitTest() {} | 20 V8UnitTest() {} |
| 20 virtual void SetUp(); | 21 virtual void SetUp(); |
| 21 | 22 |
| 22 protected: | 23 protected: |
| 23 // Executes the given script source in the context. The specified script | 24 // Executes the given script source in the context. The specified script |
| (...skipping 16 matching lines...) Expand all Loading... |
| 40 static v8::Handle<v8::Value> Log(const v8::Arguments& args); | 41 static v8::Handle<v8::Value> Log(const v8::Arguments& args); |
| 41 | 42 |
| 42 // Handle scope that is used throughout the life of this class. | 43 // Handle scope that is used throughout the life of this class. |
| 43 v8::HandleScope handle_scope_; | 44 v8::HandleScope handle_scope_; |
| 44 | 45 |
| 45 // Context for the JavaScript in the test. | 46 // Context for the JavaScript in the test. |
| 46 v8::Handle<v8::Context> context_; | 47 v8::Handle<v8::Context> context_; |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 #endif // CHROME_TEST_V8_UNIT_TEST_H_ | 50 #endif // CHROME_TEST_V8_UNIT_TEST_H_ |
| OLD | NEW |