Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: chrome/browser/intents/cws_intents_registry_unittest.cc

Issue 10581012: Move test_url_fetcher_factory.* from content/ to net/url_request (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove export annotations Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "content/public/test/test_url_fetcher_factory.h" 11 #include "net/url_request/test_url_fetcher_factory.h"
12 #include "net/url_request/url_request_test_util.h" 12 #include "net/url_request/url_request_test_util.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace { 15 namespace {
16 16
17 const char kCWSResponseInvalid[] = 17 const char kCWSResponseInvalid[] =
18 "{\"error\":{" 18 "{\"error\":{"
19 "\"errors\":[{" 19 "\"errors\":[{"
20 "\"domain\":\"global\"," 20 "\"domain\":\"global\","
21 "\"reason\":\"invalid\"," 21 "\"reason\":\"invalid\","
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 void SetFakeResponse(const std::string& action, const std::string& mime, 95 void SetFakeResponse(const std::string& action, const std::string& mime,
96 const std::string& response) { 96 const std::string& response) {
97 test_factory_.SetFakeResponse( 97 test_factory_.SetFakeResponse(
98 CWSIntentsRegistry::BuildQueryURL( 98 CWSIntentsRegistry::BuildQueryURL(
99 ASCIIToUTF16(action),ASCIIToUTF16(mime)).spec(), 99 ASCIIToUTF16(action),ASCIIToUTF16(mime)).spec(),
100 response, true); 100 response, true);
101 } 101 }
102 102
103 CWSIntentsRegistry::IntentExtensionList extensions_; 103 CWSIntentsRegistry::IntentExtensionList extensions_;
104 FakeURLFetcherFactory test_factory_; 104 net::FakeURLFetcherFactory test_factory_;
105 105
106 protected: 106 protected:
107 MessageLoop ui_loop_; 107 MessageLoop ui_loop_;
108 }; 108 };
109 109
110 } // namespace 110 } // namespace
111 111
112 TEST_F(CWSIntentsRegistryTest, ValidQuery) { 112 TEST_F(CWSIntentsRegistryTest, ValidQuery) {
113 const scoped_refptr<TestURLRequestContextGetter> context_getter( 113 const scoped_refptr<TestURLRequestContextGetter> context_getter(
114 new TestURLRequestContextGetter(ui_loop_.message_loop_proxy())); 114 new TestURLRequestContextGetter(ui_loop_.message_loop_proxy()));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 TEST_F(CWSIntentsRegistryTest, BuildQueryURL) { 151 TEST_F(CWSIntentsRegistryTest, BuildQueryURL) {
152 const std::string kExpectedURL = "https://www.googleapis.com" 152 const std::string kExpectedURL = "https://www.googleapis.com"
153 "/chromewebstore/v1.1b/items/intent" 153 "/chromewebstore/v1.1b/items/intent"
154 "?intent=action&mime_types=mime%2Ftype&start_index=0&num_results=15"; 154 "?intent=action&mime_types=mime%2Ftype&start_index=0&num_results=15";
155 GURL url = CWSIntentsRegistry::BuildQueryURL(ASCIIToUTF16("action"), 155 GURL url = CWSIntentsRegistry::BuildQueryURL(ASCIIToUTF16("action"),
156 ASCIIToUTF16("mime/type")); 156 ASCIIToUTF16("mime/type"));
157 157
158 EXPECT_EQ(kExpectedURL, url.spec().substr(0, kExpectedURL.size())); 158 EXPECT_EQ(kExpectedURL, url.spec().substr(0, kExpectedURL.size()));
159 } 159 }
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker_unittest.cc ('k') | chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698