OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
6 #include "components/component_updater/update_response.h" | 6 #include "components/update_client/update_response.h" |
7 #include "libxml/globals.h" | 7 #include "libxml/globals.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace component_updater { | 10 namespace update_client { |
11 | 11 |
12 const char* kValidXml = | 12 const char* kValidXml = |
13 "<?xml version='1.0' encoding='UTF-8'?>" | 13 "<?xml version='1.0' encoding='UTF-8'?>" |
14 "<response protocol='3.0'>" | 14 "<response protocol='3.0'>" |
15 " <app appid='12345'>" | 15 " <app appid='12345'>" |
16 " <updatecheck status='ok'>" | 16 " <updatecheck status='ok'>" |
17 " <urls>" | 17 " <urls>" |
18 " <url codebase='http://example.com/'/>" | 18 " <url codebase='http://example.com/'/>" |
19 " <url codebasediff='http://diff.example.com/'/>" | 19 " <url codebasediff='http://diff.example.com/'/>" |
20 " </urls>" | 20 " </urls>" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 " <app appid='12345' status='ok'>" | 115 " <app appid='12345' status='ok'>" |
116 " <updatecheck codebase='http://example.com/extension_1.2.3.4.crx' " | 116 " <updatecheck codebase='http://example.com/extension_1.2.3.4.crx' " |
117 " version='1.2.3.a'/>" | 117 " version='1.2.3.a'/>" |
118 " </app>" | 118 " </app>" |
119 "</response>"; | 119 "</response>"; |
120 | 120 |
121 // The v3 version of the protocol is not using namespaces. However, the parser | 121 // The v3 version of the protocol is not using namespaces. However, the parser |
122 // must be able to parse responses that include namespaces. | 122 // must be able to parse responses that include namespaces. |
123 const char* kUsesNamespacePrefix = | 123 const char* kUsesNamespacePrefix = |
124 "<?xml version='1.0' encoding='UTF-8'?>" | 124 "<?xml version='1.0' encoding='UTF-8'?>" |
125 "<g:response xmlns:g='http://www.google.com/update2/response' protocol='3.0'
>" | 125 "<g:response xmlns:g='http://www.google.com/update2/response' " |
| 126 "protocol='3.0'>" |
126 " <g:app appid='12345'>" | 127 " <g:app appid='12345'>" |
127 " <g:updatecheck status='ok'>" | 128 " <g:updatecheck status='ok'>" |
128 " <g:urls>" | 129 " <g:urls>" |
129 " <g:url codebase='http://example.com/'/>" | 130 " <g:url codebase='http://example.com/'/>" |
130 " </g:urls>" | 131 " </g:urls>" |
131 " <g:manifest version='1.2.3.4' prodversionmin='2.0.143.0'>" | 132 " <g:manifest version='1.2.3.4' prodversionmin='2.0.143.0'>" |
132 " <g:packages>" | 133 " <g:packages>" |
133 " <g:package name='extension_1_2_3_4.crx'/>" | 134 " <g:package name='extension_1_2_3_4.crx'/>" |
134 " </g:packages>" | 135 " </g:packages>" |
135 " </g:manifest>" | 136 " </g:manifest>" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 EXPECT_EQ(firstResult->manifest.version, ""); | 292 EXPECT_EQ(firstResult->manifest.version, ""); |
292 | 293 |
293 // Parse xml with one error and one success <app> tag. | 294 // Parse xml with one error and one success <app> tag. |
294 EXPECT_TRUE(parser.Parse(kTwoAppsOneError)); | 295 EXPECT_TRUE(parser.Parse(kTwoAppsOneError)); |
295 EXPECT_FALSE(parser.errors().empty()); | 296 EXPECT_FALSE(parser.errors().empty()); |
296 EXPECT_EQ(1u, parser.results().list.size()); | 297 EXPECT_EQ(1u, parser.results().list.size()); |
297 firstResult = &parser.results().list[0]; | 298 firstResult = &parser.results().list[0]; |
298 EXPECT_EQ(firstResult->extension_id, "bbbbbbbb"); | 299 EXPECT_EQ(firstResult->extension_id, "bbbbbbbb"); |
299 } | 300 } |
300 | 301 |
301 } // namespace component_updater | 302 } // namespace update_client |
OLD | NEW |