#include "base/test/test_timeouts.h"
#include "content/public/app/content_main.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
+#include "content/browser/tracing/tracing_controller_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/main_function_params.h"
#if defined(USE_AURA)
#include "content/browser/compositor/image_transport_factory.h"
+#include "ui/aura/test/event_generator_delegate_aura.h"
#if defined(USE_X11)
#include "ui/aura/window_tree_host_x11.h"
#endif
virtual ~LocalHostResolverProc() {}
};
+void TraceDisableRecordingComplete(const base::Closure& quit,
+ const base::FilePath& file_path) {
+ LOG(ERROR) << "Tracing written to: " << file_path.value();
+ quit.Run();
+}
+
} // namespace
extern int BrowserMain(const MainFunctionParams&);
base::mac::SetOverrideAmIBundled(true);
#endif
-#if defined(USE_AURA) && defined(USE_X11)
+#if defined(USE_AURA)
+#if defined(USE_X11)
aura::test::SetUseOverrideRedirectWindowByDefault(true);
#endif
+ aura::test::InitializeAuraEventGeneratorDelegate();
+#endif
#if defined(OS_POSIX)
handle_sigterm_ = true;
signal(SIGTERM, DumpStackTraceSignalHandler);
}
#endif // defined(OS_POSIX)
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableTracing)) {
+ base::debug::CategoryFilter category_filter(
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kEnableTracing));
+ TracingController::GetInstance()->EnableRecording(
+ category_filter,
+ base::debug::TraceOptions(base::debug::RECORD_CONTINUOUSLY),
+ TracingController::EnableRecordingDoneCallback());
+ }
+
RunTestOnMainThreadLoop();
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableTracing)) {
+ base::FilePath trace_file =
+ CommandLine::ForCurrentProcess()->GetSwitchValuePath(
+ switches::kEnableTracingOutput);
+ // If there was no file specified, put a hardcoded one in the current
+ // working directory.
+ if (trace_file.empty())
+ trace_file = base::FilePath().AppendASCII("trace.json");
+
+ // Wait for tracing to collect results from the renderers.
+ base::RunLoop run_loop;
+ TracingController::GetInstance()->DisableRecording(
+ TracingControllerImpl::CreateFileSink(
+ trace_file,
+ base::Bind(&TraceDisableRecordingComplete,
+ run_loop.QuitClosure(),
+ trace_file)));
+ run_loop.Run();
+ }
}
void BrowserTestBase::CreateTestServer(const base::FilePath& test_server_base) {
void BrowserTestBase::EnablePixelOutput() { enable_pixel_output_ = true; }
void BrowserTestBase::UseSoftwareCompositing() {
-#if !defined(USE_AURA) && !defined(OS_MACOSX)
- // TODO(danakj): Remove when GTK linux is no more.
- NOTREACHED();
-#endif
use_software_compositing_ = true;
}