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

Side by Side Diff: third_party/libaddressinput/chromium/fallback_data_store_unittest.cc

Issue 298863012: Use upstream libaddressinput in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows compile. Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "third_party/libaddressinput/chromium/fallback_data_store.h"
6
7 #include <cstddef>
8 #include <ctime>
9 #include <string>
10
11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/libaddressinput/src/cpp/src/util/json.h"
13 #include "third_party/libaddressinput/src/cpp/src/validating_util.h"
14
15 namespace autofill {
16
17 using i18n::addressinput::Json;
18 using i18n::addressinput::ValidatingUtil;
19
20 TEST(FallbackDataStore, Parsability) {
21 std::string data;
22 ASSERT_TRUE(FallbackDataStore::Get("data/US", &data));
23
24 // Should be stale.
25 EXPECT_FALSE(ValidatingUtil::UnwrapTimestamp(&data, time(NULL)));
26
27 // Should be uncorrupted.
28 EXPECT_TRUE(ValidatingUtil::UnwrapChecksum(&data));
29
30 // Should be valid JSON.
31 Json json;
32 ASSERT_TRUE(json.ParseObject(data));
33
34 // Should have a dictionary for "data/US", as this is aggregate data.
35 EXPECT_FALSE(json.HasStringValueForKey("data/US"));
36 EXPECT_TRUE(json.HasDictionaryValueForKey("data/US"));
37 }
38
39 } // namespace autofill
OLDNEW
« no previous file with comments | « third_party/libaddressinput/chromium/fallback_data_store.cc ('k') | third_party/libaddressinput/chromium/input_suggester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698