Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: chrome/browser/extensions/api/declarative_content/content_action_unittest.cc

Issue 1761913003: [Extensions] Default-enable the toolbar redesign on trunk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_action_icon_factory_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/api/declarative_content/content_action.h" 5 #include "chrome/browser/extensions/api/declarative_content/content_action.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/test/values_test_util.h" 11 #include "base/test/values_test_util.h"
12 #include "chrome/browser/extensions/extension_action.h" 12 #include "chrome/browser/extensions/extension_action.h"
13 #include "chrome/browser/extensions/extension_action_manager.h" 13 #include "chrome/browser/extensions/extension_action_manager.h"
14 #include "chrome/browser/extensions/extension_service_test_base.h" 14 #include "chrome/browser/extensions/extension_service_test_base.h"
15 #include "chrome/browser/extensions/extension_tab_util.h" 15 #include "chrome/browser/extensions/extension_tab_util.h"
16 #include "chrome/browser/extensions/test_extension_environment.h" 16 #include "chrome/browser/extensions/test_extension_environment.h"
17 #include "chrome/browser/extensions/test_extension_system.h" 17 #include "chrome/browser/extensions/test_extension_system.h"
18 #include "chrome/test/base/testing_profile.h" 18 #include "chrome/test/base/testing_profile.h"
19 #include "chrome/test/base/testing_profile.h" 19 #include "chrome/test/base/testing_profile.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 #include "extensions/browser/extension_system.h" 21 #include "extensions/browser/extension_system.h"
22 #include "extensions/common/extension.h" 22 #include "extensions/common/extension.h"
23 #include "extensions/common/extension_builder.h" 23 #include "extensions/common/extension_builder.h"
24 #include "extensions/common/feature_switch.h"
24 #include "extensions/common/value_builder.h" 25 #include "extensions/common/value_builder.h"
25 #include "ipc/ipc_message_utils.h" 26 #include "ipc/ipc_message_utils.h"
26 #include "testing/gmock/include/gmock/gmock.h" 27 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
28 #include "third_party/skia/include/core/SkBitmap.h" 29 #include "third_party/skia/include/core/SkBitmap.h"
29 #include "ui/gfx/image/image.h" 30 #include "ui/gfx/image/image.h"
30 #include "ui/gfx/ipc/gfx_param_traits.h" 31 #include "ui/gfx/ipc/gfx_param_traits.h"
31 32
32 namespace extensions { 33 namespace extensions {
33 namespace { 34 namespace {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 result = ContentAction::Create(NULL, NULL, *ParseJson( 92 result = ContentAction::Create(NULL, NULL, *ParseJson(
92 "{\n" 93 "{\n"
93 " \"instanceType\": \"declarativeContent.UnknownType\",\n" 94 " \"instanceType\": \"declarativeContent.UnknownType\",\n"
94 "}"), 95 "}"),
95 &error); 96 &error);
96 EXPECT_THAT(error, HasSubstr("invalid instanceType")); 97 EXPECT_THAT(error, HasSubstr("invalid instanceType"));
97 EXPECT_FALSE(result.get()); 98 EXPECT_FALSE(result.get());
98 } 99 }
99 100
100 TEST(DeclarativeContentActionTest, ShowPageActionWithoutPageAction) { 101 TEST(DeclarativeContentActionTest, ShowPageActionWithoutPageAction) {
102 // Tests legacy behavior.
103 FeatureSwitch::ScopedOverride action_redesign_override(
104 FeatureSwitch::extension_action_redesign(), false);
101 TestExtensionEnvironment env; 105 TestExtensionEnvironment env;
102 106
103 const Extension* extension = env.MakeExtension(base::DictionaryValue()); 107 const Extension* extension = env.MakeExtension(base::DictionaryValue());
104 std::string error; 108 std::string error;
105 scoped_ptr<const ContentAction> result = ContentAction::Create( 109 scoped_ptr<const ContentAction> result = ContentAction::Create(
106 NULL, 110 NULL,
107 extension, 111 extension,
108 *ParseJson( 112 *ParseJson(
109 "{\n" 113 "{\n"
110 " \"instanceType\": \"declarativeContent.ShowPageAction\",\n" 114 " \"instanceType\": \"declarativeContent.ShowPageAction\",\n"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 " \"instanceType\": \"declarativeContent.RequestContentScript\",\n" 344 " \"instanceType\": \"declarativeContent.RequestContentScript\",\n"
341 " \"js\": [\"script.js\"],\n" 345 " \"js\": [\"script.js\"],\n"
342 " \"matchAboutBlank\": null\n" 346 " \"matchAboutBlank\": null\n"
343 "}"), 347 "}"),
344 &error); 348 &error);
345 ASSERT_FALSE(result.get()); 349 ASSERT_FALSE(result.get());
346 } 350 }
347 351
348 } // namespace 352 } // namespace
349 } // namespace extensions 353 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_action_icon_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698