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 "net/test/embedded_test_server/embedded_test_server.h" | 8 #include "net/test/embedded_test_server/embedded_test_server.h" |
9 #include "net/test/embedded_test_server/http_request.h" | 9 #include "net/test/embedded_test_server/http_request.h" |
10 #include "net/test/embedded_test_server/http_response.h" | 10 #include "net/test/embedded_test_server/http_response.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 class FakeCWS { | 15 class FakeCWS { |
16 public: | 16 public: |
17 FakeCWS() {} | 17 FakeCWS(); |
18 virtual ~FakeCWS() {} | 18 ~FakeCWS(); |
19 | 19 |
20 void Init(net::test_server::EmbeddedTestServer* embedded_test_server); | 20 void Init(net::test_server::EmbeddedTestServer* embedded_test_server); |
21 void InitAsPrivateStore( | |
22 net::test_server::EmbeddedTestServer* embedded_test_server, | |
23 const std::string& update_check_end_point); | |
24 | |
21 // Sets up the kiosk app update response. | 25 // Sets up the kiosk app update response. |
22 void SetUpdateCrx(const std::string& app_id, | 26 void SetUpdateCrx(const std::string& app_id, |
23 const std::string& crx_file, | 27 const std::string& crx_file, |
24 const std::string& version); | 28 const std::string& version); |
25 void SetNoUpdate(const std::string& app_id); | 29 void SetNoUpdate(const std::string& app_id); |
26 | 30 |
31 // Returns the current |update_check_count_| and resets it. | |
32 int GetUpdateCheckCountAndReset(); | |
33 | |
27 private: | 34 private: |
28 void SetupWebStore(const GURL& test_server_url); | 35 void SetupWebStoreURL(const GURL& test_server_url); |
29 void SetupWebStoreGalleryUrl(); | 36 void OverrideGallaryCommandlineSwitches(); |
Mattias Nissler (ping if slow)
2014/10/24 09:10:37
*Gallery
xiyuan
2014/10/25 17:45:26
Done.
| |
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 | 37 // Sets up |update_check_content_| used in update request response later by |
Mattias Nissler (ping if slow)
2014/10/24 09:10:37
nit: Blank line before comment
xiyuan
2014/10/25 17:45:26
Done.
| |
36 // kiosk app update server request handler |HandleRequest|. | 38 // kiosk app update server request handler |HandleRequest|. |
37 void SetUpdateCheckContent(const std::string& update_check_file, | 39 void SetUpdateCheckContent(const std::string& update_check_file, |
38 const GURL& crx_download_url, | 40 const GURL& crx_download_url, |
39 const std::string& app_id, | 41 const std::string& app_id, |
40 const std::string& crx_fp, | 42 const std::string& crx_fp, |
41 const std::string& crx_size, | 43 const std::string& crx_size, |
42 const std::string& version, | 44 const std::string& version, |
43 std::string* update_check_content); | 45 std::string* update_check_content); |
44 // Request handler for kiosk app update server. | 46 // Request handler for kiosk app update server. |
Mattias Nissler (ping if slow)
2014/10/24 09:10:37
ditto
xiyuan
2014/10/25 17:45:26
Done.
| |
45 scoped_ptr<net::test_server::HttpResponse> HandleRequest( | 47 scoped_ptr<net::test_server::HttpResponse> HandleRequest( |
46 const net::test_server::HttpRequest& request); | 48 const net::test_server::HttpRequest& request); |
47 | 49 |
48 GURL web_store_url_; | 50 GURL web_store_url_; |
51 | |
52 std::string has_update_template_; | |
53 std::string no_update_template_; | |
54 std::string update_check_end_point_; | |
55 | |
49 std::string update_check_content_; | 56 std::string update_check_content_; |
57 int update_check_count_; | |
50 | 58 |
51 DISALLOW_COPY_AND_ASSIGN(FakeCWS); | 59 DISALLOW_COPY_AND_ASSIGN(FakeCWS); |
52 }; | 60 }; |
53 | 61 |
54 } // namespace chromeos | 62 } // namespace chromeos |
55 | 63 |
56 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_FAKE_CWS_H_ | 64 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_FAKE_CWS_H_ |
OLD | NEW |