This source file includes following definitions.
- IN_PROC_BROWSER_TEST_F
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
using extensions::Extension;
static const char kScriptClickOptionButton[] =
"(function() { "
" var button = document.querySelector('.options-link');"
" button.click();"
"})();";
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_OptionsPage) {
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
size_t installed_extensions = service->extensions()->size();
const Extension* extension =
InstallExtension(test_data_dir_.AppendASCII("options.crx"), 1);
ASSERT_TRUE(extension);
EXPECT_EQ(installed_extensions + 1, service->extensions()->size());
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIExtensionsURL));
TabStripModel* tab_strip = browser()->tab_strip_model();
ui_test_utils::WindowedTabAddedNotificationObserver observer(
content::NotificationService::AllSources());
content::RenderFrameHost* frame = content::FrameMatchingPredicate(
tab_strip->GetActiveWebContents(),
base::Bind(&content::FrameHasSourceUrl,
GURL(chrome::kChromeUIExtensionsFrameURL)));
EXPECT_TRUE(content::ExecuteScript(
frame,
kScriptClickOptionButton));
observer.Wait();
EXPECT_EQ(2, tab_strip->count());
EXPECT_EQ(extension->GetResourceURL("options.html"),
tab_strip->GetWebContentsAt(1)->GetURL());
}