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

Side by Side Diff: chrome/browser/devtools/devtools_network_controller_unittest.cc

Issue 319133002: DevToolsManagerDelegate: parse all "emulateNetworkConditions" parameters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 <string> 5 #include <string>
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 if (!request_) 61 if (!request_)
62 request_.reset(new MockHttpRequest(mock_transaction_)); 62 request_.reset(new MockHttpRequest(mock_transaction_));
63 return request_.get(); 63 return request_.get();
64 } 64 }
65 65
66 void SetNetworkState(const std::string& client_id, bool offline) { 66 void SetNetworkState(const std::string& client_id, bool offline) {
67 std::vector<std::string> domains; 67 std::vector<std::string> domains;
68 domains.push_back(kCom); 68 domains.push_back(kCom);
69 scoped_refptr<DevToolsNetworkConditions> conditions; 69 scoped_refptr<DevToolsNetworkConditions> conditions;
70 if (offline) 70 if (offline)
71 conditions = new DevToolsNetworkConditions(domains); 71 conditions = new DevToolsNetworkConditions(domains, 0.0);
72 controller_.SetNetworkStateOnIO(client_id, conditions); 72 controller_.SetNetworkStateOnIO(client_id, conditions);
73 } 73 }
74 74
75 int Start() { 75 int Start() {
76 return transaction_->Start( 76 return transaction_->Start(
77 GetRequest(), completion_callback_, net::BoundNetLog()); 77 GetRequest(), completion_callback_, net::BoundNetLog());
78 } 78 }
79 79
80 int Read() { 80 int Read() {
81 return transaction_->Read(buffer_.get(), 64, completion_callback_); 81 return transaction_->Read(buffer_.get(), 64, completion_callback_);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 helper.mock_transaction()->url = kHttpDotOrg; 205 helper.mock_transaction()->url = kHttpDotOrg;
206 DevToolsNetworkController* controller = helper.controller(); 206 DevToolsNetworkController* controller = helper.controller();
207 net::HttpRequestInfo* request = helper.GetRequest(); 207 net::HttpRequestInfo* request = helper.GetRequest();
208 208
209 EXPECT_FALSE(controller->ShouldFail(request)); 209 EXPECT_FALSE(controller->ShouldFail(request));
210 helper.SetNetworkState(kClientId, true); 210 helper.SetNetworkState(kClientId, true);
211 EXPECT_FALSE(controller->ShouldFail(request)); 211 EXPECT_FALSE(controller->ShouldFail(request));
212 } 212 }
213 213
214 } // namespace test 214 } // namespace test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698