| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sync/sync_global_error.h" | 5 #include "chrome/browser/sync/sync_global_error.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/sync/profile_sync_service_mock.h" | 9 #include "chrome/browser/sync/profile_sync_service_mock.h" |
| 10 #include "content/test/test_browser_thread.h" | 10 #include "content/test/test_browser_thread.h" |
| 11 #include "testing/gmock/include/gmock/gmock-actions.h" | 11 #include "testing/gmock/include/gmock/gmock-actions.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 using ::testing::Return; | 15 using ::testing::Return; |
| 16 using ::testing::NiceMock; | 16 using ::testing::NiceMock; |
| 17 using content::BrowserThread; |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 // Utility function to test that SyncGlobalError behaves correct for the given | 21 // Utility function to test that SyncGlobalError behaves correct for the given |
| 21 // error condition. | 22 // error condition. |
| 22 void VerifySyncGlobalErrorResult(NiceMock<ProfileSyncServiceMock>* service, | 23 void VerifySyncGlobalErrorResult(NiceMock<ProfileSyncServiceMock>* service, |
| 23 SyncGlobalError* error, | 24 SyncGlobalError* error, |
| 24 GoogleServiceAuthError::State error_state, | 25 GoogleServiceAuthError::State error_state, |
| 25 bool is_signed_in, | 26 bool is_signed_in, |
| 26 bool is_error) { | 27 bool is_error) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, | 114 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, |
| 114 }; | 115 }; |
| 115 | 116 |
| 116 for (size_t i = 0; i < sizeof(table)/sizeof(*table); ++i) { | 117 for (size_t i = 0; i < sizeof(table)/sizeof(*table); ++i) { |
| 117 VerifySyncGlobalErrorResult( | 118 VerifySyncGlobalErrorResult( |
| 118 &service, &error, table[i].error_state, true, table[i].is_error); | 119 &service, &error, table[i].error_state, true, table[i].is_error); |
| 119 VerifySyncGlobalErrorResult( | 120 VerifySyncGlobalErrorResult( |
| 120 &service, &error, table[i].error_state, false, false); | 121 &service, &error, table[i].error_state, false, false); |
| 121 } | 122 } |
| 122 } | 123 } |
| OLD | NEW |