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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/stringprintf.h" |
8 #include "chrome/browser/component_updater/test/test_configurator.h" | 9 #include "chrome/browser/component_updater/test/test_configurator.h" |
9 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
10 #include "url/gurl.h" | 11 #include "url/gurl.h" |
11 | 12 |
12 using content::BrowserThread; | 13 using content::BrowserThread; |
13 | 14 |
14 namespace component_updater { | 15 namespace component_updater { |
15 | 16 |
16 TestConfigurator::TestConfigurator() | 17 TestConfigurator::TestConfigurator() |
17 : initial_time_(0), | 18 : initial_time_(0), |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 60 |
60 GURL TestConfigurator::UpdateUrl() const { | 61 GURL TestConfigurator::UpdateUrl() const { |
61 return GURL(POST_INTERCEPT_SCHEME | 62 return GURL(POST_INTERCEPT_SCHEME |
62 "://" POST_INTERCEPT_HOSTNAME POST_INTERCEPT_PATH); | 63 "://" POST_INTERCEPT_HOSTNAME POST_INTERCEPT_PATH); |
63 } | 64 } |
64 | 65 |
65 GURL TestConfigurator::PingUrl() const { | 66 GURL TestConfigurator::PingUrl() const { |
66 return UpdateUrl(); | 67 return UpdateUrl(); |
67 } | 68 } |
68 | 69 |
| 70 base::Version TestConfigurator::ApplicationVersion() const { |
| 71 return base::Version("1.0"); |
| 72 } |
| 73 |
| 74 std::string TestConfigurator::PlatformRequestParams() const { |
| 75 return base::StringPrintf( |
| 76 "version=\"%s-%s\" prodversion=\"%s\" " |
| 77 "lang=\"%s\" updaterchannel=\"%s\" prodchannel=\"%s\" " |
| 78 "os=\"%s\" arch=\"%s\" nacl_arch=\"%s\"", |
| 79 "prodid", |
| 80 "1.0", // "version" |
| 81 "prodversion", // "prodversion" |
| 82 "fakelanguage", // "lang", |
| 83 "fakechannel", // "updaterchannel" |
| 84 "fakechannel", // "prodchannel" |
| 85 "fakeos", // "os" |
| 86 "fakearch", // "arch" |
| 87 "fakenacl_arch"); // "nacl_arch" |
| 88 } |
| 89 |
69 std::string TestConfigurator::ExtraRequestParams() const { | 90 std::string TestConfigurator::ExtraRequestParams() const { |
70 return "extra=\"foo\""; | 91 return "extra=\"foo\""; |
71 } | 92 } |
72 | 93 |
| 94 std::string TestConfigurator::RequestOSTag() const { |
| 95 return base::StringPrintf( |
| 96 "<os platform=\"%s\" version=\"%s\" arch=\"%s\"/>", |
| 97 "fake_platform", "fake_version", "fake_arch"); |
| 98 } |
| 99 |
73 size_t TestConfigurator::UrlSizeLimit() const { | 100 size_t TestConfigurator::UrlSizeLimit() const { |
74 return 256; | 101 return 256; |
75 } | 102 } |
76 | 103 |
77 net::URLRequestContextGetter* TestConfigurator::RequestContext() const { | 104 net::URLRequestContextGetter* TestConfigurator::RequestContext() const { |
78 return context_.get(); | 105 return context_.get(); |
79 } | 106 } |
80 | 107 |
81 // Don't use the utility process to run code out-of-process. | 108 // Don't use the utility process to run code out-of-process. |
82 bool TestConfigurator::InProcess() const { | 109 bool TestConfigurator::InProcess() const { |
(...skipping 23 matching lines...) Expand all Loading... |
106 | 133 |
107 void TestConfigurator::SetQuitClosure(const base::Closure& quit_closure) { | 134 void TestConfigurator::SetQuitClosure(const base::Closure& quit_closure) { |
108 quit_closure_ = quit_closure; | 135 quit_closure_ = quit_closure; |
109 } | 136 } |
110 | 137 |
111 void TestConfigurator::SetInitialDelay(int seconds) { | 138 void TestConfigurator::SetInitialDelay(int seconds) { |
112 initial_time_ = seconds; | 139 initial_time_ = seconds; |
113 } | 140 } |
114 | 141 |
115 } // namespace component_updater | 142 } // namespace component_updater |
OLD | NEW |