Coverage for /Syzygy/trace/service/session_trace_file_writer_factory.cc

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
88.9%16180.C++source

Line-by-line coverage:

   1    :  // Copyright 2012 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/trace/service/session_trace_file_writer_factory.h"
  16    :  
  17    :  #include "base/files/file_util.h"
  18    :  #include "base/message_loop/message_loop.h"
  19    :  #include "syzygy/trace/service/session_trace_file_writer.h"
  20    :  
  21    :  namespace trace {
  22    :  namespace service {
  23    :  
  24    :  SessionTraceFileWriterFactory::SessionTraceFileWriterFactory(
  25    :      base::MessageLoop* message_loop)
  26  E :      : message_loop_(message_loop), trace_file_directory_(L".") {
  27  E :    DCHECK(message_loop != NULL);
  28  E :    DCHECK_EQ(base::MessageLoop::TYPE_IO, message_loop->type());
  29  E :  }
  30    :  
  31    :  bool SessionTraceFileWriterFactory::SetTraceFileDirectory(
  32  E :      const base::FilePath& path) {
  33  E :    DCHECK(!path.empty());
  34  E :    if (!base::CreateDirectory(path)) {
  35  i :      LOG(ERROR) << "Failed to create trace file directory '" << path.value()
  36    :                 << "'.";
  37  i :      return false;
  38    :    }
  39    :  
  40  E :    trace_file_directory_ = path;
  41  E :    return true;
  42  E :  }
  43    :  
  44    :  bool SessionTraceFileWriterFactory::CreateConsumer(
  45  E :      scoped_refptr<BufferConsumer>* consumer) {
  46  E :    DCHECK(consumer != NULL);
  47  E :    DCHECK(message_loop_ != NULL);
  48    :  
  49    :    // Allocate a new trace file writer.
  50  E :    *consumer = new SessionTraceFileWriter(message_loop_, trace_file_directory_);
  51  E :    return true;
  52  E :  }
  53    :  
  54    :  }  // namespace service
  55    :  }  // namespace trace

Coverage information generated Fri Jul 29 11:00:21 2016.