| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "components/autofill/content/browser/wallet/encryption_escrow_client.h" | 6 #include "components/autofill/content/browser/wallet/encryption_escrow_client.h" |
| 7 #include "components/autofill/content/browser/wallet/encryption_escrow_client_ob
server.h" | 7 #include "components/autofill/content/browser/wallet/encryption_escrow_client_ob
server.h" |
| 8 #include "components/autofill/content/browser/wallet/instrument.h" | 8 #include "components/autofill/content/browser/wallet/instrument.h" |
| 9 #include "components/autofill/content/browser/wallet/wallet_test_util.h" | 9 #include "components/autofill/content/browser/wallet/wallet_test_util.h" |
| 10 #include "content/public/test/test_browser_context.h" | 10 #include "content/public/test/test_browser_context.h" |
| 11 #include "content/public/test/test_browser_thread.h" | 11 #include "content/public/test/test_browser_thread_bundle.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/http/http_status_code.h" | 13 #include "net/http/http_status_code.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_status.h" | 16 #include "net/url_request/url_request_status.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 namespace autofill { | 20 namespace autofill { |
| 21 namespace wallet { | 21 namespace wallet { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 fetcher->delegate()->OnURLFetchComplete(fetcher); | 98 fetcher->delegate()->OnURLFetchComplete(fetcher); |
| 99 } | 99 } |
| 100 | 100 |
| 101 protected: | 101 protected: |
| 102 scoped_ptr<TestEncryptionEscrowClient> encryption_escrow_client_; | 102 scoped_ptr<TestEncryptionEscrowClient> encryption_escrow_client_; |
| 103 testing::StrictMock<MockEncryptionEscrowClientObserver> observer_; | 103 testing::StrictMock<MockEncryptionEscrowClientObserver> observer_; |
| 104 scoped_ptr<Instrument> instrument_; | 104 scoped_ptr<Instrument> instrument_; |
| 105 | 105 |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 content::TestBrowserThreadBundle thread_bundle_; |
| 108 content::TestBrowserContext browser_context_; | 109 content::TestBrowserContext browser_context_; |
| 109 net::TestURLFetcherFactory factory_; | 110 net::TestURLFetcherFactory factory_; |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 TEST_F(EncryptionEscrowClientTest, NetworkError) { | 113 TEST_F(EncryptionEscrowClientTest, NetworkError) { |
| 113 EXPECT_CALL(observer_, OnDidMakeRequest()).Times(1); | 114 EXPECT_CALL(observer_, OnDidMakeRequest()).Times(1); |
| 114 EXPECT_CALL(observer_, OnNetworkError()).Times(1); | 115 EXPECT_CALL(observer_, OnNetworkError()).Times(1); |
| 115 | 116 |
| 116 encryption_escrow_client_->EscrowInstrumentInformation(*instrument_, | 117 encryption_escrow_client_->EscrowInstrumentInformation(*instrument_, |
| 117 "obfuscated_gaia_id"); | 118 "obfuscated_gaia_id"); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 188 |
| 188 encryption_escrow_client_->EncryptOneTimePad(MakeOneTimePad()); | 189 encryption_escrow_client_->EncryptOneTimePad(MakeOneTimePad()); |
| 189 EXPECT_TRUE(encryption_escrow_client_->HasRequestInProgress()); | 190 EXPECT_TRUE(encryption_escrow_client_->HasRequestInProgress()); |
| 190 | 191 |
| 191 encryption_escrow_client_->CancelRequest(); | 192 encryption_escrow_client_->CancelRequest(); |
| 192 EXPECT_FALSE(encryption_escrow_client_->HasRequestInProgress()); | 193 EXPECT_FALSE(encryption_escrow_client_->HasRequestInProgress()); |
| 193 } | 194 } |
| 194 | 195 |
| 195 } // namespace wallet | 196 } // namespace wallet |
| 196 } // namespace autofill | 197 } // namespace autofill |
| OLD | NEW |