| 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 | 5 |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 function = new WindowsGetFunction(); | 100 function = new WindowsGetFunction(); |
| 101 function->set_extension(extension.get()); | 101 function->set_extension(extension.get()); |
| 102 result.reset(utils::ToDictionary( | 102 result.reset(utils::ToDictionary( |
| 103 utils::RunFunctionAndReturnSingleResult( | 103 utils::RunFunctionAndReturnSingleResult( |
| 104 function.get(), | 104 function.get(), |
| 105 base::StringPrintf( | 105 base::StringPrintf( |
| 106 "[%u]", ExtensionTabUtil::GetWindowId(popup_browser)), | 106 "[%u]", ExtensionTabUtil::GetWindowId(popup_browser)), |
| 107 browser()))); | 107 browser()))); |
| 108 EXPECT_EQ("popup", utils::GetString(result.get(), "type")); | 108 EXPECT_EQ("popup", utils::GetString(result.get(), "type")); |
| 109 | 109 |
| 110 // Panel. | |
| 111 Browser* panel_browser = new Browser( | |
| 112 Browser::CreateParams(Browser::TYPE_PANEL, browser()->profile(), | |
| 113 browser()->host_desktop_type())); | |
| 114 function = new WindowsGetFunction(); | |
| 115 function->set_extension(extension.get()); | |
| 116 result.reset(utils::ToDictionary( | |
| 117 utils::RunFunctionAndReturnSingleResult( | |
| 118 function.get(), | |
| 119 base::StringPrintf( | |
| 120 "[%u]", ExtensionTabUtil::GetWindowId(panel_browser)), | |
| 121 browser()))); | |
| 122 EXPECT_EQ("panel", utils::GetString(result.get(), "type")); | |
| 123 | |
| 124 // Incognito. | 110 // Incognito. |
| 125 Browser* incognito_browser = CreateIncognitoBrowser(); | 111 Browser* incognito_browser = CreateIncognitoBrowser(); |
| 126 int incognito_window_id = ExtensionTabUtil::GetWindowId(incognito_browser); | 112 int incognito_window_id = ExtensionTabUtil::GetWindowId(incognito_browser); |
| 127 | 113 |
| 128 // Without "include_incognito". | 114 // Without "include_incognito". |
| 129 function = new WindowsGetFunction(); | 115 function = new WindowsGetFunction(); |
| 130 function->set_extension(extension.get()); | 116 function->set_extension(extension.get()); |
| 131 EXPECT_TRUE(MatchPattern( | 117 EXPECT_TRUE(MatchPattern( |
| 132 utils::RunFunctionAndReturnError( | 118 utils::RunFunctionAndReturnError( |
| 133 function.get(), | 119 function.get(), |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 int duplicate_tab_index = utils::GetInteger(duplicate_result.get(), "index"); | 582 int duplicate_tab_index = utils::GetInteger(duplicate_result.get(), "index"); |
| 597 EXPECT_EQ(base::Value::TYPE_DICTIONARY, duplicate_result->GetType()); | 583 EXPECT_EQ(base::Value::TYPE_DICTIONARY, duplicate_result->GetType()); |
| 598 // Duplicate tab id should be different from the original tab id. | 584 // Duplicate tab id should be different from the original tab id. |
| 599 EXPECT_NE(tab_id, duplicate_tab_id); | 585 EXPECT_NE(tab_id, duplicate_tab_id); |
| 600 EXPECT_EQ(window_id, duplicate_tab_window_id); | 586 EXPECT_EQ(window_id, duplicate_tab_window_id); |
| 601 EXPECT_EQ(tab_index + 1, duplicate_tab_index); | 587 EXPECT_EQ(tab_index + 1, duplicate_tab_index); |
| 602 // The test empty extension has no permissions, therefore |duplicate_result| | 588 // The test empty extension has no permissions, therefore |duplicate_result| |
| 603 // should not contain url, title, and faviconUrl in the function result. | 589 // should not contain url, title, and faviconUrl in the function result. |
| 604 EXPECT_FALSE(utils::HasPrivacySensitiveFields(duplicate_result.get())); | 590 EXPECT_FALSE(utils::HasPrivacySensitiveFields(duplicate_result.get())); |
| 605 } | 591 } |
| OLD | NEW |