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

Side by Side Diff: components/gcm_driver/gcm_client_impl_unittest.cc

Issue 1431953003: Fix several uses of ScopedTempDir in components_unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | components/precache/content/precache_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/gcm_driver/gcm_client_impl.h" 5 #include "components/gcm_driver/gcm_client_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 return reinterpret_cast<AutoAdvancingTestClock*>(gcm_client_->clock_.get()); 366 return reinterpret_cast<AutoAdvancingTestClock*>(gcm_client_->clock_.get());
367 } 367 }
368 net::TestURLFetcherFactory* url_fetcher_factory() { 368 net::TestURLFetcherFactory* url_fetcher_factory() {
369 return &url_fetcher_factory_; 369 return &url_fetcher_factory_;
370 } 370 }
371 base::TestMockTimeTaskRunner* task_runner() { 371 base::TestMockTimeTaskRunner* task_runner() {
372 return task_runner_.get(); 372 return task_runner_.get();
373 } 373 }
374 374
375 private: 375 private:
376 // Must be declared first so that it is destroyed last. Injected to
377 // GCM client.
378 base::ScopedTempDir temp_directory_;
379
376 // Variables used for verification. 380 // Variables used for verification.
377 LastEvent last_event_; 381 LastEvent last_event_;
378 std::string last_app_id_; 382 std::string last_app_id_;
379 std::string last_registration_id_; 383 std::string last_registration_id_;
380 std::string last_message_id_; 384 std::string last_message_id_;
381 GCMClient::Result last_result_; 385 GCMClient::Result last_result_;
382 IncomingMessage last_message_; 386 IncomingMessage last_message_;
383 GCMClient::SendErrorDetails last_error_details_; 387 GCMClient::SendErrorDetails last_error_details_;
384 base::Time last_token_fetch_time_; 388 base::Time last_token_fetch_time_;
385 std::vector<AccountMapping> last_account_mappings_; 389 std::vector<AccountMapping> last_account_mappings_;
386 390
387 scoped_ptr<GCMClientImpl> gcm_client_; 391 scoped_ptr<GCMClientImpl> gcm_client_;
388 392
389 net::TestURLFetcherFactory url_fetcher_factory_; 393 net::TestURLFetcherFactory url_fetcher_factory_;
390 394
391 scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; 395 scoped_refptr<base::TestMockTimeTaskRunner> task_runner_;
392 base::ThreadTaskRunnerHandle task_runner_handle_; 396 base::ThreadTaskRunnerHandle task_runner_handle_;
393 397
394 // Injected to GCM client: 398 // Injected to GCM client.
395 base::ScopedTempDir temp_directory_;
396 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; 399 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_;
397 }; 400 };
398 401
399 GCMClientImplTest::GCMClientImplTest() 402 GCMClientImplTest::GCMClientImplTest()
400 : last_event_(NONE), 403 : last_event_(NONE),
401 last_result_(GCMClient::UNKNOWN_ERROR), 404 last_result_(GCMClient::UNKNOWN_ERROR),
402 task_runner_(new base::TestMockTimeTaskRunner), 405 task_runner_(new base::TestMockTimeTaskRunner),
403 task_runner_handle_(task_runner_), 406 task_runner_handle_(task_runner_),
404 url_request_context_getter_( 407 url_request_context_getter_(
405 new net::TestURLRequestContextGetter(task_runner_)) { 408 new net::TestURLRequestContextGetter(task_runner_)) {
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 // No need to call CompleteDeleteToken since unregistration request should 1643 // No need to call CompleteDeleteToken since unregistration request should
1641 // not be triggered. 1644 // not be triggered.
1642 PumpLoopUntilIdle(); 1645 PumpLoopUntilIdle();
1643 1646
1644 EXPECT_EQ(UNREGISTRATION_COMPLETED, last_event()); 1647 EXPECT_EQ(UNREGISTRATION_COMPLETED, last_event());
1645 EXPECT_EQ(kAppId, last_app_id()); 1648 EXPECT_EQ(kAppId, last_app_id());
1646 EXPECT_EQ(GCMClient::SUCCESS, last_result()); 1649 EXPECT_EQ(GCMClient::SUCCESS, last_result());
1647 } 1650 }
1648 1651
1649 } // namespace gcm 1652 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | components/precache/content/precache_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698