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

Side by Side Diff: chrome/browser/prerender/prerender_history_unittest.cc

Issue 104493005: Update some uses of Value in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 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 | Annotate | Revision Log
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 "base/values.h" 5 #include "base/values.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "chrome/browser/prerender/prerender_history.h" 7 #include "chrome/browser/prerender/prerender_history.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace prerender { 10 namespace prerender {
11 11
12 namespace { 12 namespace {
13 13
14 bool ListEntryMatches(ListValue* list, 14 bool ListEntryMatches(base::ListValue* list,
15 size_t index, 15 size_t index,
16 const char* expected_url, 16 const char* expected_url,
17 FinalStatus expected_final_status, 17 FinalStatus expected_final_status,
18 Origin expected_origin, 18 Origin expected_origin,
19 const std::string& expected_end_time) { 19 const std::string& expected_end_time) {
20 if (index >= list->GetSize()) 20 if (index >= list->GetSize())
21 return false; 21 return false;
22 DictionaryValue* dict = NULL; 22 base::DictionaryValue* dict = NULL;
23 if (!list->GetDictionary(index, &dict)) 23 if (!list->GetDictionary(index, &dict))
24 return false; 24 return false;
25 if (dict->size() != 4u) 25 if (dict->size() != 4u)
26 return false; 26 return false;
27 std::string url; 27 std::string url;
28 if (!dict->GetString("url", &url)) 28 if (!dict->GetString("url", &url))
29 return false; 29 return false;
30 if (url != expected_url) 30 if (url != expected_url)
31 return false; 31 return false;
32 std::string final_status; 32 std::string final_status;
33 if (!dict->GetString("final_status", &final_status)) 33 if (!dict->GetString("final_status", &final_status))
34 return false; 34 return false;
35 if (final_status != NameFromFinalStatus(expected_final_status)) 35 if (final_status != NameFromFinalStatus(expected_final_status))
36 return false; 36 return false;
37 std::string origin; 37 std::string origin;
38 if (!dict->GetString("origin", &origin)) 38 if (!dict->GetString("origin", &origin))
39 return false; 39 return false;
40 if (origin != NameFromOrigin(expected_origin)) 40 if (origin != NameFromOrigin(expected_origin))
41 return false; 41 return false;
42 std::string end_time; 42 std::string end_time;
43 if (!dict->GetString("end_time", &end_time)) 43 if (!dict->GetString("end_time", &end_time))
44 return false; 44 return false;
45 if (end_time != expected_end_time) 45 if (end_time != expected_end_time)
46 return false; 46 return false;
47 return true; 47 return true;
48 } 48 }
49 49
50 TEST(PrerenderHistoryTest, GetAsValue) { 50 TEST(PrerenderHistoryTest, GetAsValue) {
51 scoped_ptr<Value> entry_value; 51 scoped_ptr<base::Value> entry_value;
52 ListValue* entry_list = NULL; 52 base::ListValue* entry_list = NULL;
53 53
54 // Create a history with only 2 values. 54 // Create a history with only 2 values.
55 PrerenderHistory history(2); 55 PrerenderHistory history(2);
56 56
57 // Make sure an empty list exists when retrieving as value. 57 // Make sure an empty list exists when retrieving as value.
58 entry_value.reset(history.GetEntriesAsValue()); 58 entry_value.reset(history.GetEntriesAsValue());
59 ASSERT_TRUE(entry_value.get() != NULL); 59 ASSERT_TRUE(entry_value.get() != NULL);
60 ASSERT_TRUE(entry_value->GetAsList(&entry_list)); 60 ASSERT_TRUE(entry_value->GetAsList(&entry_list));
61 EXPECT_TRUE(entry_list->empty()); 61 EXPECT_TRUE(entry_list->empty());
62 62
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 history.Clear(); 116 history.Clear();
117 entry_value.reset(history.GetEntriesAsValue()); 117 entry_value.reset(history.GetEntriesAsValue());
118 ASSERT_TRUE(entry_value.get() != NULL); 118 ASSERT_TRUE(entry_value.get() != NULL);
119 ASSERT_TRUE(entry_value->GetAsList(&entry_list)); 119 ASSERT_TRUE(entry_value->GetAsList(&entry_list));
120 EXPECT_TRUE(entry_list->empty()); 120 EXPECT_TRUE(entry_list->empty());
121 } 121 }
122 122
123 } // namespace 123 } // namespace
124 124
125 } // namespace prerender 125 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_history.cc ('k') | chrome/browser/prerender/prerender_local_predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698