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

Side by Side Diff: chrome/browser/net/predictor_unittest.cc

Issue 2809023003: Reland 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
« no previous file with comments | « chrome/browser/net/predictor.cc ('k') | chrome/browser/permissions/chooser_context_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/net/predictor.h" 5 #include "chrome/browser/net/predictor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 FindSerializationMotivation(motivation, referral_list); 99 FindSerializationMotivation(motivation, referral_list);
100 if (!motivation_list) { 100 if (!motivation_list) {
101 // This is the first mention of this motivation, so build a list. 101 // This is the first mention of this motivation, so build a list.
102 motivation_list = new base::ListValue; 102 motivation_list = new base::ListValue;
103 motivation_list->AppendString(motivation.spec()); 103 motivation_list->AppendString(motivation.spec());
104 // Provide empty subresource list. 104 // Provide empty subresource list.
105 motivation_list->Append(base::MakeUnique<base::ListValue>()); 105 motivation_list->Append(base::MakeUnique<base::ListValue>());
106 106
107 // ...and make it part of the serialized referral_list. 107 // ...and make it part of the serialized referral_list.
108 referral_list->Append(base::WrapUnique(motivation_list)); 108 referral_list->Append(base::WrapUnique(motivation_list));
109 // |motivation_list| is invalidated at this point, so it needs to be reset.
110 referral_list->GetList(referral_list->GetSize() - 1, &motivation_list);
109 } 111 }
110 112
111 base::ListValue* subresource_list(NULL); 113 base::ListValue* subresource_list(NULL);
112 // 0 == url; 1 == subresource_list. 114 // 0 == url; 1 == subresource_list.
113 EXPECT_TRUE(motivation_list->GetList(1, &subresource_list)); 115 EXPECT_TRUE(motivation_list->GetList(1, &subresource_list));
114 116
115 // We won't bother to check for the subresource being there already. Worst 117 // We won't bother to check for the subresource being there already. Worst
116 // case, during deserialization, the latency value we supply plus the 118 // case, during deserialization, the latency value we supply plus the
117 // existing value(s) will be added to the referrer. 119 // existing value(s) will be added to the referrer.
118 120
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED); 562 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED);
561 563
562 // Proxy may not be in use (the PAC script has not yet been evaluated), so the 564 // Proxy may not be in use (the PAC script has not yet been evaluated), so the
563 // name has been registered for pre-resolve. 565 // name has been registered for pre-resolve.
564 EXPECT_FALSE(testing_master.work_queue_.IsEmpty()); 566 EXPECT_FALSE(testing_master.work_queue_.IsEmpty());
565 567
566 testing_master.Shutdown(); 568 testing_master.Shutdown();
567 } 569 }
568 570
569 } // namespace chrome_browser_net 571 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor.cc ('k') | chrome/browser/permissions/chooser_context_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698