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

Side by Side Diff: chrome/service/cloud_print/connector_settings_unittest.cc

Issue 11027070: Moved JsonPrefStore to use SequencedWorkerPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 "chrome/service/cloud_print/connector_settings.h" 5 #include "chrome/service/cloud_print/connector_settings.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 26 matching lines...) Expand all
37 " ]," 37 " ],"
38 " 'print_system_settings': {" 38 " 'print_system_settings': {"
39 " 'delete_on_enum_fail' : true" 39 " 'delete_on_enum_fail' : true"
40 " }" 40 " }"
41 " }" 41 " }"
42 "}"; 42 "}";
43 43
44 44
45 class ConnectorSettingsTest : public testing::Test { 45 class ConnectorSettingsTest : public testing::Test {
46 protected: 46 protected:
47 virtual void SetUp() { 47 virtual void SetUp() OVERRIDE {
48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
49 message_loop_proxy_ = base::MessageLoopProxy::current(); 49 message_loop_proxy_ = base::MessageLoopProxy::current();
50 } 50 }
51 51
52 ServiceProcessPrefs* CreateTestFile(const char* json) { 52 ServiceProcessPrefs* CreateTestFile(const char* json) {
53 FilePath file_name = temp_dir_.path().AppendASCII("file.txt"); 53 FilePath file_name = temp_dir_.path().AppendASCII("file.txt");
54 file_util::Delete(file_name, false); 54 file_util::Delete(file_name, false);
55 if (json) { 55 if (json) {
56 std::string content = json; 56 std::string content = json;
57 std::replace(content.begin(), content.end(), '\'', '"'); 57 std::replace(content.begin(), content.end(), '\'', '"');
58 file_util::WriteFile(file_name, content.c_str(), content.size()); 58 file_util::WriteFile(file_name, content.c_str(), content.size());
59 } 59 }
60 ServiceProcessPrefs* prefs = 60 ServiceProcessPrefs* prefs =
61 new ServiceProcessPrefs(file_name, message_loop_proxy_.get()); 61 new ServiceProcessPrefs(file_name, message_loop_proxy_);
62 prefs->ReadPrefs(); 62 prefs->ReadPrefs();
63 return prefs; 63 return prefs;
64 } 64 }
65 65
66 ScopedTempDir temp_dir_; 66 ScopedTempDir temp_dir_;
67 MessageLoop message_loop_; 67 MessageLoop message_loop_;
68 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 68 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
69 }; 69 };
70 70
71 TEST_F(ConnectorSettingsTest, InitFromEmpty) { 71 TEST_F(ConnectorSettingsTest, InitFromEmpty) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // Set and check valid settings. 136 // Set and check valid settings.
137 settings.set_xmpp_ping_enabled(true); 137 settings.set_xmpp_ping_enabled(true);
138 settings.SetXmppPingTimeoutSec(256); 138 settings.SetXmppPingTimeoutSec(256);
139 EXPECT_TRUE(settings.xmpp_ping_enabled()); 139 EXPECT_TRUE(settings.xmpp_ping_enabled());
140 EXPECT_EQ(settings.xmpp_ping_timeout_sec(), 256); 140 EXPECT_EQ(settings.xmpp_ping_timeout_sec(), 256);
141 141
142 // Set invalid settings, and check correct defaults. 142 // Set invalid settings, and check correct defaults.
143 settings.SetXmppPingTimeoutSec(1); 143 settings.SetXmppPingTimeoutSec(1);
144 EXPECT_EQ(settings.xmpp_ping_timeout_sec(), kMinimumXmppPingTimeoutSecs); 144 EXPECT_EQ(settings.xmpp_ping_timeout_sec(), kMinimumXmppPingTimeoutSecs);
145 } 145 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698