OLD | NEW |
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 "components/domain_reliability/uploader.h" | 5 #include "components/domain_reliability/uploader.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "components/domain_reliability/test_util.h" | 12 #include "components/domain_reliability/test_util.h" |
13 #include "content/public/test/test_browser_thread_bundle.h" | 13 #include "content/public/test/test_browser_thread_bundle.h" |
14 #include "net/url_request/test_url_fetcher_factory.h" | 14 #include "net/url_request/test_url_fetcher_factory.h" |
15 #include "net/url_request/url_fetcher_delegate.h" | 15 #include "net/url_request/url_fetcher_delegate.h" |
16 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
17 #include "net/url_request/url_request_test_util.h" | 17 #include "net/url_request/url_request_test_util.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 namespace domain_reliability { | 20 namespace domain_reliability { |
| 21 namespace { |
21 | 22 |
22 class DomainReliabilityUploaderTest : public testing::Test { | 23 class DomainReliabilityUploaderTest : public testing::Test { |
23 protected: | 24 protected: |
24 DomainReliabilityUploaderTest() | 25 DomainReliabilityUploaderTest() |
25 : test_browser_thread_bundle_( | 26 : test_browser_thread_bundle_( |
26 content::TestBrowserThreadBundle::IO_MAINLOOP), | 27 content::TestBrowserThreadBundle::IO_MAINLOOP), |
27 url_request_context_getter_(new net::TestURLRequestContextGetter( | 28 url_request_context_getter_(new net::TestURLRequestContextGetter( |
28 base::MessageLoopProxy::current())), | 29 base::MessageLoopProxy::current())), |
29 uploader_(DomainReliabilityUploader::Create( | 30 uploader_(DomainReliabilityUploader::Create( |
30 url_request_context_getter_)) {} | 31 url_request_context_getter_)) {} |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 fetcher->set_status(net::URLRequestStatus()); | 99 fetcher->set_status(net::URLRequestStatus()); |
99 fetcher->set_response_code(500); | 100 fetcher->set_response_code(500); |
100 fetcher->SetResponseString(""); | 101 fetcher->SetResponseString(""); |
101 | 102 |
102 EXPECT_FALSE(upload_complete_[0]); | 103 EXPECT_FALSE(upload_complete_[0]); |
103 fetcher->delegate()->OnURLFetchComplete(fetcher); | 104 fetcher->delegate()->OnURLFetchComplete(fetcher); |
104 EXPECT_TRUE(upload_complete_[0]); | 105 EXPECT_TRUE(upload_complete_[0]); |
105 EXPECT_FALSE(upload_successful_[0]); | 106 EXPECT_FALSE(upload_successful_[0]); |
106 } | 107 } |
107 | 108 |
| 109 } // namespace |
108 } // namespace domain_reliability | 110 } // namespace domain_reliability |
OLD | NEW |