| 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/ui/webui/sync_internals_ui.h" | 5 #include "chrome/browser/ui/webui/sync_internals_ui.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 // Tests with non-NULL ProfileSyncService. | 57 // Tests with non-NULL ProfileSyncService. |
| 58 class SyncInternalsUITestWithService : public ChromeRenderViewHostTestHarness { | 58 class SyncInternalsUITestWithService : public ChromeRenderViewHostTestHarness { |
| 59 protected: | 59 protected: |
| 60 SyncInternalsUITestWithService() : sync_internals_ui_(NULL) {} | 60 SyncInternalsUITestWithService() : sync_internals_ui_(NULL) {} |
| 61 | 61 |
| 62 virtual ~SyncInternalsUITestWithService() {} | 62 virtual ~SyncInternalsUITestWithService() {} |
| 63 | 63 |
| 64 virtual void SetUp() { | 64 virtual void SetUp() { |
| 65 NiceMock<ProfileMock>* profile_mock = new NiceMock<ProfileMock>(); | 65 NiceMock<ProfileMock>* profile_mock = new NiceMock<ProfileMock>(); |
| 66 StrictMock<ProfileSyncServiceMock> profile_sync_service_mock; | 66 StrictMock<browser_sync::ProfileSyncServiceMock> profile_sync_service_mock; |
| 67 EXPECT_CALL(*profile_mock, GetProfileSyncService()) | 67 EXPECT_CALL(*profile_mock, GetProfileSyncService()) |
| 68 .WillOnce(Return(&profile_sync_service_mock)); | 68 .WillOnce(Return(&profile_sync_service_mock)); |
| 69 browser_context_.reset(profile_mock); | 69 browser_context_.reset(profile_mock); |
| 70 | 70 |
| 71 ChromeRenderViewHostTestHarness::SetUp(); | 71 ChromeRenderViewHostTestHarness::SetUp(); |
| 72 | 72 |
| 73 EXPECT_CALL(profile_sync_service_mock, GetJsController()) | 73 EXPECT_CALL(profile_sync_service_mock, GetJsController()) |
| 74 .WillOnce(Return(mock_js_controller_.AsWeakPtr())); | 74 .WillOnce(Return(mock_js_controller_.AsWeakPtr())); |
| 75 | 75 |
| 76 EXPECT_CALL(mock_js_controller_, AddJsEventHandler(_)); | 76 EXPECT_CALL(mock_js_controller_, AddJsEventHandler(_)); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 class SyncInternalsUITestWithoutService | 143 class SyncInternalsUITestWithoutService |
| 144 : public ChromeRenderViewHostTestHarness { | 144 : public ChromeRenderViewHostTestHarness { |
| 145 protected: | 145 protected: |
| 146 SyncInternalsUITestWithoutService() : sync_internals_ui_(NULL) {} | 146 SyncInternalsUITestWithoutService() : sync_internals_ui_(NULL) {} |
| 147 | 147 |
| 148 virtual ~SyncInternalsUITestWithoutService() {} | 148 virtual ~SyncInternalsUITestWithoutService() {} |
| 149 | 149 |
| 150 virtual void SetUp() { | 150 virtual void SetUp() { |
| 151 NiceMock<ProfileMock>* profile_mock = new NiceMock<ProfileMock>(); | 151 NiceMock<ProfileMock>* profile_mock = new NiceMock<ProfileMock>(); |
| 152 EXPECT_CALL(*profile_mock, GetProfileSyncService()) | 152 EXPECT_CALL(*profile_mock, GetProfileSyncService()) |
| 153 .WillOnce(Return(static_cast<ProfileSyncService*>(NULL))); | 153 .WillOnce(Return(static_cast<browser_sync::ProfileSyncService*>(NULL))); |
| 154 browser_context_.reset(profile_mock); | 154 browser_context_.reset(profile_mock); |
| 155 | 155 |
| 156 ChromeRenderViewHostTestHarness::SetUp(); | 156 ChromeRenderViewHostTestHarness::SetUp(); |
| 157 | 157 |
| 158 { | 158 { |
| 159 // Needed by |sync_internals_ui_|'s constructor. The | 159 // Needed by |sync_internals_ui_|'s constructor. The |
| 160 // message loop is provided by ChromeRenderViewHostTestHarness. | 160 // message loop is provided by ChromeRenderViewHostTestHarness. |
| 161 content::TestBrowserThread ui_thread_(BrowserThread::UI, | 161 content::TestBrowserThread ui_thread_(BrowserThread::UI, |
| 162 base::MessageLoopForUI::current()); | 162 base::MessageLoopForUI::current()); |
| 163 // |sync_internals_ui_|'s constructor triggers all the | 163 // |sync_internals_ui_|'s constructor triggers all the |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 ExecuteJavascript(ASCIIToUTF16(kAboutInfoCall))); | 213 ExecuteJavascript(ASCIIToUTF16(kAboutInfoCall))); |
| 214 | 214 |
| 215 base::ListValue args; | 215 base::ListValue args; |
| 216 sync_internals_ui_->OverrideHandleWebUIMessage( | 216 sync_internals_ui_->OverrideHandleWebUIMessage( |
| 217 GURL(), "getAboutInfo", args); | 217 GURL(), "getAboutInfo", args); |
| 218 } | 218 } |
| 219 | 219 |
| 220 } // namespace | 220 } // namespace |
| 221 | 221 |
| 222 */ | 222 */ |
| OLD | NEW |