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/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/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/signin/signin_manager.h" | 10 #include "chrome/browser/signin/signin_manager.h" |
11 #include "chrome/browser/signin/signin_manager_factory.h" | 11 #include "chrome/browser/signin/signin_manager_factory.h" |
12 #include "chrome/browser/sync/profile_sync_service_mock.h" | 12 #include "chrome/browser/sync/profile_sync_service_mock.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/webdata/web_data_service_factory.h" |
14 #include "chrome/test/base/browser_with_test_window_test.h" | 15 #include "chrome/test/base/browser_with_test_window_test.h" |
15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
16 #include "content/test/test_browser_thread.h" | 17 #include "content/test/test_browser_thread.h" |
17 #include "testing/gmock/include/gmock/gmock-actions.h" | 18 #include "testing/gmock/include/gmock/gmock-actions.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 | 21 |
21 using ::testing::NiceMock; | 22 using ::testing::NiceMock; |
22 using ::testing::Return; | 23 using ::testing::Return; |
23 using ::testing::ReturnRef; | 24 using ::testing::ReturnRef; |
(...skipping 14 matching lines...) Expand all Loading... |
38 // ExecuteCommand method. | 39 // ExecuteCommand method. |
39 class SyncGlobalErrorTest : public BrowserWithTestWindowTest { | 40 class SyncGlobalErrorTest : public BrowserWithTestWindowTest { |
40 public: | 41 public: |
41 SyncGlobalErrorTest() {} | 42 SyncGlobalErrorTest() {} |
42 virtual ~SyncGlobalErrorTest() {} | 43 virtual ~SyncGlobalErrorTest() {} |
43 | 44 |
44 virtual void SetUp() OVERRIDE { | 45 virtual void SetUp() OVERRIDE { |
45 testing::Test::SetUp(); | 46 testing::Test::SetUp(); |
46 | 47 |
47 set_profile(CreateProfile()); | 48 set_profile(CreateProfile()); |
| 49 WebDataServiceFactory::GetInstance()->SetTestingFactory(profile(), NULL); |
48 set_browser(new BrowserMock(Browser::TYPE_TABBED, profile())); | 50 set_browser(new BrowserMock(Browser::TYPE_TABBED, profile())); |
49 set_window(new TestBrowserWindow(browser())); | 51 set_window(new TestBrowserWindow(browser())); |
50 browser()->SetWindowForTesting(window()); | 52 browser()->SetWindowForTesting(window()); |
51 } | 53 } |
52 | 54 |
53 private: | 55 private: |
54 DISALLOW_COPY_AND_ASSIGN(SyncGlobalErrorTest); | 56 DISALLOW_COPY_AND_ASSIGN(SyncGlobalErrorTest); |
55 }; | 57 }; |
56 | 58 |
57 // Utility function to test that SyncGlobalError behaves correct for the given | 59 // Utility function to test that SyncGlobalError behaves correct for the given |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, | 157 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, |
156 }; | 158 }; |
157 | 159 |
158 for (size_t i = 0; i < sizeof(table)/sizeof(*table); ++i) { | 160 for (size_t i = 0; i < sizeof(table)/sizeof(*table); ++i) { |
159 VerifySyncGlobalErrorResult(&service, browser(), &error, | 161 VerifySyncGlobalErrorResult(&service, browser(), &error, |
160 table[i].error_state, true, table[i].is_error); | 162 table[i].error_state, true, table[i].is_error); |
161 VerifySyncGlobalErrorResult(&service, browser(), &error, | 163 VerifySyncGlobalErrorResult(&service, browser(), &error, |
162 table[i].error_state, false, false); | 164 table[i].error_state, false, false); |
163 } | 165 } |
164 } | 166 } |
OLD | NEW |