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

Side by Side Diff: components/domain_reliability/uploader_unittest.cc

Issue 252613002: Domain Reliability: More security review. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 8 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
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 "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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698