| 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/extensions/extension_action_manager.h" | 5 #include "chrome/browser/extensions/extension_action_manager.h" |
| 6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
| 7 #include "chrome/browser/extensions/extension_tab_util.h" | 7 #include "chrome/browser/extensions/extension_tab_util.h" |
| 8 #include "chrome/browser/extensions/test_extension_dir.h" | 8 #include "chrome/browser/extensions/test_extension_dir.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 10 #include "chrome/common/extensions/features/feature_channel.h" | 10 #include "chrome/common/extensions/features/feature_channel.h" |
| 11 #include "extensions/test/extension_test_message_listener.h" | 11 #include "extensions/test/extension_test_message_listener.h" |
| 12 #include "ui/gfx/image/image_skia.h" | 12 #include "ui/gfx/image/image.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 const char kDeclarativeContentManifest[] = | 17 const char kDeclarativeContentManifest[] = |
| 18 "{\n" | 18 "{\n" |
| 19 " \"name\": \"Declarative Content apitest\",\n" | 19 " \"name\": \"Declarative Content apitest\",\n" |
| 20 " \"version\": \"0.1\",\n" | 20 " \"version\": \"0.1\",\n" |
| 21 " \"manifest_version\": 2,\n" | 21 " \"manifest_version\": 2,\n" |
| 22 " \"description\": \n" | 22 " \"description\": \n" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ExtensionActionManager::Get(browser()->profile())-> | 77 ExtensionActionManager::Get(browser()->profile())-> |
| 78 GetPageAction(*extension); | 78 GetPageAction(*extension); |
| 79 ASSERT_TRUE(page_action); | 79 ASSERT_TRUE(page_action); |
| 80 | 80 |
| 81 ASSERT_TRUE(ready.WaitUntilSatisfied()); | 81 ASSERT_TRUE(ready.WaitUntilSatisfied()); |
| 82 content::WebContents* const tab = | 82 content::WebContents* const tab = |
| 83 browser()->tab_strip_model()->GetWebContentsAt(0); | 83 browser()->tab_strip_model()->GetWebContentsAt(0); |
| 84 const int tab_id = ExtensionTabUtil::GetTabId(tab); | 84 const int tab_id = ExtensionTabUtil::GetTabId(tab); |
| 85 | 85 |
| 86 // There should be no declarative icon until we navigate to a matched page. | 86 // There should be no declarative icon until we navigate to a matched page. |
| 87 EXPECT_TRUE(page_action->GetDeclarativeIcon(tab_id).bitmap()->empty()); | 87 EXPECT_TRUE(page_action->GetDeclarativeIcon(tab_id).IsEmpty()); |
| 88 NavigateInRenderer(tab, GURL("http://test1/")); | 88 NavigateInRenderer(tab, GURL("http://test1/")); |
| 89 EXPECT_FALSE(page_action->GetDeclarativeIcon(tab_id).bitmap()->empty()); | 89 EXPECT_FALSE(page_action->GetDeclarativeIcon(tab_id).IsEmpty()); |
| 90 | 90 |
| 91 // Navigating to an unmatched page should reset the icon. | 91 // Navigating to an unmatched page should reset the icon. |
| 92 NavigateInRenderer(tab, GURL("http://test2/")); | 92 NavigateInRenderer(tab, GURL("http://test2/")); |
| 93 EXPECT_TRUE(page_action->GetDeclarativeIcon(tab_id).bitmap()->empty()); | 93 EXPECT_TRUE(page_action->GetDeclarativeIcon(tab_id).IsEmpty()); |
| 94 } | 94 } |
| 95 } // namespace | 95 } // namespace |
| 96 } // namespace extensions | 96 } // namespace extensions |
| OLD | NEW |