Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "extensions/common/test_util.h" | 5 #include "extensions/common/test_util.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "extensions/common/extension.h" | 9 #include "extensions/common/extension.h" |
| 10 #include "extensions/common/extension_builder.h" | 10 #include "extensions/common/extension_builder.h" |
| 11 #include "extensions/common/value_builder.h" | 11 #include "extensions/common/value_builder.h" |
| 12 | 12 |
| 13 namespace extensions { | 13 namespace extensions { |
| 14 namespace test_util { | 14 namespace test_util { |
| 15 | 15 |
| 16 ExtensionBuilder& BuildExtension(ExtensionBuilder& builder) { | 16 ExtensionBuilder BuildExtension(ExtensionBuilder builder) { |
| 17 return builder | 17 return std::move(builder.SetManifest(DictionaryBuilder() |
|
danakj
2015/12/17 22:22:02
nit: it might be easier to read these if you wrote
limasdf
2015/12/18 00:31:58
Thank you. |builder| is rvalue, just returning wit
danakj
2015/12/18 00:38:49
Ah, right return will make it an rvalue :) Thanks!
| |
| 18 .SetManifest(DictionaryBuilder() | 18 .Set("name", "Test extension") |
| 19 .Set("name", "Test extension") | 19 .Set("version", "1.0") |
| 20 .Set("version", "1.0") | 20 .Set("manifest_version", 2))); |
| 21 .Set("manifest_version", 2)); | |
| 22 } | 21 } |
| 23 | 22 |
| 24 ExtensionBuilder& BuildApp(ExtensionBuilder& builder) { | 23 ExtensionBuilder BuildApp(ExtensionBuilder builder) { |
| 25 return builder.SetManifest( | 24 return std::move(builder.SetManifest( |
| 26 DictionaryBuilder() | 25 DictionaryBuilder() |
| 27 .Set("name", "Test extension") | 26 .Set("name", "Test extension") |
| 28 .Set("version", "1.0") | 27 .Set("version", "1.0") |
| 29 .Set("manifest_version", 2) | 28 .Set("manifest_version", 2) |
| 30 .Set("app", | 29 .Set("app", |
| 31 extensions::DictionaryBuilder().Set( | 30 extensions::DictionaryBuilder().Set( |
| 32 "background", | 31 "background", |
| 33 extensions::DictionaryBuilder().Set( | 32 extensions::DictionaryBuilder().Set( |
| 34 "scripts", std::move(extensions::ListBuilder().Append( | 33 "scripts", std::move(extensions::ListBuilder().Append( |
| 35 "background.js")))))); | 34 "background.js"))))))); |
| 36 } | 35 } |
| 37 | 36 |
| 38 scoped_refptr<Extension> CreateEmptyExtension() { | 37 scoped_refptr<Extension> CreateEmptyExtension() { |
| 39 return ExtensionBuilder() | 38 return ExtensionBuilder() |
| 40 .SetManifest( | 39 .SetManifest( |
| 41 DictionaryBuilder().Set("name", "Test").Set("version", "1.0")) | 40 DictionaryBuilder().Set("name", "Test").Set("version", "1.0")) |
| 42 .Build(); | 41 .Build(); |
| 43 } | 42 } |
| 44 | 43 |
| 45 scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) { | 44 scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) { |
| 46 return ExtensionBuilder() | 45 return ExtensionBuilder() |
| 47 .SetManifest( | 46 .SetManifest( |
| 48 DictionaryBuilder().Set("name", "test").Set("version", "0.1")) | 47 DictionaryBuilder().Set("name", "test").Set("version", "0.1")) |
| 49 .SetID(id) | 48 .SetID(id) |
| 50 .Build(); | 49 .Build(); |
| 51 } | 50 } |
| 52 | 51 |
| 53 } // namespace test_util | 52 } // namespace test_util |
| 54 } // namespace extensions | 53 } // namespace extensions |
| OLD | NEW |