OLD | NEW |
1 // Copyright (C) 2013 Google Inc. | 1 // Copyright (C) 2013 Google Inc. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return kData; | 65 return kData; |
66 } | 66 } |
67 | 67 |
68 } // namespace | 68 } // namespace |
69 | 69 |
70 FakeDownloader::FakeDownloader() {} | 70 FakeDownloader::FakeDownloader() {} |
71 | 71 |
72 FakeDownloader::~FakeDownloader() {} | 72 FakeDownloader::~FakeDownloader() {} |
73 | 73 |
74 void FakeDownloader::Download(const std::string& url, | 74 void FakeDownloader::Download(const std::string& url, |
75 scoped_ptr<Callback> downloaded) const { | 75 scoped_ptr<Callback> downloaded) { |
76 std::map<std::string, std::string>::const_iterator data_it = | 76 std::map<std::string, std::string>::const_iterator data_it = |
77 GetData().find(url); | 77 GetData().find(url); |
78 bool success = data_it != GetData().end(); | 78 bool success = data_it != GetData().end(); |
79 std::string data = success ? data_it->second : std::string(); | 79 std::string data = success ? data_it->second : std::string(); |
80 if (!success && GetLookupKeyUtil().IsValidationDataUrl(url)) { | 80 if (!success && GetLookupKeyUtil().IsValidationDataUrl(url)) { |
81 // URLs that start with "https://i18napis.appspot.com/ssl-address/" prefix, | 81 // URLs that start with "https://i18napis.appspot.com/ssl-address/" prefix, |
82 // but do not have associated data will always return "{}" with status code | 82 // but do not have associated data will always return "{}" with status code |
83 // 200. FakeDownloader imitates this behavior for URLs that start with | 83 // 200. FakeDownloader imitates this behavior for URLs that start with |
84 // "test:///" prefix. | 84 // "test:///" prefix. |
85 success = true; | 85 success = true; |
86 data = "{}"; | 86 data = "{}"; |
87 } | 87 } |
88 (*downloaded)(success, url, data); | 88 (*downloaded)(success, url, data); |
89 } | 89 } |
90 | 90 |
91 } // namespace addressinput | 91 } // namespace addressinput |
92 } // namespace i18n | 92 } // namespace i18n |
OLD | NEW |