fake_server_response.h 950 B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2020 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. #ifndef COMPONENTS_QUERY_TILES_TEST_FAKE_SERVER_RESPONSE_H_
  5. #define COMPONENTS_QUERY_TILES_TEST_FAKE_SERVER_RESPONSE_H_
  6. #include <memory>
  7. #include <string>
  8. #include "url/gurl.h"
  9. namespace query_tiles {
  10. // This class provides the necessary utilities that can be used to fake the
  11. // query tiles server interaction for using in tests.
  12. class FakeServerResponse {
  13. public:
  14. // Sets the query tile server endpoint to the given |url|.
  15. static void SetTileFetcherServerURL(const GURL& url);
  16. // Creates a fake server response proto, which has |levels| tiers, and each
  17. // tier has |tiles_per_level| tiles.
  18. static std::string CreateServerResponseProto(int levels, int tiles_per_level);
  19. };
  20. } // namespace query_tiles
  21. #endif // COMPONENTS_QUERY_TILES_TEST_FAKE_SERVER_RESPONSE_H_