Home | History | Annotate | Download | only in perf
      1 // Copyright (c) 2012 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 "base/memory/scoped_ptr.h"
      6 #include "base/process/kill.h"
      7 #include "base/test/perf_test_suite.h"
      8 #include "base/threading/platform_thread.h"
      9 #include "chrome/common/chrome_paths.h"
     10 #include "chrome_frame/test/chrome_frame_test_utils.h"
     11 #include "chrome_frame/test_utils.h"
     12 #include "chrome_frame/utils.h"
     13 
     14 void PureCall() {
     15   __debugbreak();
     16 }
     17 
     18 int main(int argc, char **argv) {
     19   ScopedChromeFrameRegistrar::RegisterAndExitProcessIfDirected();
     20   base::PerfTestSuite perf_suite(argc, argv);
     21   base::PlatformThread::SetName("ChromeFrame perf tests");
     22 
     23   _set_purecall_handler(PureCall);
     24 
     25   SetConfigBool(kChromeFrameHeadlessMode, true);
     26   SetConfigBool(kChromeFrameUnpinnedMode, true);
     27 
     28   // Use ctor/raii to register the local Chrome Frame dll.
     29   scoped_ptr<ScopedChromeFrameRegistrar> registrar(
     30       new ScopedChromeFrameRegistrar(
     31           ScopedChromeFrameRegistrar::SYSTEM_LEVEL));
     32 
     33   base::ProcessHandle crash_service = chrome_frame_test::StartCrashService();
     34 
     35   int ret = perf_suite.Run();
     36 
     37   DeleteConfigValue(kChromeFrameHeadlessMode);
     38   DeleteConfigValue(kChromeFrameUnpinnedMode);
     39 
     40   if (crash_service)
     41     base::KillProcess(crash_service, 0, false);
     42   return ret;
     43 }
     44