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

Side by Side Diff: chrome/browser/chromeos/login/signed_settings_unittest.cc

Issue 5671003: [Chrome OS] Plumb new error codes from SignedSettings to consumers of the API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove untoward log statement Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/chromeos/login/signed_settings.h" 5 #include "chrome/browser/chromeos/login/signed_settings.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/nss_util.h" 9 #include "base/nss_util.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 15 matching lines...) Expand all
26 using ::testing::_; 26 using ::testing::_;
27 27
28 namespace chromeos { 28 namespace chromeos {
29 29
30 namespace { 30 namespace {
31 template <class T> 31 template <class T>
32 class DummyDelegate : public SignedSettings::Delegate<T> { 32 class DummyDelegate : public SignedSettings::Delegate<T> {
33 public: 33 public:
34 explicit DummyDelegate(T to_expect) 34 explicit DummyDelegate(T to_expect)
35 : expect_success_(false), 35 : expect_success_(false),
36 expected_failure_(SignedSettings::NOT_FOUND), 36 expected_failure_(SignedSettings::SUCCESS),
37 expected_(to_expect), 37 expected_(to_expect),
38 run_(false) {} 38 run_(false) {}
39 virtual ~DummyDelegate() { EXPECT_TRUE(run_); } 39 virtual ~DummyDelegate() { EXPECT_TRUE(run_); }
40 virtual void OnSettingsOpSucceeded(T value) { 40 virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code,
41 T value) {
41 run_ = true; 42 run_ = true;
42 EXPECT_TRUE(expect_success_); 43 if (expect_success_)
43 EXPECT_EQ(expected_, value); 44 EXPECT_EQ(expected_, value);
44 }
45 virtual void OnSettingsOpFailed(SignedSettings::FailureCode code) {
46 run_ = true;
47 EXPECT_FALSE(expect_success_);
48 EXPECT_EQ(expected_failure_, code); 45 EXPECT_EQ(expected_failure_, code);
49 } 46 }
50 virtual void expect_success() { expect_success_ = true; } 47 virtual void expect_success() {
51 virtual void expect_failure(SignedSettings::FailureCode code) { 48 expect_success_ = true;
49 expected_failure_ = SignedSettings::SUCCESS;
50 }
51 virtual void expect_failure(SignedSettings::ReturnCode code) {
52 expect_success_ = false;
52 expected_failure_ = code; 53 expected_failure_ = code;
53 } 54 }
54 bool expect_success_; 55 bool expect_success_;
55 SignedSettings::FailureCode expected_failure_; 56 SignedSettings::ReturnCode expected_failure_;
56 T expected_; 57 T expected_;
57 bool run_; 58 bool run_;
58 }; 59 };
59 60
60 } // anonymous namespace 61 } // anonymous namespace
61 62
62 class SignedSettingsTest : public ::testing::Test { 63 class SignedSettingsTest : public ::testing::Test {
63 public: 64 public:
64 SignedSettingsTest() 65 SignedSettingsTest()
65 : fake_email_("fakey"), 66 : fake_email_("fakey"),
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 334
334 TEST_F(SignedSettingsTest, RetrievePropertyNoKey) { 335 TEST_F(SignedSettingsTest, RetrievePropertyNoKey) {
335 FailingRetrievePropertyOp(OwnerManager::KEY_UNAVAILABLE); 336 FailingRetrievePropertyOp(OwnerManager::KEY_UNAVAILABLE);
336 } 337 }
337 338
338 TEST_F(SignedSettingsTest, RetrievePropertyFailed) { 339 TEST_F(SignedSettingsTest, RetrievePropertyFailed) {
339 FailingRetrievePropertyOp(OwnerManager::OPERATION_FAILED); 340 FailingRetrievePropertyOp(OwnerManager::OPERATION_FAILED);
340 } 341 }
341 342
342 } // namespace chromeos 343 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/signed_settings_helper_unittest.cc ('k') | chrome/browser/chromeos/proxy_config_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698