summaryrefslogtreecommitdiffstats
path: root/mojo/shell/public/cpp/lib/application_test_main.cc
blob: 470846ce1d872ff97ca91c2473740c6fe24e1a64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/test/test_timeouts.h"
#include "mojo/logging/init_logging.h"
#include "mojo/public/c/system/main.h"
#include "mojo/shell/public/cpp/application_runner.h"
#include "mojo/shell/public/cpp/application_test_base.h"

MojoResult MojoMain(MojoHandle handle) {
  // An AtExitManager instance is needed to construct message loops.
  base::AtExitManager at_exit;

  // Initialize the current process Commandline and test timeouts.
  mojo::ApplicationRunner::InitBaseCommandLine();
  mojo::InitLogging();
  TestTimeouts::Initialize();

  return mojo::test::RunAllTests(handle);
}