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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 380763002: Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed memory leak found by Linux ASAN Created 6 years, 5 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 | « cc/scheduler/scheduler_state_machine_unittest.cc ('k') | cc/test/fake_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler_unittest.cc
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index aa61af73e884bde064647b08281406ca41df2511..f416cec008fabc87c04786e619bc2b1bb0ffea5d 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -6,6 +6,7 @@
#include <string>
#include <vector>
+#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_vector.h"
#include "base/message_loop/message_loop.h"
@@ -110,7 +111,7 @@ class FakeSchedulerClient : public SchedulerClient {
int num_draws() const { return num_draws_; }
int num_actions_() const { return static_cast<int>(actions_.size()); }
const char* Action(int i) const { return actions_[i]; }
- base::Value& StateForAction(int i) const { return *states_[i]; }
+ std::string StateForAction(int i) const { return states_[i]->ToString(); }
base::TimeTicks posted_begin_impl_frame_deadline() const {
return posted_begin_impl_frame_deadline_;
}
@@ -147,24 +148,24 @@ class FakeSchedulerClient : public SchedulerClient {
// SchedulerClient implementation.
virtual void SetNeedsBeginFrame(bool enable) OVERRIDE {
actions_.push_back("SetNeedsBeginFrame");
- states_.push_back(scheduler_->AsValue().release());
+ states_.push_back(scheduler_->AsValue());
needs_begin_frame_ = enable;
}
virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE {
actions_.push_back("WillBeginImplFrame");
- states_.push_back(scheduler_->AsValue().release());
+ states_.push_back(scheduler_->AsValue());
}
virtual void ScheduledActionSendBeginMainFrame() OVERRIDE {
actions_.push_back("ScheduledActionSendBeginMainFrame");
- states_.push_back(scheduler_->AsValue().release());
+ states_.push_back(scheduler_->AsValue());
}
virtual void ScheduledActionAnimate() OVERRIDE {
actions_.push_back("ScheduledActionAnimate");
- states_.push_back(scheduler_->AsValue().release());
+ states_.push_back(scheduler_->AsValue());
}
virtual DrawResult ScheduledActionDrawAndSwapIfPossible() OVERRIDE {
actions_.push_back("ScheduledActionDrawAndSwapIfPossible");
- states_.push_back(scheduler_->AsValue().release());
+ states_.push_back(scheduler_->AsValue());
num_draws_++;
DrawResult result =
draw_will_happen_ ? DRAW_SUCCESS : DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
@@ -186,30 +187,30 @@ class FakeSchedulerClient : public SchedulerClient {
}
virtual DrawResult ScheduledActionDrawAndSwapForced() OVERRIDE {
actions_.push_back("ScheduledActionDrawAndSwapForced");
- states_.push_back(scheduler_->AsValue().release());
+ states_.push_back(scheduler_->AsValue());
return DRAW_SUCCESS;
}
virtual void ScheduledActionCommit() OVERRIDE {
actions_.push_back("ScheduledActionCommit");
- states_.push_back(scheduler_->AsValue().release());
+ states_.push_back(scheduler_->AsValue());
}
virtual void ScheduledActionUpdateVisibleTiles() OVERRIDE {
actions_.push_back("ScheduledActionUpdateVisibleTiles");
- states_.push_back(scheduler_->AsValue().release());
+ states_.push_back(scheduler_->AsValue());
if (redraw_will_happen_if_update_visible_tiles_happens_)
scheduler_->SetNeedsRedraw();
}
virtual void ScheduledActionActivateSyncTree() OVERRIDE {
actions_.push_back("ScheduledActionActivateSyncTree");
- states_.push_back(scheduler_->AsValue().release());
+ states_.push_back(scheduler_->AsValue());
}
virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE {
actions_.push_back("ScheduledActionBeginOutputSurfaceCreation");
- states_.push_back(scheduler_->AsValue().release());
+ states_.push_back(scheduler_->AsValue());
}
virtual void ScheduledActionManageTiles() OVERRIDE {
actions_.push_back("ScheduledActionManageTiles");
- states_.push_back(scheduler_->AsValue().release());
+ states_.push_back(scheduler_->AsValue());
}
virtual void DidAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE {
if (log_anticipated_draw_time_change_)
@@ -238,7 +239,7 @@ class FakeSchedulerClient : public SchedulerClient {
bool redraw_will_happen_if_update_visible_tiles_happens_;
base::TimeTicks posted_begin_impl_frame_deadline_;
std::vector<const char*> actions_;
- ScopedVector<base::Value> states_;
+ std::vector<scoped_refptr<base::debug::ConvertableToTraceFormat> > states_;
scoped_ptr<TestScheduler> scheduler_;
scoped_refptr<OrderedSimpleTaskRunner> task_runner_;
};
@@ -1167,7 +1168,7 @@ TEST(SchedulerTest, PollForCommitCompletion) {
for (int i = 0; i < 3; ++i) {
EXPECT_EQ((frame_args.interval * 2).InMicroseconds(),
client.task_runner().NextPendingTaskDelay().InMicroseconds())
- << *scheduler->AsValue();
+ << scheduler->AsValue()->ToString();
client.task_runner().RunPendingTasks();
EXPECT_GT(client.num_actions_(), actions_so_far);
EXPECT_STREQ(client.Action(client.num_actions_() - 1),
@@ -1180,7 +1181,7 @@ TEST(SchedulerTest, PollForCommitCompletion) {
for (int i = 0; i < 3; ++i) {
EXPECT_EQ((frame_args.interval * 2).InMicroseconds(),
client.task_runner().NextPendingTaskDelay().InMicroseconds())
- << *scheduler->AsValue();
+ << scheduler->AsValue()->ToString();
client.task_runner().RunPendingTasks();
EXPECT_GT(client.num_actions_(), actions_so_far);
EXPECT_STREQ(client.Action(client.num_actions_() - 1),
« no previous file with comments | « cc/scheduler/scheduler_state_machine_unittest.cc ('k') | cc/test/fake_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698