OLD | NEW |
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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
6 #include "base/strings/string_split.h" | 6 #include "base/strings/string_split.h" |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
9 #include "components/invalidation/impl/gcm_network_channel.h" | 9 #include "components/invalidation/impl/gcm_network_channel.h" |
10 #include "google_apis/gaia/google_service_auth_error.h" | 10 #include "google_apis/gaia/google_service_auth_error.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 int url_fetchers_created_count_; | 226 int url_fetchers_created_count_; |
227 std::string last_echo_token_; | 227 std::string last_echo_token_; |
228 InvalidatorState last_invalidator_state_; | 228 InvalidatorState last_invalidator_state_; |
229 }; | 229 }; |
230 | 230 |
231 void TestNetworkChannelURLFetcher::AddExtraRequestHeader( | 231 void TestNetworkChannelURLFetcher::AddExtraRequestHeader( |
232 const std::string& header_line) { | 232 const std::string& header_line) { |
233 net::FakeURLFetcher::AddExtraRequestHeader(header_line); | 233 net::FakeURLFetcher::AddExtraRequestHeader(header_line); |
234 std::string header_name("echo-token: "); | 234 std::string header_name("echo-token: "); |
235 std::string echo_token; | 235 std::string echo_token; |
236 if (base::StartsWithASCII(header_line, header_name, false)) { | 236 if (base::StartsWith(header_line, header_name, |
| 237 base::CompareCase::INSENSITIVE_ASCII)) { |
237 echo_token = header_line; | 238 echo_token = header_line; |
238 base::ReplaceFirstSubstringAfterOffset( | 239 base::ReplaceFirstSubstringAfterOffset( |
239 &echo_token, 0, header_name, std::string()); | 240 &echo_token, 0, header_name, std::string()); |
240 test_->set_last_echo_token(echo_token); | 241 test_->set_last_echo_token(echo_token); |
241 } | 242 } |
242 } | 243 } |
243 | 244 |
244 TEST_F(GCMNetworkChannelTest, HappyCase) { | 245 TEST_F(GCMNetworkChannelTest, HappyCase) { |
245 EXPECT_EQ(TRANSIENT_INVALIDATION_ERROR, get_last_invalidator_state()); | 246 EXPECT_EQ(TRANSIENT_INVALIDATION_ERROR, get_last_invalidator_state()); |
246 EXPECT_FALSE(delegate()->message_callback.is_null()); | 247 EXPECT_FALSE(delegate()->message_callback.is_null()); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 delegate()->request_token_callback.Run( | 505 delegate()->request_token_callback.Run( |
505 GoogleServiceAuthError::AuthErrorNone(), "access.token"); | 506 GoogleServiceAuthError::AuthErrorNone(), "access.token"); |
506 RunLoopUntilIdle(); | 507 RunLoopUntilIdle(); |
507 EXPECT_EQ(url_fetchers_created_count(), 3); | 508 EXPECT_EQ(url_fetchers_created_count(), 3); |
508 // Echo_token should be from second message. | 509 // Echo_token should be from second message. |
509 EXPECT_EQ("echo.token", get_last_echo_token()); | 510 EXPECT_EQ("echo.token", get_last_echo_token()); |
510 } | 511 } |
511 #endif | 512 #endif |
512 | 513 |
513 } // namespace syncer | 514 } // namespace syncer |
OLD | NEW |