1 // Copyright 2020 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef TESTING_EMBEDDER_TEST_ENVIRONMENT_H_ 6 #define TESTING_EMBEDDER_TEST_ENVIRONMENT_H_ 7 8 #include <string> 9 10 #include "public/fpdfview.h" 11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/test_fonts.h" 13 14 class EmbedderTestEnvironment : public testing::Environment { 15 public: 16 EmbedderTestEnvironment(); 17 ~EmbedderTestEnvironment() override; 18 19 // Note: GetInstance() does not create one if it does not exist, 20 // so the main program must explicitly add this enviroment. 21 static EmbedderTestEnvironment* GetInstance(); 22 23 // testing::Environment: 24 void SetUp() override; 25 void TearDown() override; 26 27 void AddFlags(int argc, char** argv); 28 write_pngs()29 bool write_pngs() const { return write_pngs_; } 30 31 private: 32 void AddFlag(const std::string& flag); 33 34 FPDF_RENDERER_TYPE renderer_type_; 35 bool write_pngs_ = false; 36 TestFonts test_fonts_; 37 }; 38 39 #endif // TESTING_EMBEDDER_TEST_ENVIRONMENT_H_ 40