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

Side by Side Diff: chrome/browser/chromeos/attestation/attestation_ca_client_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" 7 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h"
8 #include "content/public/test/test_browser_thread.h" 8 #include "content/public/test/test_browser_thread.h"
9 #include "net/http/http_status_code.h" 9 #include "net/http/http_status_code.h"
10 #include "net/url_request/test_url_fetcher_factory.h" 10 #include "net/url_request/test_url_fetcher_factory.h"
(...skipping 21 matching lines...) Expand all
32 protected: 32 protected:
33 void SendResponse(net::URLRequestStatus::Status status, int response_code) { 33 void SendResponse(net::URLRequestStatus::Status status, int response_code) {
34 net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); 34 net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0);
35 CHECK(fetcher); 35 CHECK(fetcher);
36 fetcher->set_status(net::URLRequestStatus(status, 0)); 36 fetcher->set_status(net::URLRequestStatus(status, 0));
37 fetcher->set_response_code(response_code); 37 fetcher->set_response_code(response_code);
38 fetcher->SetResponseString(fetcher->upload_data() + "_response"); 38 fetcher->SetResponseString(fetcher->upload_data() + "_response");
39 fetcher->delegate()->OnURLFetchComplete(fetcher); 39 fetcher->delegate()->OnURLFetchComplete(fetcher);
40 } 40 }
41 41
42 MessageLoop message_loop_; 42 base::MessageLoop message_loop_;
43 content::TestBrowserThread io_thread_; 43 content::TestBrowserThread io_thread_;
44 net::TestURLFetcherFactory url_fetcher_factory_; 44 net::TestURLFetcherFactory url_fetcher_factory_;
45 }; 45 };
46 46
47 TEST_F(AttestationCAClientTest, EnrollRequest) { 47 TEST_F(AttestationCAClientTest, EnrollRequest) {
48 AttestationCAClient client; 48 AttestationCAClient client;
49 EXPECT_CALL(*this, DataCallback(true, "enroll_response")).Times(1); 49 EXPECT_CALL(*this, DataCallback(true, "enroll_response")).Times(1);
50 client.SendEnrollRequest( 50 client.SendEnrollRequest(
51 "enroll", 51 "enroll",
52 base::Bind(&AttestationCAClientTest::DataCallback, 52 base::Bind(&AttestationCAClientTest::DataCallback,
(...skipping 26 matching lines...) Expand all
79 EXPECT_CALL(*this, DataCallback(false, "")).Times(1); 79 EXPECT_CALL(*this, DataCallback(false, "")).Times(1);
80 client.SendCertificateRequest( 80 client.SendCertificateRequest(
81 "certificate", 81 "certificate",
82 base::Bind(&AttestationCAClientTest::DataCallback, 82 base::Bind(&AttestationCAClientTest::DataCallback,
83 base::Unretained(this))); 83 base::Unretained(this)));
84 SendResponse(net::URLRequestStatus::SUCCESS, net::HTTP_NOT_FOUND); 84 SendResponse(net::URLRequestStatus::SUCCESS, net::HTTP_NOT_FOUND);
85 } 85 }
86 86
87 } // namespace attestation 87 } // namespace attestation
88 } // namespace chromeos 88 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698