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

Side by Side Diff: sync/api/sync_error_unittest.cc

Issue 388003002: Sync: Display non-severe errors on about:sync in gray color rather than red. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed failing unit test, added extra test case, addressed CR feedback. 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
« no previous file with comments | « sync/api/sync_error.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "sync/api/sync_error.h" 5 #include "sync/api/sync_error.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 11 matching lines...) Expand all
22 EXPECT_FALSE(error.IsSet()); 22 EXPECT_FALSE(error.IsSet());
23 } 23 }
24 24
25 TEST_F(SyncErrorTest, Default) { 25 TEST_F(SyncErrorTest, Default) {
26 tracked_objects::Location location = FROM_HERE; 26 tracked_objects::Location location = FROM_HERE;
27 std::string msg = "test"; 27 std::string msg = "test";
28 ModelType type = PREFERENCES; 28 ModelType type = PREFERENCES;
29 SyncError error(location, SyncError::DATATYPE_ERROR, msg, type); 29 SyncError error(location, SyncError::DATATYPE_ERROR, msg, type);
30 ASSERT_TRUE(error.IsSet()); 30 ASSERT_TRUE(error.IsSet());
31 EXPECT_EQ(location.line_number(), error.location().line_number()); 31 EXPECT_EQ(location.line_number(), error.location().line_number());
32 EXPECT_EQ("datatype error was encountered: " + msg, error.message()); 32 EXPECT_EQ("datatype error was encountered: ", error.GetMessagePrefix());
33 EXPECT_EQ(msg, error.message());
33 EXPECT_EQ(type, error.model_type()); 34 EXPECT_EQ(type, error.model_type());
35 EXPECT_EQ(SyncError::SYNC_ERROR_SEVERITY_ERROR, error.GetSeverity());
36 }
37
38 TEST_F(SyncErrorTest, LowSeverity) {
39 tracked_objects::Location location = FROM_HERE;
40 std::string msg = "test";
41 ModelType type = PREFERENCES;
42 SyncError error(location, SyncError::DATATYPE_POLICY_ERROR, msg, type);
43 ASSERT_TRUE(error.IsSet());
44 EXPECT_EQ(location.line_number(), error.location().line_number());
45 EXPECT_EQ("disabled due to configuration constraints: ",
46 error.GetMessagePrefix());
47 EXPECT_EQ(msg, error.message());
48 EXPECT_EQ(type, error.model_type());
49 EXPECT_EQ(SyncError::SYNC_ERROR_SEVERITY_INFO, error.GetSeverity());
34 } 50 }
35 51
36 TEST_F(SyncErrorTest, Reset) { 52 TEST_F(SyncErrorTest, Reset) {
37 tracked_objects::Location location = FROM_HERE; 53 tracked_objects::Location location = FROM_HERE;
38 std::string msg = "test"; 54 std::string msg = "test";
39 ModelType type = PREFERENCES; 55 ModelType type = PREFERENCES;
40 56
41 SyncError error; 57 SyncError error;
42 EXPECT_FALSE(error.IsSet()); 58 EXPECT_FALSE(error.IsSet());
43 59
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 EXPECT_EQ(std::string(), error2.ToString()); 144 EXPECT_EQ(std::string(), error2.ToString());
129 145
130 error2 = error; 146 error2 = error;
131 EXPECT_TRUE(error2.IsSet()); 147 EXPECT_TRUE(error2.IsSet());
132 EXPECT_NE(string::npos, error.ToString().find(expected)); 148 EXPECT_NE(string::npos, error.ToString().find(expected));
133 } 149 }
134 150
135 } // namespace 151 } // namespace
136 152
137 } // namespace syncer 153 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/api/sync_error.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698