Update broken references to image assets
[chromium-blink-merge.git] / extensions / browser / guest_view / extension_options / extension_options_apitest.cc
blobc74a3eefec782e983ed93c750b4ae8bb848ee14d
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/files/file_path.h"
6 #include "base/strings/stringprintf.h"
7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/test/base/ui_test_utils.h"
9 #include "extensions/common/feature_switch.h"
10 #include "extensions/common/switches.h"
11 #include "extensions/test/result_catcher.h"
13 using extensions::Extension;
14 using extensions::FeatureSwitch;
16 class ExtensionOptionsApiTest : public ExtensionApiTest {
19 // crbug/415949.
20 #if defined(OS_MACOSX)
21 #define MAYBE_ExtensionCanEmbedOwnOptions DISABLED_ExtensionCanEmbedOwnOptions
22 #else
23 #define MAYBE_ExtensionCanEmbedOwnOptions ExtensionCanEmbedOwnOptions
24 #endif
25 IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest,
26 MAYBE_ExtensionCanEmbedOwnOptions) {
27 base::FilePath extension_dir =
28 test_data_dir_.AppendASCII("extension_options").AppendASCII("embed_self");
29 ASSERT_TRUE(LoadExtension(extension_dir));
30 ASSERT_TRUE(RunExtensionSubtest("extension_options/embed_self", "test.html"));
33 IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest,
34 ShouldNotEmbedOtherExtensionsOptions) {
35 base::FilePath dir = test_data_dir_.AppendASCII("extension_options")
36 .AppendASCII("embed_other");
38 const Extension* embedder = InstallExtension(dir.AppendASCII("embedder"), 1);
39 const Extension* embedded = InstallExtension(dir.AppendASCII("embedded"), 1);
41 ASSERT_TRUE(embedder);
42 ASSERT_TRUE(embedded);
44 // Since the extension id of the embedded extension is not always the same,
45 // store the embedded extension id in the embedder's storage before running
46 // the tests.
47 std::string script = base::StringPrintf(
48 "chrome.storage.local.set({'embeddedId': '%s'}, function() {"
49 "window.domAutomationController.send('done injecting');});",
50 embedded->id().c_str());
52 ExecuteScriptInBackgroundPage(embedder->id(), script);
53 extensions::ResultCatcher catcher;
54 ui_test_utils::NavigateToURL(browser(),
55 embedder->GetResourceURL("test.html"));
56 ASSERT_TRUE(catcher.GetNextResult());
59 IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest,
60 CannotEmbedUsingInvalidExtensionIds) {
61 ASSERT_TRUE(InstallExtension(test_data_dir_.AppendASCII("extension_options")
62 .AppendASCII("embed_invalid"),
63 1));
64 ASSERT_TRUE(
65 RunExtensionSubtest("extension_options/embed_invalid", "test.html"));