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

Side by Side Diff: chrome/browser/data_use_measurement/chrome_data_use_ascriber_unittest.cc

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (Closed)
Patch Set: fix ContentResourceProviderTest Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h" 5 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h"
6 6
7 #include <list> 7 #include <list>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "components/data_use_measurement/core/data_use_recorder.h" 12 #include "components/data_use_measurement/core/data_use_recorder.h"
13 #include "content/public/browser/resource_request_info.h" 13 #include "content/public/browser/resource_request_info.h"
14 #include "content/public/common/browser_side_navigation_policy.h" 14 #include "content/public/common/browser_side_navigation_policy.h"
15 #include "content/public/common/previews_state.h"
15 #include "content/public/common/process_type.h" 16 #include "content/public/common/process_type.h"
16 #include "content/public/test/mock_resource_context.h" 17 #include "content/public/test/mock_resource_context.h"
17 #include "content/public/test/test_browser_thread_bundle.h" 18 #include "content/public/test/test_browser_thread_bundle.h"
18 #include "net/url_request/url_request_test_util.h" 19 #include "net/url_request/url_request_test_util.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 namespace { 22 namespace {
22 int kRenderProcessId = 1; 23 int kRenderProcessId = 1;
23 int kRenderFrameId = 2; 24 int kRenderFrameId = 2;
24 int kRequestId = 3; 25 int kRequestId = 3;
(...skipping 25 matching lines...) Expand all
50 51
51 std::unique_ptr<net::URLRequest> CreateNewRequest(std::string url, 52 std::unique_ptr<net::URLRequest> CreateNewRequest(std::string url,
52 bool is_main_frame, 53 bool is_main_frame,
53 int request_id, 54 int request_id,
54 int render_process_id, 55 int render_process_id,
55 int render_frame_id) { 56 int render_frame_id) {
56 std::unique_ptr<net::URLRequest> request = 57 std::unique_ptr<net::URLRequest> request =
57 context()->CreateRequest(GURL(url), net::IDLE, nullptr); 58 context()->CreateRequest(GURL(url), net::IDLE, nullptr);
58 // TODO(kundaji): Allow request_id to be specified in AllocateForTesting. 59 // TODO(kundaji): Allow request_id to be specified in AllocateForTesting.
59 content::ResourceRequestInfo::AllocateForTesting( 60 content::ResourceRequestInfo::AllocateForTesting(
60 request.get(), 61 request.get(), content::RESOURCE_TYPE_MAIN_FRAME, resource_context(),
61 content::RESOURCE_TYPE_MAIN_FRAME,
62 resource_context(),
63 render_process_id, 62 render_process_id,
64 -1, // render_view_id 63 /*render_view_id=*/-1, render_frame_id, is_main_frame,
65 render_frame_id, 64 /*parent_is_main_frame=*/false,
66 is_main_frame, 65 /*allow_download=*/false,
67 false, // parent_is_main_frame 66 /*is_async=*/true, content::PREVIEWS_OFF);
68 false, // allow_download
69 true, // is_async
70 false); // is_using_lofi
71 return request; 67 return request;
72 } 68 }
73 69
74 private: 70 private:
75 content::TestBrowserThreadBundle thread_bundle_; 71 content::TestBrowserThreadBundle thread_bundle_;
76 ChromeDataUseAscriber ascriber_; 72 ChromeDataUseAscriber ascriber_;
77 net::TestURLRequestContext context_; 73 net::TestURLRequestContext context_;
78 std::unique_ptr<content::MockResourceContext> resource_context_; 74 std::unique_ptr<content::MockResourceContext> resource_context_;
79 }; 75 };
80 76
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 ascriber()->RenderFrameHostChanged(kRenderProcessId, kRenderFrameId, 164 ascriber()->RenderFrameHostChanged(kRenderProcessId, kRenderFrameId,
169 kRenderProcessId + 1, kRenderFrameId + 1); 165 kRenderProcessId + 1, kRenderFrameId + 1);
170 ascriber()->RenderFrameDeleted(kRenderProcessId, kRenderFrameId, -1, -1); 166 ascriber()->RenderFrameDeleted(kRenderProcessId, kRenderFrameId, -1, -1);
171 167
172 ascriber()->WasShownOrHidden(kRenderProcessId + 1, kRenderFrameId + 1, true); 168 ascriber()->WasShownOrHidden(kRenderProcessId + 1, kRenderFrameId + 1, true);
173 ascriber()->RenderFrameDeleted(kRenderProcessId + 1, kRenderFrameId + 1, -1, 169 ascriber()->RenderFrameDeleted(kRenderProcessId + 1, kRenderFrameId + 1, -1,
174 -1); 170 -1);
175 } 171 }
176 172
177 } // namespace data_use_measurement 173 } // namespace data_use_measurement
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698