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" |
(...skipping 28 matching lines...) Expand all Loading... | |
39 EXPECT_FALSE(upload_complete_[index]); | 39 EXPECT_FALSE(upload_complete_[index]); |
40 upload_complete_[index] = true; | 40 upload_complete_[index] = true; |
41 upload_successful_[index] = success; | 41 upload_successful_[index] = success; |
42 } | 42 } |
43 | 43 |
44 content::TestBrowserThreadBundle test_browser_thread_bundle_; | 44 content::TestBrowserThreadBundle test_browser_thread_bundle_; |
45 net::TestURLFetcherFactory url_fetcher_factory_; | 45 net::TestURLFetcherFactory url_fetcher_factory_; |
46 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; | 46 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; |
47 scoped_ptr<DomainReliabilityUploader> uploader_; | 47 scoped_ptr<DomainReliabilityUploader> uploader_; |
48 | 48 |
49 // Whether the upload callback was called for a particular collector index. | |
49 std::map<int, bool> upload_complete_; | 50 std::map<int, bool> upload_complete_; |
51 // Whether the upload to a particular collector was successful. | |
50 std::map<int, bool> upload_successful_; | 52 std::map<int, bool> upload_successful_; |
Ryan Sleevi
2014/04/26 02:37:39
size_t
Deprecated (see juliatuttle)
2014/04/28 22:01:13
Done.
| |
51 }; | 53 }; |
52 | 54 |
53 TEST_F(DomainReliabilityUploaderTest, Create) { | 55 TEST_F(DomainReliabilityUploaderTest, Create) { |
54 net::TestURLFetcher* fetcher; | 56 net::TestURLFetcher* fetcher; |
55 | 57 |
56 fetcher = url_fetcher_factory_.GetFetcherByID(0); | 58 fetcher = url_fetcher_factory_.GetFetcherByID(0); |
57 EXPECT_FALSE(fetcher); | 59 EXPECT_FALSE(fetcher); |
58 } | 60 } |
59 | 61 |
60 TEST_F(DomainReliabilityUploaderTest, SuccessfulUpload) { | 62 TEST_F(DomainReliabilityUploaderTest, SuccessfulUpload) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 fetcher->set_response_code(500); | 99 fetcher->set_response_code(500); |
98 fetcher->SetResponseString(""); | 100 fetcher->SetResponseString(""); |
99 | 101 |
100 EXPECT_FALSE(upload_complete_[0]); | 102 EXPECT_FALSE(upload_complete_[0]); |
101 fetcher->delegate()->OnURLFetchComplete(fetcher); | 103 fetcher->delegate()->OnURLFetchComplete(fetcher); |
102 EXPECT_TRUE(upload_complete_[0]); | 104 EXPECT_TRUE(upload_complete_[0]); |
103 EXPECT_FALSE(upload_successful_[0]); | 105 EXPECT_FALSE(upload_successful_[0]); |
104 } | 106 } |
105 | 107 |
106 } // namespace domain_reliability | 108 } // namespace domain_reliability |
OLD | NEW |