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

Side by Side Diff: google_apis/gcm/engine/gcm_request_test_base.h

Issue 2111973002: Add support for GCM subtypes to desktop Instance ID implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid9push
Patch Set: Address jianli's review comments Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/macros.h" 5 #include "base/macros.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/test/test_mock_time_task_runner.h" 7 #include "base/test/test_mock_time_task_runner.h"
8 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "net/base/backoff_entry.h" 9 #include "net/base/backoff_entry.h"
10 #include "net/url_request/test_url_fetcher_factory.h" 10 #include "net/url_request/test_url_fetcher_factory.h"
(...skipping 13 matching lines...) Expand all
24 net::TestURLFetcher* GetFetcher() const; 24 net::TestURLFetcher* GetFetcher() const;
25 25
26 // Set the response status and body that will be returned by the URL fetch. 26 // Set the response status and body that will be returned by the URL fetch.
27 void SetResponse(net::HttpStatusCode status_code, 27 void SetResponse(net::HttpStatusCode status_code,
28 const std::string& response_body); 28 const std::string& response_body);
29 29
30 // Completes the URL fetch. 30 // Completes the URL fetch.
31 // It can be overridden by the test class to add additional logic. 31 // It can be overridden by the test class to add additional logic.
32 virtual void CompleteFetch(); 32 virtual void CompleteFetch();
33 33
34 // Verifies that the Fetcher's upload_data exactly matches the given
35 // properties. The map will be cleared as a side-effect. Wrap calls to this
36 // with ASSERT_NO_FATAL_FAILURE.
37 void VerifyFetcherUploadData(
Nicolas Zea 2016/08/17 20:54:09 optional suggestion: it might make sense to return
johnme 2016/08/18 17:43:21 Hmm, on the other hand it seems that would make th
38 std::map<std::string, std::string>* expected_pairs);
39
34 net::URLRequestContextGetter* url_request_context_getter() const { 40 net::URLRequestContextGetter* url_request_context_getter() const {
35 return url_request_context_getter_.get(); 41 return url_request_context_getter_.get();
36 } 42 }
37 43
38 private: 44 private:
39 // Fast forward the timer used in the test to retry the request immediately. 45 // Fast forward the timer used in the test to retry the request immediately.
40 void FastForwardToTriggerNextRetry(); 46 void FastForwardToTriggerNextRetry();
41 47
42 scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; 48 scoped_refptr<base::TestMockTimeTaskRunner> task_runner_;
43 base::ThreadTaskRunnerHandle task_runner_handle_; 49 base::ThreadTaskRunnerHandle task_runner_handle_;
44 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; 50 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_;
45 51
46 net::TestURLFetcherFactory url_fetcher_factory_; 52 net::TestURLFetcherFactory url_fetcher_factory_;
47 53
48 // Tracks the number of retries so far. 54 // Tracks the number of retries so far.
49 int retry_count_; 55 int retry_count_;
50 56
51 DISALLOW_COPY_AND_ASSIGN(GCMRequestTestBase); 57 DISALLOW_COPY_AND_ASSIGN(GCMRequestTestBase);
52 }; 58 };
53 59
54 } // namespace gcm 60 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698