| 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/glue/chrome_extensions_activity_monitor.h" | 5 #include "chrome/browser/sync/glue/chrome_extensions_activity_monitor.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 scoped_refptr<Extension> MakeExtension(const std::string& name) { | 30 scoped_refptr<Extension> MakeExtension(const std::string& name) { |
| 31 FilePath path; | 31 FilePath path; |
| 32 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &path)); | 32 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &path)); |
| 33 path = path.AppendASCII(name); | 33 path = path.AppendASCII(name); |
| 34 | 34 |
| 35 DictionaryValue value; | 35 DictionaryValue value; |
| 36 value.SetString(keys::kVersion, "1.0.0.0"); | 36 value.SetString(keys::kVersion, "1.0.0.0"); |
| 37 value.SetString(keys::kName, name); | 37 value.SetString(keys::kName, name); |
| 38 std::string error; | 38 std::string error; |
| 39 scoped_refptr<Extension> extension(Extension::Create( | 39 scoped_refptr<Extension> extension(Extension::Create( |
| 40 path, Extension::INVALID, value, Extension::NO_FLAGS, &error)); | 40 path, extensions::Manifest::INVALID_LOCATION, value, |
| 41 Extension::NO_FLAGS, &error)); |
| 41 EXPECT_TRUE(error.empty()); | 42 EXPECT_TRUE(error.empty()); |
| 42 return extension; | 43 return extension; |
| 43 } | 44 } |
| 44 | 45 |
| 45 // Fire a bookmarks API event from the given extension the given | 46 // Fire a bookmarks API event from the given extension the given |
| 46 // number of times. | 47 // number of times. |
| 47 template <class T> | 48 template <class T> |
| 48 void FireBookmarksApiEvent( | 49 void FireBookmarksApiEvent( |
| 49 const scoped_refptr<Extension>& extension, int repeats) { | 50 const scoped_refptr<Extension>& extension, int repeats) { |
| 50 scoped_refptr<T> bookmarks_function(new T()); | 51 scoped_refptr<T> bookmarks_function(new T()); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 FireBookmarksApiEvent<extensions::BookmarksCreateFunction>(extension1_, 3); | 165 FireBookmarksApiEvent<extensions::BookmarksCreateFunction>(extension1_, 3); |
| 165 monitor_.GetAndClearRecords(&results); | 166 monitor_.GetAndClearRecords(&results); |
| 166 | 167 |
| 167 EXPECT_EQ(1U, results.size()); | 168 EXPECT_EQ(1U, results.size()); |
| 168 EXPECT_EQ(3U, results[id1_].bookmark_write_count); | 169 EXPECT_EQ(3U, results[id1_].bookmark_write_count); |
| 169 } | 170 } |
| 170 | 171 |
| 171 } // namespace | 172 } // namespace |
| 172 | 173 |
| 173 } // namespace browser_sync | 174 } // namespace browser_sync |
| OLD | NEW |