| 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 "chrome/renderer/extensions/extension_localization_peer.h" | 5 #include "chrome/renderer/extensions/extension_localization_peer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 TEST_F(ExtensionLocalizationPeerTest, CreateWithValidInput) { | 130 TEST_F(ExtensionLocalizationPeerTest, CreateWithValidInput) { |
| 131 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1)); | 131 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1)); |
| 132 EXPECT_TRUE(NULL != filter_peer_.get()); | 132 EXPECT_TRUE(NULL != filter_peer_.get()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 TEST_F(ExtensionLocalizationPeerTest, OnReceivedData) { | 135 TEST_F(ExtensionLocalizationPeerTest, OnReceivedData) { |
| 136 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1)); | 136 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1)); |
| 137 EXPECT_TRUE(GetData().empty()); | 137 EXPECT_TRUE(GetData().empty()); |
| 138 | 138 |
| 139 const std::string data_chunk("12345"); | 139 const std::string data_chunk("12345"); |
| 140 filter_peer_->OnReceivedData(base::WrapUnique(new content::FixedReceivedData( | 140 filter_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>( |
| 141 data_chunk.data(), data_chunk.length(), -1, 0))); | 141 data_chunk.data(), data_chunk.length(), -1, 0)); |
| 142 | 142 |
| 143 EXPECT_EQ(data_chunk, GetData()); | 143 EXPECT_EQ(data_chunk, GetData()); |
| 144 | 144 |
| 145 filter_peer_->OnReceivedData(base::WrapUnique(new content::FixedReceivedData( | 145 filter_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>( |
| 146 data_chunk.data(), data_chunk.length(), -1, 0))); | 146 data_chunk.data(), data_chunk.length(), -1, 0)); |
| 147 EXPECT_EQ(data_chunk + data_chunk, GetData()); | 147 EXPECT_EQ(data_chunk + data_chunk, GetData()); |
| 148 } | 148 } |
| 149 | 149 |
| 150 MATCHER_P(IsURLRequestEqual, status, "") { return arg.status() == status; } | 150 MATCHER_P(IsURLRequestEqual, status, "") { return arg.status() == status; } |
| 151 | 151 |
| 152 TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestBadURLRequestStatus) { | 152 TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestBadURLRequestStatus) { |
| 153 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1)); | 153 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1)); |
| 154 | 154 |
| 155 EXPECT_CALL(*original_peer_, OnReceivedResponse(_)); | 155 EXPECT_CALL(*original_peer_, OnReceivedResponse(_)); |
| 156 EXPECT_CALL(*original_peer_, | 156 EXPECT_CALL(*original_peer_, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 EXPECT_CALL(*original_peer_, OnReceivedResponse(_)); | 255 EXPECT_CALL(*original_peer_, OnReceivedResponse(_)); |
| 256 EXPECT_CALL(*original_peer_, OnReceivedDataInternal(StrEq(message.c_str()), | 256 EXPECT_CALL(*original_peer_, OnReceivedDataInternal(StrEq(message.c_str()), |
| 257 message.length(), -1)); | 257 message.length(), -1)); |
| 258 | 258 |
| 259 EXPECT_CALL(*original_peer_, | 259 EXPECT_CALL(*original_peer_, |
| 260 OnCompletedRequest(net::OK, false, false, base::TimeTicks(), -1)); | 260 OnCompletedRequest(net::OK, false, false, base::TimeTicks(), -1)); |
| 261 | 261 |
| 262 filter_peer_->OnCompletedRequest(net::OK, false, false, base::TimeTicks(), | 262 filter_peer_->OnCompletedRequest(net::OK, false, false, base::TimeTicks(), |
| 263 -1); | 263 -1); |
| 264 } | 264 } |
| OLD | NEW |