| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_FAKE_CWS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_FAKE_CWS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_FAKE_CWS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_FAKE_CWS_H_ |
| 7 | 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 8 #include "net/test/embedded_test_server/embedded_test_server.h" | 12 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 9 #include "net/test/embedded_test_server/http_request.h" | 13 #include "net/test/embedded_test_server/http_request.h" |
| 10 #include "net/test/embedded_test_server/http_response.h" | 14 #include "net/test/embedded_test_server/http_response.h" |
| 11 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 12 | 16 |
| 13 namespace chromeos { | 17 namespace chromeos { |
| 14 | 18 |
| 15 // Simple fake CWS update check request handler that returns a fixed update | 19 // Simple fake CWS update check request handler that returns a fixed update |
| 16 // check response. The response is created either from SetUpdateCrx() or | 20 // check response. The response is created either from SetUpdateCrx() or |
| 17 // SetNoUpdate(). | 21 // SetNoUpdate(). |
| (...skipping 22 matching lines...) Expand all Loading... |
| 40 // Sets up the update check response with no_update template. | 44 // Sets up the update check response with no_update template. |
| 41 void SetNoUpdate(const std::string& app_id); | 45 void SetNoUpdate(const std::string& app_id); |
| 42 | 46 |
| 43 // Returns the current |update_check_count_| and resets it. | 47 // Returns the current |update_check_count_| and resets it. |
| 44 int GetUpdateCheckCountAndReset(); | 48 int GetUpdateCheckCountAndReset(); |
| 45 | 49 |
| 46 private: | 50 private: |
| 47 void SetupWebStoreURL(const GURL& test_server_url); | 51 void SetupWebStoreURL(const GURL& test_server_url); |
| 48 void OverrideGalleryCommandlineSwitches(); | 52 void OverrideGalleryCommandlineSwitches(); |
| 49 | 53 |
| 50 // Sets up |update_check_content_| used in update request response later by | 54 bool GetUpdateCheckContent(const std::vector<std::string>& ids, |
| 51 // kiosk app update server request handler |HandleRequest|. | |
| 52 void SetUpdateCheckContent(const std::string& update_check_file, | |
| 53 const GURL& crx_download_url, | |
| 54 const std::string& app_id, | |
| 55 const std::string& crx_fp, | |
| 56 const std::string& crx_size, | |
| 57 const std::string& version, | |
| 58 std::string* update_check_content); | 55 std::string* update_check_content); |
| 59 | 56 |
| 60 // Request handler for kiosk app update server. | 57 // Request handler for kiosk app update server. |
| 61 scoped_ptr<net::test_server::HttpResponse> HandleRequest( | 58 scoped_ptr<net::test_server::HttpResponse> HandleRequest( |
| 62 const net::test_server::HttpRequest& request); | 59 const net::test_server::HttpRequest& request); |
| 63 | 60 |
| 64 GURL web_store_url_; | 61 GURL web_store_url_; |
| 65 | 62 |
| 66 std::string has_update_template_; | 63 std::string has_update_template_; |
| 67 std::string no_update_template_; | 64 std::string no_update_template_; |
| 68 std::string update_check_end_point_; | 65 std::string update_check_end_point_; |
| 69 | 66 |
| 70 std::string update_check_content_; | 67 // Map keyed by app_id to app_update_content. |
| 68 std::map<std::string, std::string> id_to_update_check_content_map_; |
| 71 int update_check_count_; | 69 int update_check_count_; |
| 72 | 70 |
| 73 DISALLOW_COPY_AND_ASSIGN(FakeCWS); | 71 DISALLOW_COPY_AND_ASSIGN(FakeCWS); |
| 74 }; | 72 }; |
| 75 | 73 |
| 76 } // namespace chromeos | 74 } // namespace chromeos |
| 77 | 75 |
| 78 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_FAKE_CWS_H_ | 76 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_FAKE_CWS_H_ |
| OLD | NEW |