1 // Copyright 2014 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_BROWSER_CHROMEOS_APP_MODE_FAKE_CWS_H_ 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_FAKE_CWS_H_ 7 8 #include "net/test/embedded_test_server/embedded_test_server.h" 9 #include "net/test/embedded_test_server/http_request.h" 10 #include "net/test/embedded_test_server/http_response.h" 11 #include "url/gurl.h" 12 13 namespace chromeos { 14 15 class FakeCWS { 16 public: 17 FakeCWS() {} 18 virtual ~FakeCWS() {} 19 20 void Init(net::test_server::EmbeddedTestServer* embedded_test_server); 21 // Sets up the kiosk app update response. 22 void SetUpdateCrx(const std::string& app_id, 23 const std::string& crx_file, 24 const std::string& version); 25 void SetNoUpdate(const std::string& app_id); 26 27 private: 28 void SetupWebStore(const GURL& test_server_url); 29 void SetupWebStoreGalleryUrl(); 30 void SetupCrxDownloadAndUpdateUrls( 31 net::test_server::EmbeddedTestServer* embedded_test_server); 32 void SetupCrxDownloadUrl(); 33 void SetupCrxUpdateUrl( 34 net::test_server::EmbeddedTestServer* embedded_test_server); 35 // Sets up |update_check_content_| used in update request response later by 36 // kiosk app update server request handler |HandleRequest|. 37 void SetUpdateCheckContent(const std::string& update_check_file, 38 const GURL& crx_download_url, 39 const std::string& app_id, 40 const std::string& crx_fp, 41 const std::string& crx_size, 42 const std::string& version, 43 std::string* update_check_content); 44 // Request handler for kiosk app update server. 45 scoped_ptr<net::test_server::HttpResponse> HandleRequest( 46 const net::test_server::HttpRequest& request); 47 48 GURL web_store_url_; 49 std::string update_check_content_; 50 51 DISALLOW_COPY_AND_ASSIGN(FakeCWS); 52 }; 53 54 } // namespace chromeos 55 56 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_FAKE_CWS_H_ 57