| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base64.h" | 5 #include "base/base64.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 content::BrowserThread::IO, FROM_HERE, | 977 content::BrowserThread::IO, FROM_HERE, |
| 978 base::Bind(&ExternallyConnectableMessagingWithTlsChannelIdTest:: | 978 base::Bind(&ExternallyConnectableMessagingWithTlsChannelIdTest:: |
| 979 CreateDomainBoundCertOnIOThread, | 979 CreateDomainBoundCertOnIOThread, |
| 980 base::Unretained(this), base::Unretained(&channel_id_key), | 980 base::Unretained(this), base::Unretained(&channel_id_key), |
| 981 base::Unretained(&request), request_context_getter)); | 981 base::Unretained(&request), request_context_getter)); |
| 982 tls_channel_id_created_.Wait(); | 982 tls_channel_id_created_.Wait(); |
| 983 // Create the expected value. | 983 // Create the expected value. |
| 984 std::vector<uint8> spki_vector; | 984 std::vector<uint8> spki_vector; |
| 985 if (!channel_id_key->ExportPublicKey(&spki_vector)) | 985 if (!channel_id_key->ExportPublicKey(&spki_vector)) |
| 986 return std::string(); | 986 return std::string(); |
| 987 base::StringPiece spki(reinterpret_cast<char*>( | 987 base::StringPiece spki(reinterpret_cast<char*>(spki_vector.data()), |
| 988 vector_as_array(&spki_vector)), spki_vector.size()); | 988 spki_vector.size()); |
| 989 base::DictionaryValue jwk_value; | 989 base::DictionaryValue jwk_value; |
| 990 net::JwkSerializer::ConvertSpkiFromDerToJwk(spki, &jwk_value); | 990 net::JwkSerializer::ConvertSpkiFromDerToJwk(spki, &jwk_value); |
| 991 std::string tls_channel_id_value; | 991 std::string tls_channel_id_value; |
| 992 base::JSONWriter::Write(jwk_value, &tls_channel_id_value); | 992 base::JSONWriter::Write(jwk_value, &tls_channel_id_value); |
| 993 return tls_channel_id_value; | 993 return tls_channel_id_value; |
| 994 } | 994 } |
| 995 | 995 |
| 996 private: | 996 private: |
| 997 void CreateDomainBoundCertOnIOThread( | 997 void CreateDomainBoundCertOnIOThread( |
| 998 scoped_ptr<crypto::ECPrivateKey>* channel_id_key, | 998 scoped_ptr<crypto::ECPrivateKey>* channel_id_key, |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); | 1192 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); |
| 1193 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR, | 1193 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR, |
| 1194 CanConnectAndSendMessagesToMainFrame(invalid.get())); | 1194 CanConnectAndSendMessagesToMainFrame(invalid.get())); |
| 1195 } | 1195 } |
| 1196 | 1196 |
| 1197 #endif // !defined(OS_WIN) - http://crbug.com/350517. | 1197 #endif // !defined(OS_WIN) - http://crbug.com/350517. |
| 1198 | 1198 |
| 1199 } // namespace | 1199 } // namespace |
| 1200 | 1200 |
| 1201 }; // namespace extensions | 1201 }; // namespace extensions |
| OLD | NEW |