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

Side by Side Diff: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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 "extensions/browser/api/declarative_webrequest/webrequest_condition_att ribute.h" 5 #include "extensions/browser/api/declarative_webrequest/webrequest_condition_att ribute.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 for (size_t i = 0; i < length; i += 2) { 378 for (size_t i = 0; i < length; i += 2) {
379 const std::string* name = array[i]; 379 const std::string* name = array[i];
380 const std::string* value = array[i+1]; 380 const std::string* value = array[i+1];
381 if (dictionary->HasKey(*name)) { 381 if (dictionary->HasKey(*name)) {
382 base::Value* entry = NULL; 382 base::Value* entry = NULL;
383 std::unique_ptr<base::Value> entry_owned; 383 std::unique_ptr<base::Value> entry_owned;
384 base::ListValue* list = NULL; 384 base::ListValue* list = NULL;
385 if (!dictionary->GetWithoutPathExpansion(*name, &entry)) 385 if (!dictionary->GetWithoutPathExpansion(*name, &entry))
386 return std::unique_ptr<base::DictionaryValue>(); 386 return std::unique_ptr<base::DictionaryValue>();
387 switch (entry->GetType()) { 387 switch (entry->GetType()) {
388 case base::Value::TYPE_STRING: 388 case base::Value::Type::STRING:
389 // Replace the present string with a list. 389 // Replace the present string with a list.
390 list = new base::ListValue; 390 list = new base::ListValue;
391 // Ignoring return value, we already verified the entry is there. 391 // Ignoring return value, we already verified the entry is there.
392 dictionary->RemoveWithoutPathExpansion(*name, &entry_owned); 392 dictionary->RemoveWithoutPathExpansion(*name, &entry_owned);
393 list->Append(std::move(entry_owned)); 393 list->Append(std::move(entry_owned));
394 list->AppendString(*value); 394 list->AppendString(*value);
395 dictionary->SetWithoutPathExpansion(*name, base::WrapUnique(list)); 395 dictionary->SetWithoutPathExpansion(*name, base::WrapUnique(list));
396 break; 396 break;
397 case base::Value::TYPE_LIST: // Just append to the list. 397 case base::Value::Type::LIST: // Just append to the list.
398 CHECK(entry->GetAsList(&list)); 398 CHECK(entry->GetAsList(&list));
399 list->AppendString(*value); 399 list->AppendString(*value);
400 break; 400 break;
401 default: 401 default:
402 NOTREACHED(); // We never put other Values here. 402 NOTREACHED(); // We never put other Values here.
403 return std::unique_ptr<base::DictionaryValue>(); 403 return std::unique_ptr<base::DictionaryValue>();
404 } 404 }
405 } else { 405 } else {
406 dictionary->SetString(*name, *value); 406 dictionary->SetString(*name, *value);
407 } 407 }
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 }; 714 };
715 const size_t kExistingSize[] = { arraysize(kExisting) }; 715 const size_t kExistingSize[] = { arraysize(kExisting) };
716 GetArrayAsVector(kExisting, kExistingSize, 1u, &tests); 716 GetArrayAsVector(kExisting, kExistingSize, 1u, &tests);
717 MatchAndCheck(tests, keys::kExcludeResponseHeadersKey, stage, 717 MatchAndCheck(tests, keys::kExcludeResponseHeadersKey, stage,
718 url_request.get(), &result); 718 url_request.get(), &result);
719 EXPECT_FALSE(result); 719 EXPECT_FALSE(result);
720 } 720 }
721 721
722 } // namespace 722 } // namespace
723 } // namespace extensions 723 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698