Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / gpu / khronos_glcts_support / native / main.cc
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <cstdio>
6
7 #include "base/at_exit.h"
8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h"
10
11 #include "third_party/khronos_glcts/framework/common/tcuApp.hpp"
12 #include "third_party/khronos_glcts/framework/common/tcuCommandLine.hpp"
13 #include "third_party/khronos_glcts/framework/common/tcuDefs.hpp"
14 #include "third_party/khronos_glcts/framework/common/tcuPlatform.hpp"
15 #include "third_party/khronos_glcts/framework/common/tcuResource.hpp"
16 #include "third_party/khronos_glcts/framework/common/tcuTestLog.hpp"
17 #include "third_party/khronos_glcts/framework/delibs/decpp/deUniquePtr.hpp"
18
19 // implemented in the native platform
20 tcu::Platform* createPlatform ();
21
22 void GTFMain(int argc, char* argv[]) {
23   setvbuf(stdout, DE_NULL, _IOLBF, 4*1024);
24
25   try {
26     tcu::CommandLine cmdLine(argc, argv);
27     tcu::DirArchive archive(cmdLine.getArchiveDir());
28     tcu::TestLog log(cmdLine.getLogFileName(), cmdLine.getLogFlags());
29     de::UniquePtr<tcu::Platform> platform(createPlatform());
30     de::UniquePtr<tcu::App> app(
31       new tcu::App(*platform, archive, log, cmdLine));
32
33     // Main loop.
34     for (;;) {
35       if (!app->iterate())
36         break;
37     }
38   }
39   catch (const std::exception& e) {
40     tcu::die("%s", e.what());
41   }
42 }
43
44 int main(int argc, char *argv[]) {
45   base::AtExitManager at_exit;
46   CommandLine::Init(argc, argv);
47   base::MessageLoopForUI message_loop;
48
49   GTFMain(argc, argv);
50
51   return 0;
52 }