Fix FtraceProcfsIntegrationTest.EnableDisableEvent

This test attempted to read back the trace while tracing
continued and relied being able to 'catch up' with the writer to
terminate. This did not always happen resulting in timeouts.

Modify the test to disable tracing before attempting to read back
the trace. Thanks to rsavitski@ for helping debug this.

Change-Id: I0a7610f01d1de62be21d6299d944b461fa795caf
diff --git a/src/traced/probes/ftrace/ftrace_procfs_integrationtest.cc b/src/traced/probes/ftrace/ftrace_procfs_integrationtest.cc
index b002581..7a80275 100644
--- a/src/traced/probes/ftrace/ftrace_procfs_integrationtest.cc
+++ b/src/traced/probes/ftrace/ftrace_procfs_integrationtest.cc
@@ -107,11 +107,12 @@
 }
 
 TEST_F(FtraceProcfsIntegrationTest, ANDROID_ONLY_TEST(EnableDisableEvent)) {
-  ftrace_->EnableEvent("sched", "sched_switch");
+  ASSERT_TRUE(ftrace_->EnableEvent("sched", "sched_switch"));
   sleep(1);
+  ASSERT_TRUE(ftrace_->DisableEvent("sched", "sched_switch"));
+
   EXPECT_THAT(GetTraceOutput(), HasSubstr("sched_switch"));
 
-  ftrace_->DisableEvent("sched", "sched_switch");
   ftrace_->ClearTrace();
   sleep(1);
   EXPECT_THAT(GetTraceOutput(), Not(HasSubstr("sched_switch")));
@@ -169,7 +170,6 @@
   EXPECT_EQ(ReadFile("buffer_size_kb"), "16\n");
   EXPECT_EQ(ReadFile("tracing_on"), "1\n");
   EXPECT_EQ(ReadFile("events/enable"), "X\n");
-  EXPECT_THAT(GetTraceOutput(), HasSubstr("Hello"));
 
   HardResetFtraceState();