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

Side by Side Diff: extensions/browser/api/serial/serial_apitest.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 13 matching lines...) Expand all
24 using testing::_; 24 using testing::_;
25 using testing::Return; 25 using testing::Return;
26 26
27 namespace extensions { 27 namespace extensions {
28 namespace { 28 namespace {
29 29
30 class FakeSerialGetDevicesFunction : public AsyncExtensionFunction { 30 class FakeSerialGetDevicesFunction : public AsyncExtensionFunction {
31 public: 31 public:
32 bool RunAsync() override { 32 bool RunAsync() override {
33 std::unique_ptr<base::ListValue> devices(new base::ListValue()); 33 std::unique_ptr<base::ListValue> devices(new base::ListValue());
34 base::DictionaryValue* device0 = new base::DictionaryValue(); 34 std::unique_ptr<base::DictionaryValue> device0(new base::DictionaryValue());
35 device0->SetString("path", "/dev/fakeserial"); 35 device0->SetString("path", "/dev/fakeserial");
36 base::DictionaryValue* device1 = new base::DictionaryValue(); 36 std::unique_ptr<base::DictionaryValue> device1(new base::DictionaryValue());
37 device1->SetString("path", "\\\\COM800\\"); 37 device1->SetString("path", "\\\\COM800\\");
38 devices->Append(device0); 38 devices->Append(std::move(device0));
39 devices->Append(device1); 39 devices->Append(std::move(device1));
40 SetResult(std::move(devices)); 40 SetResult(std::move(devices));
41 SendResponse(true); 41 SendResponse(true);
42 return true; 42 return true;
43 } 43 }
44 44
45 protected: 45 protected:
46 ~FakeSerialGetDevicesFunction() override {} 46 ~FakeSerialGetDevicesFunction() override {}
47 }; 47 };
48 48
49 class FakeSerialDeviceEnumerator : public device::SerialDeviceEnumerator { 49 class FakeSerialDeviceEnumerator : public device::SerialDeviceEnumerator {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 IN_PROC_BROWSER_TEST_P(SerialApiTest, SerialRealHardware) { 197 IN_PROC_BROWSER_TEST_P(SerialApiTest, SerialRealHardware) {
198 ResultCatcher catcher; 198 ResultCatcher catcher;
199 catcher.RestrictToBrowserContext(browser()->profile()); 199 catcher.RestrictToBrowserContext(browser()->profile());
200 200
201 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_; 201 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_;
202 } 202 }
203 203
204 INSTANTIATE_TEST_CASE_P(SerialApiTest, SerialApiTest, testing::Bool()); 204 INSTANTIATE_TEST_CASE_P(SerialApiTest, SerialApiTest, testing::Bool());
205 205
206 } // namespace extensions 206 } // namespace extensions
OLDNEW
« no previous file with comments | « dbus/values_util_unittest.cc ('k') | extensions/browser/api/web_request/upload_data_presenter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698