1 // Copyright 2018 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 #ifndef CHROME_CHROME_CLEANER_TEST_TEST_COMPONENT_H_ 6 #define CHROME_CHROME_CLEANER_TEST_TEST_COMPONENT_H_ 7 8 #include <vector> 9 10 #include "chrome/chrome_cleaner/components/component_api.h" 11 12 namespace chrome_cleaner { 13 14 class TestComponent : public ComponentAPI { 15 public: 16 struct Calls { 17 Calls(); 18 ~Calls(); 19 20 bool pre_scan = false; 21 bool post_scan = false; 22 bool pre_cleanup = false; 23 bool post_cleanup = false; 24 bool post_validation = false; 25 bool on_close = false; 26 bool destroyed = false; 27 std::vector<UwSId> post_scan_found_pups; 28 ResultCode result_code = RESULT_CODE_INVALID; 29 }; 30 TestComponent(Calls * calls)31 explicit TestComponent(Calls* calls) : calls_(calls) {} 32 ~TestComponent() override; 33 34 // ComponentAPI. 35 void PreScan() override; 36 void PostScan(const std::vector<UwSId>& found_pups) override; 37 void PreCleanup() override; 38 void PostCleanup(ResultCode result_code, RebooterAPI* rebooter) override; 39 void PostValidation(ResultCode result_code) override; 40 void OnClose(ResultCode result_code) override; 41 42 private: 43 Calls* calls_; 44 }; 45 46 } // namespace chrome_cleaner 47 48 #endif // CHROME_CHROME_CLEANER_TEST_TEST_COMPONENT_H_ 49