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

Side by Side Diff: extensions/browser/api/test/test_api.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 "extensions/browser/api/test/test_api.h" 5 #include "extensions/browser/api/test/test_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 std::pair<std::string, bool*> details(params->message, 90 std::pair<std::string, bool*> details(params->message,
91 &listener_will_respond); 91 &listener_will_respond);
92 content::NotificationService::current()->Notify( 92 content::NotificationService::current()->Notify(
93 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, 93 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE,
94 content::Source<TestSendMessageFunction>(this), 94 content::Source<TestSendMessageFunction>(this),
95 content::Details<std::pair<std::string, bool*>>(&details)); 95 content::Details<std::pair<std::string, bool*>>(&details));
96 // If the listener is not intending to respond, or has already responded, 96 // If the listener is not intending to respond, or has already responded,
97 // finish the function. 97 // finish the function.
98 if (!listener_will_respond || response_.get()) { 98 if (!listener_will_respond || response_.get()) {
99 if (!response_) { 99 if (!response_) {
100 response_ = 100 response_ = OneArgument(base::MakeUnique<base::Value>(std::string()));
101 OneArgument(base::MakeUnique<base::StringValue>(std::string()));
102 } 101 }
103 return RespondNow(std::move(response_)); 102 return RespondNow(std::move(response_));
104 } 103 }
105 // Otherwise, wait for a reply. 104 // Otherwise, wait for a reply.
106 waiting_ = true; 105 waiting_ = true;
107 return RespondLater(); 106 return RespondLater();
108 } 107 }
109 108
110 TestSendMessageFunction::~TestSendMessageFunction() {} 109 TestSendMessageFunction::~TestSendMessageFunction() {}
111 110
112 void TestSendMessageFunction::Reply(const std::string& message) { 111 void TestSendMessageFunction::Reply(const std::string& message) {
113 DCHECK(!response_); 112 DCHECK(!response_);
114 response_ = OneArgument(base::MakeUnique<base::StringValue>(message)); 113 response_ = OneArgument(base::MakeUnique<base::Value>(message));
115 if (waiting_) 114 if (waiting_)
116 Respond(std::move(response_)); 115 Respond(std::move(response_));
117 } 116 }
118 117
119 void TestSendMessageFunction::ReplyWithError(const std::string& error) { 118 void TestSendMessageFunction::ReplyWithError(const std::string& error) {
120 DCHECK(!response_); 119 DCHECK(!response_);
121 response_ = Error(error); 120 response_ = Error(error);
122 if (waiting_) 121 if (waiting_)
123 Respond(std::move(response_)); 122 Respond(std::move(response_));
124 } 123 }
(...skipping 23 matching lines...) Expand all
148 return RespondNow( 147 return RespondNow(
149 OneArgument(test_config_state->config_state()->CreateDeepCopy())); 148 OneArgument(test_config_state->config_state()->CreateDeepCopy()));
150 } 149 }
151 150
152 TestWaitForRoundTripFunction::~TestWaitForRoundTripFunction() {} 151 TestWaitForRoundTripFunction::~TestWaitForRoundTripFunction() {}
153 152
154 ExtensionFunction::ResponseAction TestWaitForRoundTripFunction::Run() { 153 ExtensionFunction::ResponseAction TestWaitForRoundTripFunction::Run() {
155 std::unique_ptr<WaitForRoundTrip::Params> params( 154 std::unique_ptr<WaitForRoundTrip::Params> params(
156 WaitForRoundTrip::Params::Create(*args_)); 155 WaitForRoundTrip::Params::Create(*args_));
157 return RespondNow( 156 return RespondNow(
158 OneArgument(base::MakeUnique<base::StringValue>(params->message))); 157 OneArgument(base::MakeUnique<base::Value>(params->message)));
159 } 158 }
160 159
161 } // namespace extensions 160 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/system_storage/system_storage_api.cc ('k') | extensions/browser/api/vpn_provider/vpn_provider_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698