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

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

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 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 transaction_.reset(new DevToolsNetworkTransaction( 61 transaction_.reset(new DevToolsNetworkTransaction(
62 &controller_, network_transaction.Pass())); 62 &controller_, network_transaction.Pass()));
63 } 63 }
64 64
65 net::HttpRequestInfo* GetRequest() { 65 net::HttpRequestInfo* GetRequest() {
66 if (!request_) 66 if (!request_)
67 request_.reset(new MockHttpRequest(mock_transaction_)); 67 request_.reset(new MockHttpRequest(mock_transaction_));
68 return request_.get(); 68 return request_.get();
69 } 69 }
70 70
71 void SetNetworkState(const std::string id, bool offline) { 71 void SetNetworkState(const std::string& id, bool offline) {
72 scoped_ptr<DevToolsNetworkConditions> conditions( 72 scoped_ptr<DevToolsNetworkConditions> conditions(
73 new DevToolsNetworkConditions(offline)); 73 new DevToolsNetworkConditions(offline));
74 controller_.SetNetworkState(id, conditions.Pass()); 74 controller_.SetNetworkState(id, conditions.Pass());
75 } 75 }
76 76
77 int Start() { 77 int Start() {
78 return transaction_->Start( 78 return transaction_->Start(
79 GetRequest(), completion_callback_, net::BoundNetLog()); 79 GetRequest(), completion_callback_, net::BoundNetLog());
80 } 80 }
81 81
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 "X-DevTools-Emulate-Network-Conditions-Client-Id: 42\r\n" 205 "X-DevTools-Emulate-Network-Conditions-Client-Id: 42\r\n"
206 "X-DevTools-Request-Initiator: frontend\r\n"; 206 "X-DevTools-Request-Initiator: frontend\r\n";
207 helper.Start(); 207 helper.Start();
208 208
209 EXPECT_FALSE(helper.ShouldFail()); 209 EXPECT_FALSE(helper.ShouldFail());
210 helper.SetNetworkState(kClientId, true); 210 helper.SetNetworkState(kClientId, true);
211 EXPECT_FALSE(helper.ShouldFail()); 211 EXPECT_FALSE(helper.ShouldFail());
212 } 212 }
213 213
214 } // namespace test 214 } // namespace test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698