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

Side by Side Diff: chrome/browser/extensions/api/declarative_content/content_action_unittest.cc

Issue 1739183003: Make extensions::DictionaryBuilder and extensions::ListValue unmovable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/declarative_content/content_action.h" 5 #include "chrome/browser/extensions/api/declarative_content/content_action.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 IPC::Message bitmap_pickle; 162 IPC::Message bitmap_pickle;
163 IPC::WriteParam(&bitmap_pickle, bitmap); 163 IPC::WriteParam(&bitmap_pickle, bitmap);
164 std::string binary_data = std::string( 164 std::string binary_data = std::string(
165 static_cast<const char*>(bitmap_pickle.data()), bitmap_pickle.size()); 165 static_cast<const char*>(bitmap_pickle.data()), bitmap_pickle.size());
166 std::string data64; 166 std::string data64;
167 base::Base64Encode(binary_data, &data64); 167 base::Base64Encode(binary_data, &data64);
168 168
169 scoped_ptr<base::DictionaryValue> dict = 169 scoped_ptr<base::DictionaryValue> dict =
170 DictionaryBuilder() 170 DictionaryBuilder()
171 .Set("instanceType", "declarativeContent.SetIcon") 171 .Set("instanceType", "declarativeContent.SetIcon")
172 .Set("imageData", std::move(DictionaryBuilder().Set("19", data64))) 172 .Set("imageData", DictionaryBuilder().Set("19", data64).Build())
173 .Build(); 173 .Build();
174 174
175 const Extension* extension = env.MakeExtension( 175 const Extension* extension = env.MakeExtension(
176 *ParseJson("{\"page_action\": { \"default_title\": \"Extension\" } }")); 176 *ParseJson("{\"page_action\": { \"default_title\": \"Extension\" } }"));
177 std::string error; 177 std::string error;
178 scoped_ptr<const ContentAction> result = ContentAction::Create( 178 scoped_ptr<const ContentAction> result = ContentAction::Create(
179 NULL, 179 NULL,
180 extension, 180 extension,
181 *dict, 181 *dict,
182 &error); 182 &error);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 " \"instanceType\": \"declarativeContent.RequestContentScript\",\n" 340 " \"instanceType\": \"declarativeContent.RequestContentScript\",\n"
341 " \"js\": [\"script.js\"],\n" 341 " \"js\": [\"script.js\"],\n"
342 " \"matchAboutBlank\": null\n" 342 " \"matchAboutBlank\": null\n"
343 "}"), 343 "}"),
344 &error); 344 &error);
345 ASSERT_FALSE(result.get()); 345 ASSERT_FALSE(result.get());
346 } 346 }
347 347
348 } // namespace 348 } // namespace
349 } // namespace extensions 349 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698