Coverage for /Syzygy/sampler/sampler_app_unittest.cc

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%17170.C++test

Line-by-line coverage:

   1    :  // Copyright 2013 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  
  15    :  #include "syzygy/sampler/sampler_app.h"
  16    :  
  17    :  #include "base/files/scoped_temp_dir.h"
  18    :  #include "gtest/gtest.h"
  19    :  #include "syzygy/common/application.h"
  20    :  #include "syzygy/core/unittest_util.h"
  21    :  #include "syzygy/pe/unittest_util.h"
  22    :  
  23    :  namespace sampler {
  24    :  
  25    :  namespace {
  26    :  
  27    :  class TestSamplerApp : public SamplerApp {
  28    :   public:
  29    :    // TODO(chrisha): Expose internals for testing.
  30    :  };
  31    :  
  32    :  class SamplerAppTest : public testing::PELibUnitTest {
  33    :   public:
  34    :    typedef testing::PELibUnitTest Super;
  35    :    typedef common::Application<TestSamplerApp> TestApplication;
  36    :  
  37    :    SamplerAppTest()
  38    :        : cmd_line_(base::FilePath(L"sampler.exe")),
  39  E :          impl_(app_.implementation()) {
  40  E :    }
  41    :  
  42  E :    virtual void SetUp() OVERRIDE {
  43  E :      Super::SetUp();
  44    :  
  45    :      // Setup the IO streams.
  46  E :      ASSERT_NO_FATAL_FAILURE(CreateTemporaryDir(&temp_dir_));
  47  E :      stdin_path_ = temp_dir_.Append(L"NUL");
  48  E :      stdout_path_ = temp_dir_.Append(L"stdout.txt");
  49  E :      stderr_path_ = temp_dir_.Append(L"stderr.txt");
  50  E :      ASSERT_NO_FATAL_FAILURE(InitStreams(
  51    :          stdin_path_, stdout_path_, stderr_path_));
  52    :  
  53    :      // Point the application at the test's command-line and IO streams.
  54  E :      app_.set_command_line(&cmd_line_);
  55  E :      app_.set_in(in());
  56  E :      app_.set_out(out());
  57  E :      app_.set_err(err());
  58  E :    }
  59    :  
  60    :   protected:
  61    :    // The command line to be given to the application under test.
  62    :    CommandLine cmd_line_;
  63    :  
  64    :    // The application object under test.
  65    :    TestApplication app_;
  66    :  
  67    :    // A reference to the underlying application implementation for convenience.
  68    :    TestSamplerApp& impl_;
  69    :  
  70    :    // A temporary folder where all IO will be stored.
  71    :    base::FilePath temp_dir_;
  72    :  
  73    :    // @name File paths used for the standard IO streams.
  74    :    // @{
  75    :    base::FilePath stdin_path_;
  76    :    base::FilePath stdout_path_;
  77    :    base::FilePath stderr_path_;
  78    :    // @}
  79    :  };
  80    :  
  81    :  }  // namespace
  82    :  
  83  E :  TEST_F(SamplerAppTest, ParseCommandLineFails) {
  84  E :    ASSERT_FALSE(impl_.ParseCommandLine(&cmd_line_));
  85  E :  }
  86    :  
  87    :  }  // namespace sampler

Coverage information generated Thu Jul 04 09:34:53 2013.