OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/intents/cws_intents_registry.h" | 5 #include "chrome/browser/intents/cws_intents_registry.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 "\"type\" : [\"text/plain\", \"image/jpg\"],\n \"path\" : " | 147 "\"type\" : [\"text/plain\", \"image/jpg\"],\n \"path\" : " |
148 "\"//services/share\",\n \"title\" : \"Sample sharing Intent\",\n" | 148 "\"//services/share\",\n \"title\" : \"Sample sharing Intent\",\n" |
149 " \"disposition\" : \"inline\"\n }\n }\n}\n"; | 149 " \"disposition\" : \"inline\"\n }\n }\n}\n"; |
150 | 150 |
151 const char kEditAction[] = "http://webintents.org/edit"; | 151 const char kEditAction[] = "http://webintents.org/edit"; |
152 const char kImagePngType[] = "image/png"; | 152 const char kImagePngType[] = "image/png"; |
153 | 153 |
154 class CWSIntentsRegistryTest : public testing::Test { | 154 class CWSIntentsRegistryTest : public testing::Test { |
155 public: | 155 public: |
156 virtual void SetUp() { | 156 virtual void SetUp() { |
157 scoped_refptr<TestURLRequestContextGetter> context_getter( | 157 scoped_refptr<net::TestURLRequestContextGetter> context_getter( |
158 new TestURLRequestContextGetter(ui_loop_.message_loop_proxy())); | 158 new net::TestURLRequestContextGetter(ui_loop_.message_loop_proxy())); |
159 registry_.reset(context_getter); | 159 registry_.reset(context_getter); |
160 } | 160 } |
161 | 161 |
162 virtual void TearDown() { | 162 virtual void TearDown() { |
163 // Pump messages posted by the main thread. | 163 // Pump messages posted by the main thread. |
164 ui_loop_.RunAllPending(); | 164 ui_loop_.RunAllPending(); |
165 } | 165 } |
166 | 166 |
167 CWSIntentsRegistry::IntentExtensionList WaitForResults() { | 167 CWSIntentsRegistry::IntentExtensionList WaitForResults() { |
168 ui_loop_.RunAllPending(); | 168 ui_loop_.RunAllPending(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // localization data exists. | 266 // localization data exists. |
267 response = kCWSResponseValidL10n; | 267 response = kCWSResponseValidL10n; |
268 response += kLocaleDataEn; | 268 response += kLocaleDataEn; |
269 response += kCWSResponseValidL10nPostfix; | 269 response += kCWSResponseValidL10nPostfix; |
270 extension_l10n_util::SetProcessLocale("de"); | 270 extension_l10n_util::SetProcessLocale("de"); |
271 RunRequest(kEditAction, kImagePngType, response); | 271 RunRequest(kEditAction, kImagePngType, response); |
272 ASSERT_EQ(1UL, extensions_.size()); | 272 ASSERT_EQ(1UL, extensions_.size()); |
273 EXPECT_EQ(std::string("__MSG_name__"), | 273 EXPECT_EQ(std::string("__MSG_name__"), |
274 UTF16ToUTF8(extensions_[0].name)); | 274 UTF16ToUTF8(extensions_[0].name)); |
275 } | 275 } |
OLD | NEW |