| 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 <limits.h> | 5 #include <limits.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 | 1161 |
| 1162 std::unique_ptr<base::DictionaryValue> duplicate_result( | 1162 std::unique_ptr<base::DictionaryValue> duplicate_result( |
| 1163 utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( | 1163 utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( |
| 1164 duplicate_tab_function.get(), base::StringPrintf("[%u]", tab_id), | 1164 duplicate_tab_function.get(), base::StringPrintf("[%u]", tab_id), |
| 1165 browser()))); | 1165 browser()))); |
| 1166 | 1166 |
| 1167 int duplicate_tab_id = GetTabId(duplicate_result.get()); | 1167 int duplicate_tab_id = GetTabId(duplicate_result.get()); |
| 1168 int duplicate_tab_window_id = GetTabWindowId(duplicate_result.get()); | 1168 int duplicate_tab_window_id = GetTabWindowId(duplicate_result.get()); |
| 1169 int duplicate_tab_index = | 1169 int duplicate_tab_index = |
| 1170 api_test_utils::GetInteger(duplicate_result.get(), "index"); | 1170 api_test_utils::GetInteger(duplicate_result.get(), "index"); |
| 1171 EXPECT_EQ(base::Value::TYPE_DICTIONARY, duplicate_result->GetType()); | 1171 EXPECT_EQ(base::Value::Type::DICTIONARY, duplicate_result->GetType()); |
| 1172 // Duplicate tab id should be different from the original tab id. | 1172 // Duplicate tab id should be different from the original tab id. |
| 1173 EXPECT_NE(tab_id, duplicate_tab_id); | 1173 EXPECT_NE(tab_id, duplicate_tab_id); |
| 1174 EXPECT_EQ(window_id, duplicate_tab_window_id); | 1174 EXPECT_EQ(window_id, duplicate_tab_window_id); |
| 1175 EXPECT_EQ(tab_index + 1, duplicate_tab_index); | 1175 EXPECT_EQ(tab_index + 1, duplicate_tab_index); |
| 1176 // The test empty tab extension has tabs permissions, therefore | 1176 // The test empty tab extension has tabs permissions, therefore |
| 1177 // |duplicate_result| should contain url, title, and faviconUrl | 1177 // |duplicate_result| should contain url, title, and faviconUrl |
| 1178 // in the function result. | 1178 // in the function result. |
| 1179 EXPECT_TRUE(utils::HasPrivacySensitiveFields(duplicate_result.get())); | 1179 EXPECT_TRUE(utils::HasPrivacySensitiveFields(duplicate_result.get())); |
| 1180 } | 1180 } |
| 1181 | 1181 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1198 | 1198 |
| 1199 std::unique_ptr<base::DictionaryValue> duplicate_result( | 1199 std::unique_ptr<base::DictionaryValue> duplicate_result( |
| 1200 utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( | 1200 utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( |
| 1201 duplicate_tab_function.get(), base::StringPrintf("[%u]", tab_id), | 1201 duplicate_tab_function.get(), base::StringPrintf("[%u]", tab_id), |
| 1202 browser()))); | 1202 browser()))); |
| 1203 | 1203 |
| 1204 int duplicate_tab_id = GetTabId(duplicate_result.get()); | 1204 int duplicate_tab_id = GetTabId(duplicate_result.get()); |
| 1205 int duplicate_tab_window_id = GetTabWindowId(duplicate_result.get()); | 1205 int duplicate_tab_window_id = GetTabWindowId(duplicate_result.get()); |
| 1206 int duplicate_tab_index = | 1206 int duplicate_tab_index = |
| 1207 api_test_utils::GetInteger(duplicate_result.get(), "index"); | 1207 api_test_utils::GetInteger(duplicate_result.get(), "index"); |
| 1208 EXPECT_EQ(base::Value::TYPE_DICTIONARY, duplicate_result->GetType()); | 1208 EXPECT_EQ(base::Value::Type::DICTIONARY, duplicate_result->GetType()); |
| 1209 // Duplicate tab id should be different from the original tab id. | 1209 // Duplicate tab id should be different from the original tab id. |
| 1210 EXPECT_NE(tab_id, duplicate_tab_id); | 1210 EXPECT_NE(tab_id, duplicate_tab_id); |
| 1211 EXPECT_EQ(window_id, duplicate_tab_window_id); | 1211 EXPECT_EQ(window_id, duplicate_tab_window_id); |
| 1212 EXPECT_EQ(tab_index + 1, duplicate_tab_index); | 1212 EXPECT_EQ(tab_index + 1, duplicate_tab_index); |
| 1213 // The test empty extension has no permissions, therefore |duplicate_result| | 1213 // The test empty extension has no permissions, therefore |duplicate_result| |
| 1214 // should not contain url, title, and faviconUrl in the function result. | 1214 // should not contain url, title, and faviconUrl in the function result. |
| 1215 EXPECT_FALSE(utils::HasPrivacySensitiveFields(duplicate_result.get())); | 1215 EXPECT_FALSE(utils::HasPrivacySensitiveFields(duplicate_result.get())); |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, NoTabsEventOnDevTools) { | 1218 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, NoTabsEventOnDevTools) { |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2141 EXPECT_EQ(first_web_contents, | 2141 EXPECT_EQ(first_web_contents, |
| 2142 browser()->tab_strip_model()->GetActiveWebContents()); | 2142 browser()->tab_strip_model()->GetActiveWebContents()); |
| 2143 browser()->tab_strip_model()->ActivateTabAt(1, true); | 2143 browser()->tab_strip_model()->ActivateTabAt(1, true); |
| 2144 EXPECT_EQ(second_web_contents, | 2144 EXPECT_EQ(second_web_contents, |
| 2145 browser()->tab_strip_model()->GetActiveWebContents()); | 2145 browser()->tab_strip_model()->GetActiveWebContents()); |
| 2146 | 2146 |
| 2147 EXPECT_EQ(url, second_web_contents->GetVisibleURL()); | 2147 EXPECT_EQ(url, second_web_contents->GetVisibleURL()); |
| 2148 } | 2148 } |
| 2149 | 2149 |
| 2150 } // namespace extensions | 2150 } // namespace extensions |
| OLD | NEW |