Chromium Code Reviews| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 6 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 7 #include "chrome/browser/extensions/browser_action_test_util.h" | 7 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 8 #include "chrome/browser/extensions/extension_action.h" | 8 #include "chrome/browser/extensions/extension_action.h" |
| 9 #include "chrome/browser/extensions/extension_action_icon_factory.h" | 9 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
| 10 #include "chrome/browser/extensions/extension_action_manager.h" | 10 #include "chrome/browser/extensions/extension_action_manager.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 GetBrowserActionsBar()->Press(0); | 324 GetBrowserActionsBar()->Press(0); |
| 325 ASSERT_FALSE(catcher.GetNextResult()); | 325 ASSERT_FALSE(catcher.GetNextResult()); |
| 326 EXPECT_EQ(kEmptyImageDataError, catcher.message()); | 326 EXPECT_EQ(kEmptyImageDataError, catcher.message()); |
| 327 | 327 |
| 328 // Try setting icon with empty dictionary of path objects. | 328 // Try setting icon with empty dictionary of path objects. |
| 329 GetBrowserActionsBar()->Press(0); | 329 GetBrowserActionsBar()->Press(0); |
| 330 ASSERT_FALSE(catcher.GetNextResult()); | 330 ASSERT_FALSE(catcher.GetNextResult()); |
| 331 EXPECT_EQ(kEmptyPathError, catcher.message()); | 331 EXPECT_EQ(kEmptyPathError, catcher.message()); |
| 332 } | 332 } |
| 333 | 333 |
| 334 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, MultiIcons) { | |
|
Devlin
2015/12/17 17:23:08
Can this be a unittest?
Evan Stade
2015/12/17 20:15:58
There already is a unit test that does almost exac
Devlin
2015/12/17 22:05:58
This should be doable with a "unittest" (here basi
Evan Stade
2015/12/17 22:56:06
thanks for the pointer. Done.
| |
| 335 ASSERT_TRUE( | |
| 336 RunExtensionTestIgnoreManifestWarnings("browser_action/multi_icons")) | |
| 337 << message_; | |
| 338 const Extension* extension = GetSingleLoadedExtension(); | |
| 339 ASSERT_TRUE(extension) << message_; | |
| 340 | |
| 341 EXPECT_EQ(0U, extension->install_warnings().size()); | |
| 342 const ActionInfo* browser_action_info = | |
| 343 ActionInfo::GetBrowserActionInfo(extension); | |
| 344 ASSERT_TRUE(browser_action_info); | |
| 345 ASSERT_FALSE(browser_action_info->default_icon.empty()); | |
| 346 | |
| 347 const ExtensionIconSet& icons = browser_action_info->default_icon; | |
| 348 | |
| 349 // 24px icon should be included. | |
| 350 EXPECT_EQ(3u, icons.map().size()); | |
| 351 EXPECT_EQ("icon19.png", icons.Get(19, ExtensionIconSet::MATCH_EXACTLY)); | |
| 352 EXPECT_EQ("icon24.png", icons.Get(24, ExtensionIconSet::MATCH_EXACTLY)); | |
| 353 EXPECT_EQ("icon38.png", icons.Get(38, ExtensionIconSet::MATCH_EXACTLY)); | |
| 354 } | |
| 355 | |
| 334 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, TabSpecificBrowserActionState) { | 356 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, TabSpecificBrowserActionState) { |
| 335 ASSERT_TRUE(RunExtensionTest("browser_action/tab_specific_state")) << | 357 ASSERT_TRUE(RunExtensionTest("browser_action/tab_specific_state")) << |
| 336 message_; | 358 message_; |
| 337 const Extension* extension = GetSingleLoadedExtension(); | 359 const Extension* extension = GetSingleLoadedExtension(); |
| 338 ASSERT_TRUE(extension) << message_; | 360 ASSERT_TRUE(extension) << message_; |
| 339 | 361 |
| 340 // Test that there is a browser action in the toolbar and that it has an icon. | 362 // Test that there is a browser action in the toolbar and that it has an icon. |
| 341 ASSERT_EQ(1, GetBrowserActionsBar()->NumberOfBrowserActions()); | 363 ASSERT_EQ(1, GetBrowserActionsBar()->NumberOfBrowserActions()); |
| 342 EXPECT_TRUE(GetBrowserActionsBar()->HasIcon(0)); | 364 EXPECT_TRUE(GetBrowserActionsBar()->HasIcon(0)); |
| 343 | 365 |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 727 std::string result; | 749 std::string result; |
| 728 EXPECT_TRUE( | 750 EXPECT_TRUE( |
| 729 content::ExecuteScriptAndExtractString(frame_host, script, &result)); | 751 content::ExecuteScriptAndExtractString(frame_host, script, &result)); |
| 730 EXPECT_EQ("DONE", result); | 752 EXPECT_EQ("DONE", result); |
| 731 | 753 |
| 732 EXPECT_TRUE(actions_bar->HidePopup()); | 754 EXPECT_TRUE(actions_bar->HidePopup()); |
| 733 } | 755 } |
| 734 | 756 |
| 735 } // namespace | 757 } // namespace |
| 736 } // namespace extensions | 758 } // namespace extensions |
| OLD | NEW |