Commit 667d1905 authored by Marshall Greenblatt's avatar Marshall Greenblatt
Browse files

Fix TracingTest failures (issue #2583)

parent bf51cd21
......@@ -78,31 +78,35 @@ class TracingTestHandler : public CefEndTracingCallback,
completion_event_ = CefWaitableEvent::CreateWaitableEvent(true, false);
}
void ReadTracingFile(const std::string& file_path) {
EXPECT_FILE_THREAD();
void ExecuteTest() {
// Run the test.
CefPostTask(TID_UI, base::Bind(&TracingTestHandler::BeginTracing, this));
EXPECT_TRUE(client::file_util::ReadFileToString(file_path, &trace_data_));
EXPECT_TRUE(CefDeleteFile(file_path, false));
// Wait for the test to complete.
completion_event_->Wait();
completion_event_->Signal();
// Verify the results.
EXPECT_TRUE(!trace_data_.empty());
EXPECT_TRUE(trace_type_ != NULL);
EXPECT_TRUE(strstr(trace_data_.c_str(), trace_type_) != NULL);
}
// CefEndTracingCallback method:
void OnEndTracingComplete(const CefString& tracing_file) override {
void BeginTracing() {
EXPECT_UI_THREAD();
CefPostTask(TID_FILE, base::Bind(&TracingTestHandler::ReadTracingFile, this,
tracing_file));
// Results in a call to OnComplete.
CefBeginTracing(kTraceTestCategory, this);
}
void RunTracing() {
void OnComplete() override {
EXPECT_UI_THREAD();
// Results in a call to OnComplete.
CefBeginTracing(kTraceTestCategory, this);
// Add some delay to avoid timing-related test failures.
CefPostDelayedTask(TID_UI,
base::Bind(&TracingTestHandler::TestTracing, this), 50);
}
void OnComplete() override {
void TestTracing() {
EXPECT_UI_THREAD();
switch (type_) {
......@@ -311,17 +315,20 @@ class TracingTestHandler : public CefEndTracingCallback,
CefEndTracing(CefString(), this);
}
void ExecuteTest() {
// Run the test.
CefPostTask(TID_UI, base::Bind(&TracingTestHandler::RunTracing, this));
void OnEndTracingComplete(const CefString& tracing_file) override {
EXPECT_UI_THREAD();
// Wait for the test to complete.
completion_event_->Wait();
CefPostTask(TID_FILE, base::Bind(&TracingTestHandler::ReadTracingFile, this,
tracing_file));
}
// Verify the results.
EXPECT_TRUE(!trace_data_.empty());
EXPECT_TRUE(trace_type_ != NULL);
EXPECT_TRUE(strstr(trace_data_.c_str(), trace_type_) != NULL);
void ReadTracingFile(const std::string& file_path) {
EXPECT_FILE_THREAD();
EXPECT_TRUE(client::file_util::ReadFileToString(file_path, &trace_data_));
EXPECT_TRUE(CefDeleteFile(file_path, false));
completion_event_->Signal();
}
private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment