OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 | 52 |
53 class ConnectorSettingsTest : public testing::Test { | 53 class ConnectorSettingsTest : public testing::Test { |
54 protected: | 54 protected: |
55 void SetUp() override { | 55 void SetUp() override { |
56 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 56 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
57 task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 57 task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
58 } | 58 } |
59 | 59 |
60 ServiceProcessPrefs* CreateTestFile(const char* json) { | 60 ServiceProcessPrefs* CreateTestFile(const char* json) { |
61 base::FilePath file_name = temp_dir_.path().AppendASCII("file.txt"); | 61 base::FilePath file_name = temp_dir_.GetPath().AppendASCII("file.txt"); |
62 base::DeleteFile(file_name, false); | 62 base::DeleteFile(file_name, false); |
63 if (json) { | 63 if (json) { |
64 std::string content = json; | 64 std::string content = json; |
65 std::replace(content.begin(), content.end(), '\'', '"'); | 65 std::replace(content.begin(), content.end(), '\'', '"'); |
66 base::WriteFile(file_name, content.c_str(), content.size()); | 66 base::WriteFile(file_name, content.c_str(), content.size()); |
67 } | 67 } |
68 ServiceProcessPrefs* prefs = | 68 ServiceProcessPrefs* prefs = |
69 new ServiceProcessPrefs(file_name, task_runner_.get()); | 69 new ServiceProcessPrefs(file_name, task_runner_.get()); |
70 prefs->ReadPrefs(); | 70 prefs->ReadPrefs(); |
71 return prefs; | 71 return prefs; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 settings.SetXmppPingTimeoutSec(256); | 148 settings.SetXmppPingTimeoutSec(256); |
149 EXPECT_TRUE(settings.xmpp_ping_enabled()); | 149 EXPECT_TRUE(settings.xmpp_ping_enabled()); |
150 EXPECT_EQ(settings.xmpp_ping_timeout_sec(), 256); | 150 EXPECT_EQ(settings.xmpp_ping_timeout_sec(), 256); |
151 | 151 |
152 // Set invalid settings, and check correct defaults. | 152 // Set invalid settings, and check correct defaults. |
153 settings.SetXmppPingTimeoutSec(1); | 153 settings.SetXmppPingTimeoutSec(1); |
154 EXPECT_EQ(settings.xmpp_ping_timeout_sec(), kMinXmppPingTimeoutSecs); | 154 EXPECT_EQ(settings.xmpp_ping_timeout_sec(), kMinXmppPingTimeoutSecs); |
155 } | 155 } |
156 | 156 |
157 } // namespace cloud_print | 157 } // namespace cloud_print |
OLD | NEW |