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

Side by Side Diff: components/data_use_measurement/core/data_use_measurement_unittest.cc

Issue 2756373003: Record the data use of service worker initiated requests (Closed)
Patch Set: Fix unittest Created 3 years, 9 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 "components/data_use_measurement/core/data_use_measurement.h" 5 #include "components/data_use_measurement/core/data_use_measurement.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 DataUseUserData::DataUseContentType GetContentType( 48 DataUseUserData::DataUseContentType GetContentType(
49 const net::URLRequest& request, 49 const net::URLRequest& request,
50 const net::HttpResponseHeaders& response_headers) const override { 50 const net::HttpResponseHeaders& response_headers) const override {
51 return content_type_; 51 return content_type_;
52 } 52 }
53 53
54 void set_content_type(DataUseUserData::DataUseContentType content_type) { 54 void set_content_type(DataUseUserData::DataUseContentType content_type) {
55 content_type_ = content_type; 55 content_type_ = content_type;
56 } 56 }
57 57
58 bool IsServiceWorkerRequest(const net::URLRequest& request) const override {
59 return false;
60 }
61
58 private: 62 private:
59 DataUseUserData::DataUseContentType content_type_; 63 DataUseUserData::DataUseContentType content_type_;
60 }; 64 };
61 65
62 class TestDataUseAscriber : public DataUseAscriber { 66 class TestDataUseAscriber : public DataUseAscriber {
63 public: 67 public:
64 TestDataUseAscriber() {} 68 TestDataUseAscriber() {}
65 69
66 DataUseRecorder* GetOrCreateDataUseRecorder( 70 DataUseRecorder* GetOrCreateDataUseRecorder(
67 net::URLRequest* request) override { 71 net::URLRequest* request) override {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 500
497 histogram_tester.ExpectUniqueSample("DataUse.ContentType.UserTraffic", 501 histogram_tester.ExpectUniqueSample("DataUse.ContentType.UserTraffic",
498 DataUseUserData::VIDEO_APPBACKGROUND, 502 DataUseUserData::VIDEO_APPBACKGROUND,
499 1000); 503 1000);
500 } 504 }
501 } 505 }
502 506
503 #endif 507 #endif
504 508
505 } // namespace data_use_measurement 509 } // namespace data_use_measurement
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698