| 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/util/extensions_activity_monitor.h" | 5 #include "chrome/browser/sync/util/extensions_activity_monitor.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_extension_api.h" | 12 #include "chrome/browser/bookmarks/bookmark_extension_api.h" |
| 13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
| 15 #include "chrome/common/extensions/extension_constants.h" | 15 #include "chrome/common/extensions/extension_constants.h" |
| 16 #include "content/browser/notification_service_impl.h" | 16 #include "content/public/browser/notification_service.h" |
| 17 #include "content/test/test_browser_thread.h" | 17 #include "content/test/test_browser_thread.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 using browser_sync::ExtensionsActivityMonitor; | 20 using browser_sync::ExtensionsActivityMonitor; |
| 21 using content::BrowserThread; | 21 using content::BrowserThread; |
| 22 namespace keys = extension_manifest_keys; | 22 namespace keys = extension_manifest_keys; |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 const FilePath::CharType kTestExtensionPath1[] = | 26 const FilePath::CharType kTestExtensionPath1[] = |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 DISALLOW_COPY_AND_ASSIGN(BookmarkAPIEventGenerator); | 81 DISALLOW_COPY_AND_ASSIGN(BookmarkAPIEventGenerator); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 } // namespace | 84 } // namespace |
| 85 | 85 |
| 86 void DoUIThreadSetupCallback(content::NotificationService** service, | 86 void DoUIThreadSetupCallback(content::NotificationService** service, |
| 87 base::WaitableEvent* done) { | 87 base::WaitableEvent* done) { |
| 88 *service = new NotificationServiceImpl(); | 88 *service = content::NotificationService::Create(); |
| 89 done->Signal(); | 89 done->Signal(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 class ExtensionsActivityMonitorTest : public testing::Test { | 92 class ExtensionsActivityMonitorTest : public testing::Test { |
| 93 public: | 93 public: |
| 94 ExtensionsActivityMonitorTest() : service_(NULL), | 94 ExtensionsActivityMonitorTest() : service_(NULL), |
| 95 ui_thread_(BrowserThread::UI) { } | 95 ui_thread_(BrowserThread::UI) { } |
| 96 virtual ~ExtensionsActivityMonitorTest() {} | 96 virtual ~ExtensionsActivityMonitorTest() {} |
| 97 | 97 |
| 98 virtual void SetUp() { | 98 virtual void SetUp() { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 generator.NewEvent<CreateBookmarkFunction>(kTestExtensionPath1, | 224 generator.NewEvent<CreateBookmarkFunction>(kTestExtensionPath1, |
| 225 new CreateBookmarkFunction(), 3); | 225 new CreateBookmarkFunction(), 3); |
| 226 monitor->GetAndClearRecords(&results); | 226 monitor->GetAndClearRecords(&results); |
| 227 | 227 |
| 228 EXPECT_EQ(1U, results.size()); | 228 EXPECT_EQ(1U, results.size()); |
| 229 EXPECT_EQ(3U, results[id1].bookmark_write_count); | 229 EXPECT_EQ(3U, results[id1].bookmark_write_count); |
| 230 | 230 |
| 231 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, monitor); | 231 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, monitor); |
| 232 } | 232 } |
| OLD | NEW |