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

Side by Side Diff: chrome/browser/ui/webui/md_downloads/downloads_list_tracker_unittest.cc

Issue 2816513002: Revert of Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ui/webui/md_downloads/downloads_list_tracker.h" 5 #include "chrome/browser/ui/webui/md_downloads/downloads_list_tracker.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 28 matching lines...) Expand all
39 CHECK_GE(id, 0); 39 CHECK_GE(id, 0);
40 return static_cast<uint64_t>(id); 40 return static_cast<uint64_t>(id);
41 } 41 }
42 42
43 std::vector<uint64_t> GetIds(const base::Value& value) { 43 std::vector<uint64_t> GetIds(const base::Value& value) {
44 std::vector<uint64_t> ids; 44 std::vector<uint64_t> ids;
45 45
46 const base::ListValue* list; 46 const base::ListValue* list;
47 if (value.GetAsList(&list)) { 47 if (value.GetAsList(&list)) {
48 for (const auto& list_item : *list) 48 for (const auto& list_item : *list)
49 ids.push_back(GetId(list_item)); 49 ids.push_back(GetId(*list_item));
50 } else { 50 } else {
51 ids.push_back(GetId(value)); 51 ids.push_back(GetId(value));
52 } 52 }
53 53
54 return ids; 54 return ids;
55 } 55 }
56 56
57 int GetIndex(const base::Value* value) { 57 int GetIndex(const base::Value* value) {
58 CHECK(value); 58 CHECK(value);
59 int index; 59 int index;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 EXPECT_EQ(1u, GetIds(*web_ui()->call_data()[0]->arg2()).size()); 348 EXPECT_EQ(1u, GetIds(*web_ui()->call_data()[0]->arg2()).size());
349 349
350 DownloadItemModel(unsent_item).SetShouldShowInShelf(false); 350 DownloadItemModel(unsent_item).SetShouldShowInShelf(false);
351 tracker()->OnDownloadUpdated(manager(), unsent_item); 351 tracker()->OnDownloadUpdated(manager(), unsent_item);
352 EXPECT_EQ(1u, web_ui()->call_data().size()); 352 EXPECT_EQ(1u, web_ui()->call_data().size());
353 353
354 DownloadItemModel(unsent_item).SetShouldShowInShelf(true); 354 DownloadItemModel(unsent_item).SetShouldShowInShelf(true);
355 tracker()->OnDownloadUpdated(manager(), unsent_item); 355 tracker()->OnDownloadUpdated(manager(), unsent_item);
356 EXPECT_EQ(1u, web_ui()->call_data().size()); 356 EXPECT_EQ(1u, web_ui()->call_data().size());
357 } 357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698