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

Side by Side Diff: third_party/libaddressinput/chromium/chrome_metadata_source_unittest.cc

Issue 1169923009: Remove remaining use of the deprecated MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo. Created 5 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
« no previous file with comments | « storage/browser/blob/scoped_file.cc ('k') | ui/compositor/compositor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "third_party/libaddressinput/chromium/chrome_metadata_source.h" 5 #include "third_party/libaddressinput/chromium/chrome_metadata_source.h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "net/url_request/test_url_fetcher_factory.h" 8 #include "net/url_request/test_url_fetcher_factory.h"
9 #include "net/url_request/url_request_test_util.h" 9 #include "net/url_request/url_request_test_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace autofill { 12 namespace autofill {
13 13
14 static const char kFakeUrl[] = "https://example.com"; 14 static const char kFakeUrl[] = "https://example.com";
15 static const char kFakeInsecureUrl[] = "http://example.com"; 15 static const char kFakeInsecureUrl[] = "http://example.com";
16 16
17 class ChromeMetadataSourceTest : public testing::Test { 17 class ChromeMetadataSourceTest : public testing::Test {
18 public: 18 public:
19 ChromeMetadataSourceTest() 19 ChromeMetadataSourceTest()
20 : fake_factory_(&factory_), 20 : fake_factory_(&factory_),
21 success_(false) {} 21 success_(false) {}
22 virtual ~ChromeMetadataSourceTest() {} 22 virtual ~ChromeMetadataSourceTest() {}
23 23
24 protected: 24 protected:
25 // Sets the response for the download. 25 // Sets the response for the download.
26 void SetFakeResponse(const std::string& payload, net::HttpStatusCode code) { 26 void SetFakeResponse(const std::string& payload, net::HttpStatusCode code) {
27 fake_factory_.SetFakeResponse(url_, 27 fake_factory_.SetFakeResponse(url_,
28 payload, 28 payload,
29 code, 29 code,
30 net::URLRequestStatus::SUCCESS); 30 net::URLRequestStatus::SUCCESS);
31 } 31 }
32 32
33 // Kicks off the download. 33 // Kicks off the download.
34 void Get() { 34 void Get() {
35 scoped_refptr<net::TestURLRequestContextGetter> getter( 35 scoped_refptr<net::TestURLRequestContextGetter> getter(
36 new net::TestURLRequestContextGetter( 36 new net::TestURLRequestContextGetter(
37 base::MessageLoopProxy::current())); 37 base::ThreadTaskRunnerHandle::Get()));
38 ChromeMetadataSource impl(std::string(), getter.get()); 38 ChromeMetadataSource impl(std::string(), getter.get());
39 scoped_ptr< ::i18n::addressinput::Source::Callback> callback( 39 scoped_ptr< ::i18n::addressinput::Source::Callback> callback(
40 ::i18n::addressinput::BuildCallback( 40 ::i18n::addressinput::BuildCallback(
41 this, &ChromeMetadataSourceTest::OnDownloaded)); 41 this, &ChromeMetadataSourceTest::OnDownloaded));
42 impl.Get(url_.spec(), *callback); 42 impl.Get(url_.spec(), *callback);
43 base::MessageLoop::current()->RunUntilIdle(); 43 base::MessageLoop::current()->RunUntilIdle();
44 } 44 }
45 45
46 void set_url(const GURL& url) { url_ = url; } 46 void set_url(const GURL& url) { url_ = url; }
47 bool success() const { return success_; } 47 bool success() const { return success_; }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 TEST_F(ChromeMetadataSourceTest, RejectsInsecureScheme) { 91 TEST_F(ChromeMetadataSourceTest, RejectsInsecureScheme) {
92 const char kFakePayload[] = "ham hock"; 92 const char kFakePayload[] = "ham hock";
93 set_url(GURL(kFakeInsecureUrl)); 93 set_url(GURL(kFakeInsecureUrl));
94 SetFakeResponse(kFakePayload, net::HTTP_OK); 94 SetFakeResponse(kFakePayload, net::HTTP_OK);
95 Get(); 95 Get();
96 EXPECT_FALSE(success()); 96 EXPECT_FALSE(success());
97 EXPECT_TRUE(!has_data() || data().empty()); 97 EXPECT_TRUE(!has_data() || data().empty());
98 } 98 }
99 99
100 } // namespace autofill 100 } // namespace autofill
OLDNEW
« no previous file with comments | « storage/browser/blob/scoped_file.cc ('k') | ui/compositor/compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698