| 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/dom_ui/sync_internals_ui.h" | 5 #include "chrome/browser/dom_ui/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.h" | 10 #include "base/message_loop.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 return NULL; | 103 return NULL; |
| 104 } | 104 } |
| 105 return GetTestSyncInternalsUIAddress(); | 105 return GetTestSyncInternalsUIAddress(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 // Used for passing into EXPECT_CALL(). | 108 // Used for passing into EXPECT_CALL(). |
| 109 TestSyncInternalsUI* GetTestSyncInternalsUIAddress() { | 109 TestSyncInternalsUI* GetTestSyncInternalsUIAddress() { |
| 110 return static_cast<TestSyncInternalsUI*>(test_sync_internals_ui_buf_); | 110 return static_cast<TestSyncInternalsUI*>(test_sync_internals_ui_buf_); |
| 111 } | 111 } |
| 112 | 112 |
| 113 protected: |
| 114 // These need to be created before profile sync service. |
| 115 // Needed by |ui_thread_|. |
| 116 MessageLoopForUI ui_loop_; |
| 117 // Needed by |test_tab_contents_|. |
| 118 BrowserThread ui_thread_; |
| 113 NiceMock<ProfileMock> profile_mock_; | 119 NiceMock<ProfileMock> profile_mock_; |
| 114 StrictMock<ProfileSyncServiceMock> profile_sync_service_mock_; | 120 StrictMock<ProfileSyncServiceMock> profile_sync_service_mock_; |
| 115 StrictMock<browser_sync::MockJsFrontend> mock_js_backend_; | 121 StrictMock<browser_sync::MockJsFrontend> mock_js_backend_; |
| 116 | 122 |
| 117 private: | 123 private: |
| 118 // Needed by |ui_thread_|. | |
| 119 MessageLoopForUI ui_loop_; | |
| 120 // Needed by |test_tab_contents_|. | |
| 121 BrowserThread ui_thread_; | |
| 122 TestTabContents test_tab_contents_; | 124 TestTabContents test_tab_contents_; |
| 123 void* test_sync_internals_ui_buf_; | 125 void* test_sync_internals_ui_buf_; |
| 124 bool test_sync_internals_ui_constructor_called_; | 126 bool test_sync_internals_ui_constructor_called_; |
| 125 }; | 127 }; |
| 126 | 128 |
| 127 TEST_F(SyncInternalsUITest, HandleJsEvent) { | 129 TEST_F(SyncInternalsUITest, HandleJsEvent) { |
| 128 ExpectSetupTeardownCalls(); | 130 ExpectSetupTeardownCalls(); |
| 129 | 131 |
| 130 ConstructTestSyncInternalsUI(); | 132 ConstructTestSyncInternalsUI(); |
| 131 | 133 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 210 |
| 209 ConstructTestSyncInternalsUI(); | 211 ConstructTestSyncInternalsUI(); |
| 210 | 212 |
| 211 EXPECT_CALL(*GetTestSyncInternalsUI(), | 213 EXPECT_CALL(*GetTestSyncInternalsUI(), |
| 212 ExecuteJavascript(std::wstring(kAboutInfoCall))); | 214 ExecuteJavascript(std::wstring(kAboutInfoCall))); |
| 213 | 215 |
| 214 GetTestSyncInternalsUI()->ProcessDOMUIMessage(params); | 216 GetTestSyncInternalsUI()->ProcessDOMUIMessage(params); |
| 215 } | 217 } |
| 216 | 218 |
| 217 } // namespace | 219 } // namespace |
| OLD | NEW |