Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: src/heap/gc-idle-time-handler-unittest.cc

Issue 525193004: Merge heap unit tests into src. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/all.gyp ('k') | src/heap/heap.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/gc-idle-time-handler-unittest.cc
diff --git a/test/heap-unittests/heap-unittest.cc b/src/heap/gc-idle-time-handler-unittest.cc
similarity index 84%
rename from test/heap-unittests/heap-unittest.cc
rename to src/heap/gc-idle-time-handler-unittest.cc
index dd56f9dc3bb9fb9b263655e3e0f86309c253a550..b9989a8c46a1d689b977a7d80a7dfba4f71b8a30 100644
--- a/test/heap-unittests/heap-unittest.cc
+++ b/src/heap/gc-idle-time-handler-unittest.cc
@@ -2,15 +2,47 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "test/heap-unittests/heap-unittest.h"
-
#include <limits>
+#include "src/heap/gc-idle-time-handler.h"
+#include "testing/gtest/include/gtest/gtest.h"
namespace v8 {
namespace internal {
-TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeInitial) {
+namespace {
+
+class GCIdleTimeHandlerTest : public ::testing::Test {
+ public:
+ GCIdleTimeHandlerTest() {}
+ virtual ~GCIdleTimeHandlerTest() {}
+
+ GCIdleTimeHandler* handler() { return &handler_; }
+
+ GCIdleTimeHandler::HeapState DefaultHeapState() {
+ GCIdleTimeHandler::HeapState result;
+ result.contexts_disposed = 0;
+ result.size_of_objects = kSizeOfObjects;
+ result.incremental_marking_stopped = false;
+ result.can_start_incremental_marking = true;
+ result.sweeping_in_progress = false;
+ result.mark_compact_speed_in_bytes_per_ms = kMarkCompactSpeed;
+ result.incremental_marking_speed_in_bytes_per_ms = kMarkingSpeed;
+ return result;
+ }
+
+ static const size_t kSizeOfObjects = 100 * MB;
+ static const size_t kMarkCompactSpeed = 100 * KB;
+ static const size_t kMarkingSpeed = 100 * KB;
+
+ private:
+ GCIdleTimeHandler handler_;
+};
+
+} // namespace
+
+
+TEST(GCIdleTimeHandler, EstimateMarkingStepSizeInitial) {
size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(1, 0);
EXPECT_EQ(
static_cast<size_t>(GCIdleTimeHandler::kInitialConservativeMarkingSpeed *
@@ -19,7 +51,7 @@ TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeInitial) {
}
-TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeNonZero) {
+TEST(GCIdleTimeHandler, EstimateMarkingStepSizeNonZero) {
size_t marking_speed_in_bytes_per_millisecond = 100;
size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(
1, marking_speed_in_bytes_per_millisecond);
@@ -29,7 +61,7 @@ TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeNonZero) {
}
-TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeOverflow1) {
+TEST(GCIdleTimeHandler, EstimateMarkingStepSizeOverflow1) {
size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(
10, std::numeric_limits<size_t>::max());
EXPECT_EQ(static_cast<size_t>(GCIdleTimeHandler::kMaximumMarkingStepSize),
@@ -37,7 +69,7 @@ TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeOverflow1) {
}
-TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeOverflow2) {
+TEST(GCIdleTimeHandler, EstimateMarkingStepSizeOverflow2) {
size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(
std::numeric_limits<size_t>::max(), 10);
EXPECT_EQ(static_cast<size_t>(GCIdleTimeHandler::kMaximumMarkingStepSize),
@@ -45,7 +77,7 @@ TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeOverflow2) {
}
-TEST(EstimateMarkCompactTimeTest, EstimateMarkCompactTimeInitial) {
+TEST(GCIdleTimeHandler, EstimateMarkCompactTimeInitial) {
size_t size = 100 * MB;
size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, 0);
EXPECT_EQ(size / GCIdleTimeHandler::kInitialConservativeMarkCompactSpeed,
@@ -53,7 +85,7 @@ TEST(EstimateMarkCompactTimeTest, EstimateMarkCompactTimeInitial) {
}
-TEST(EstimateMarkCompactTimeTest, EstimateMarkCompactTimeNonZero) {
+TEST(GCIdleTimeHandler, EstimateMarkCompactTimeNonZero) {
size_t size = 100 * MB;
size_t speed = 10 * KB;
size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, speed);
@@ -61,7 +93,7 @@ TEST(EstimateMarkCompactTimeTest, EstimateMarkCompactTimeNonZero) {
}
-TEST(EstimateMarkCompactTimeTest, EstimateMarkCompactTimeMax) {
+TEST(GCIdleTimeHandler, EstimateMarkCompactTimeMax) {
size_t size = std::numeric_limits<size_t>::max();
size_t speed = 1;
size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, speed);
@@ -208,6 +240,5 @@ TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop2) {
EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
}
-
} // namespace internal
} // namespace v8
« no previous file with comments | « build/all.gyp ('k') | src/heap/heap.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698