| 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 <string> | 5 #include <string> |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "chrome/browser/extensions/activity_database.h" | 9 #include "chrome/browser/extensions/activity_database.h" |
| 10 #include "chrome/browser/extensions/api_actions.h" | 10 #include "chrome/browser/extensions/api_actions.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 ASSERT_EQ("CALL", statement.ColumnString(2)); | 74 ASSERT_EQ("CALL", statement.ColumnString(2)); |
| 75 ASSERT_EQ("READ", statement.ColumnString(3)); | 75 ASSERT_EQ("READ", statement.ColumnString(3)); |
| 76 ASSERT_EQ("BOOKMARK", statement.ColumnString(4)); | 76 ASSERT_EQ("BOOKMARK", statement.ColumnString(4)); |
| 77 ASSERT_EQ("brewster", statement.ColumnString(5)); | 77 ASSERT_EQ("brewster", statement.ColumnString(5)); |
| 78 ASSERT_EQ("woof", statement.ColumnString(6)); | 78 ASSERT_EQ("woof", statement.ColumnString(6)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 // Check that blocked actions are recorded in the db. | 81 // Check that blocked actions are recorded in the db. |
| 82 TEST(ActivityDatabaseTest, RecordBlockedAction) { | 82 TEST(ActivityDatabaseTest, RecordBlockedAction) { |
| 83 base::ScopedTempDir temp_dir; | 83 base::ScopedTempDir temp_dir; |
| 84 FilePath db_file; | 84 base::FilePath db_file; |
| 85 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 85 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 86 db_file = temp_dir.path().AppendASCII("ActivityRecord.db"); | 86 db_file = temp_dir.path().AppendASCII("ActivityRecord.db"); |
| 87 file_util::Delete(db_file, false); | 87 file_util::Delete(db_file, false); |
| 88 | 88 |
| 89 ActivityDatabase* activity_db = new ActivityDatabase(); | 89 ActivityDatabase* activity_db = new ActivityDatabase(); |
| 90 activity_db->AddRef(); | 90 activity_db->AddRef(); |
| 91 activity_db->Init(db_file); | 91 activity_db->Init(db_file); |
| 92 ASSERT_TRUE(activity_db->initialized()); | 92 ASSERT_TRUE(activity_db->initialized()); |
| 93 scoped_refptr<BlockedAction> action = new BlockedAction( | 93 scoped_refptr<BlockedAction> action = new BlockedAction( |
| 94 "punky", | 94 "punky", |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 "brewster", | 135 "brewster", |
| 136 "woooof", | 136 "woooof", |
| 137 "extra"); | 137 "extra"); |
| 138 activity_db->RecordAction(action); | 138 activity_db->RecordAction(action); |
| 139 activity_db->Close(); | 139 activity_db->Close(); |
| 140 activity_db->Release(); | 140 activity_db->Release(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace | 143 } // namespace |
| 144 | 144 |
| OLD | NEW |