| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/test/fake_server/fake_server_verifier.h" | 5 #include "sync/test/fake_server/fake_server_verifier.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "sync/internal_api/public/base/model_type.h" | 10 #include "sync/internal_api/public/base/model_type.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 return AssertionFailure() << "Sessions hierarchies are not equal. " | 47 return AssertionFailure() << "Sessions hierarchies are not equal. " |
| 48 << "FakeServer contents: " << actual.ToString() | 48 << "FakeServer contents: " << actual.ToString() |
| 49 << "; Expected contents: " << expected.ToString(); | 49 << "; Expected contents: " << expected.ToString(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Caller maintains ownership of |entities|. | 52 // Caller maintains ownership of |entities|. |
| 53 string ConvertFakeServerContentsToString( | 53 string ConvertFakeServerContentsToString( |
| 54 const base::DictionaryValue& entities) { | 54 const base::DictionaryValue& entities) { |
| 55 string entities_str; | 55 string entities_str; |
| 56 if (!JSONWriter::WriteWithOptions(&entities, | 56 if (!JSONWriter::WriteWithOptions(entities, JSONWriter::OPTIONS_PRETTY_PRINT, |
| 57 JSONWriter::OPTIONS_PRETTY_PRINT, | |
| 58 &entities_str)) { | 57 &entities_str)) { |
| 59 entities_str = "Could not convert FakeServer contents to string."; | 58 entities_str = "Could not convert FakeServer contents to string."; |
| 60 } | 59 } |
| 61 return "FakeServer contents:\n" + entities_str; | 60 return "FakeServer contents:\n" + entities_str; |
| 62 } | 61 } |
| 63 | 62 |
| 64 } // namespace | 63 } // namespace |
| 65 | 64 |
| 66 FakeServerVerifier::FakeServerVerifier(FakeServer* fake_server) | 65 FakeServerVerifier::FakeServerVerifier(FakeServer* fake_server) |
| 67 : fake_server_(fake_server) { } | 66 : fake_server_(fake_server) { } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 return AssertionFailure() << "Malformed data: Tab entity not found."; | 176 return AssertionFailure() << "Malformed data: Tab entity not found."; |
| 178 } | 177 } |
| 179 tab_urls.insert(tab_ids_to_urls[tab_id]); | 178 tab_urls.insert(tab_ids_to_urls[tab_id]); |
| 180 } | 179 } |
| 181 actual_sessions.AddWindow(tab_urls); | 180 actual_sessions.AddWindow(tab_urls); |
| 182 } | 181 } |
| 183 return VerifySessionsHierarchyEquality(expected_sessions, actual_sessions); | 182 return VerifySessionsHierarchyEquality(expected_sessions, actual_sessions); |
| 184 } | 183 } |
| 185 | 184 |
| 186 } // namespace fake_server | 185 } // namespace fake_server |
| OLD | NEW |