| 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.h" | 5 #include "chrome/browser/extensions/extension_action.h" |
| 6 #include "chrome/browser/extensions/extension_action_manager.h" | 6 #include "chrome/browser/extensions/extension_action_manager.h" |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "chrome/browser/extensions/extension_tab_util.h" | 8 #include "chrome/browser/extensions/extension_tab_util.h" |
| 9 #include "chrome/browser/extensions/extension_test_message_listener.h" | 9 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 11 #include "chrome/common/extensions/features/feature.h" | 11 #include "chrome/common/extensions/features/feature_channel.h" |
| 12 #include "content/public/test/browser_test_utils.h" | 12 #include "content/public/test/browser_test_utils.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 class DeclarativeContentApiTest : public ExtensionApiTest { | 17 class DeclarativeContentApiTest : public ExtensionApiTest { |
| 18 public: | 18 public: |
| 19 DeclarativeContentApiTest() | 19 DeclarativeContentApiTest() |
| 20 // Set the channel to "trunk" since declarativeContent is restricted | 20 // Set the channel to "trunk" since declarativeContent is restricted |
| 21 // to trunk. | 21 // to trunk. |
| 22 : current_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) { | 22 : current_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) { |
| 23 } | 23 } |
| 24 virtual ~DeclarativeContentApiTest() {} | 24 virtual ~DeclarativeContentApiTest() {} |
| 25 | 25 |
| 26 extensions::Feature::ScopedCurrentChannel current_channel_; | 26 extensions::ScopedCurrentChannel current_channel_; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest, Overview) { | 29 IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest, Overview) { |
| 30 ExtensionTestMessageListener ready("ready", true); | 30 ExtensionTestMessageListener ready("ready", true); |
| 31 const Extension* extension = | 31 const Extension* extension = |
| 32 LoadExtension(test_data_dir_.AppendASCII("declarative_content/overview")); | 32 LoadExtension(test_data_dir_.AppendASCII("declarative_content/overview")); |
| 33 ASSERT_TRUE(extension); | 33 ASSERT_TRUE(extension); |
| 34 const ExtensionAction* page_action = | 34 const ExtensionAction* page_action = |
| 35 ExtensionActionManager::Get(browser()->profile())-> | 35 ExtensionActionManager::Get(browser()->profile())-> |
| 36 GetPageAction(*extension); | 36 GetPageAction(*extension); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 63 ASSERT_TRUE(content::ExecuteScript( | 63 ASSERT_TRUE(content::ExecuteScript( |
| 64 tab, "document.body.innerHTML = 'Hello world';")); | 64 tab, "document.body.innerHTML = 'Hello world';")); |
| 65 // Give the mutation observer a chance to run and send back the | 65 // Give the mutation observer a chance to run and send back the |
| 66 // matching-selector update. | 66 // matching-selector update. |
| 67 ASSERT_TRUE(content::ExecuteScript(tab, std::string())); | 67 ASSERT_TRUE(content::ExecuteScript(tab, std::string())); |
| 68 EXPECT_FALSE(page_action->GetIsVisible(tab_id)); | 68 EXPECT_FALSE(page_action->GetIsVisible(tab_id)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 } // namespace extensions | 72 } // namespace extensions |
| OLD | NEW |