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

Side by Side Diff: components/invalidation/gcm_network_channel_unittest.cc

Issue 1200393002: Add more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string
Patch Set: Android Created 5 years, 5 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
OLDNEW
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_util.h" 6 #include "base/strings/string_util.h"
7 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "components/invalidation/gcm_network_channel.h" 8 #include "components/invalidation/gcm_network_channel.h"
9 #include "google_apis/gaia/google_service_auth_error.h" 9 #include "google_apis/gaia/google_service_auth_error.h"
10 #include "net/url_request/test_url_fetcher_factory.h" 10 #include "net/url_request/test_url_fetcher_factory.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 InvalidatorState last_invalidator_state_; 227 InvalidatorState last_invalidator_state_;
228 }; 228 };
229 229
230 void TestNetworkChannelURLFetcher::AddExtraRequestHeader( 230 void TestNetworkChannelURLFetcher::AddExtraRequestHeader(
231 const std::string& header_line) { 231 const std::string& header_line) {
232 net::FakeURLFetcher::AddExtraRequestHeader(header_line); 232 net::FakeURLFetcher::AddExtraRequestHeader(header_line);
233 std::string header_name("echo-token: "); 233 std::string header_name("echo-token: ");
234 std::string echo_token; 234 std::string echo_token;
235 if (base::StartsWithASCII(header_line, header_name, false)) { 235 if (base::StartsWithASCII(header_line, header_name, false)) {
236 echo_token = header_line; 236 echo_token = header_line;
237 ReplaceFirstSubstringAfterOffset( 237 base::ReplaceFirstSubstringAfterOffset(
238 &echo_token, 0, header_name, std::string()); 238 &echo_token, 0, header_name, std::string());
239 test_->set_last_echo_token(echo_token); 239 test_->set_last_echo_token(echo_token);
240 } 240 }
241 } 241 }
242 242
243 TEST_F(GCMNetworkChannelTest, HappyCase) { 243 TEST_F(GCMNetworkChannelTest, HappyCase) {
244 EXPECT_EQ(TRANSIENT_INVALIDATION_ERROR, get_last_invalidator_state()); 244 EXPECT_EQ(TRANSIENT_INVALIDATION_ERROR, get_last_invalidator_state());
245 EXPECT_FALSE(delegate()->message_callback.is_null()); 245 EXPECT_FALSE(delegate()->message_callback.is_null());
246 url_fetcher_factory()->SetFakeResponse(GURL("http://test.url.com"), 246 url_fetcher_factory()->SetFakeResponse(GURL("http://test.url.com"),
247 std::string(), 247 std::string(),
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 delegate()->request_token_callback.Run( 503 delegate()->request_token_callback.Run(
504 GoogleServiceAuthError::AuthErrorNone(), "access.token"); 504 GoogleServiceAuthError::AuthErrorNone(), "access.token");
505 RunLoopUntilIdle(); 505 RunLoopUntilIdle();
506 EXPECT_EQ(url_fetchers_created_count(), 3); 506 EXPECT_EQ(url_fetchers_created_count(), 3);
507 // Echo_token should be from second message. 507 // Echo_token should be from second message.
508 EXPECT_EQ("echo.token", get_last_echo_token()); 508 EXPECT_EQ("echo.token", get_last_echo_token());
509 } 509 }
510 #endif 510 #endif
511 511
512 } // namespace syncer 512 } // namespace syncer
OLDNEW
« no previous file with comments | « components/autofill/core/browser/data_driven_test.cc ('k') | components/json_schema/json_schema_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698