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

Side by Side Diff: chrome/browser/apps/guest_view/extension_view/extension_view_browsertest.cc

Issue 1865103002: Implement ExtensionView based on out-of-process iframes GuestView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extensionoptions
Patch Set: addressing comments Created 4 years, 8 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 | extensions/renderer/dispatcher.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 2014 The Chromium Authors. All rights reserved. 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 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 "base/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "chrome/browser/apps/app_browsertest_util.h" 6 #include "chrome/browser/apps/app_browsertest_util.h"
7 #include "chrome/test/base/ui_test_utils.h" 7 #include "chrome/test/base/ui_test_utils.h"
8 #include "components/guest_view/browser/guest_view_manager.h" 8 #include "components/guest_view/browser/guest_view_manager.h"
9 #include "components/guest_view/browser/guest_view_manager_delegate.h" 9 #include "components/guest_view/browser/guest_view_manager_delegate.h"
10 #include "components/guest_view/browser/guest_view_manager_factory.h" 10 #include "components/guest_view/browser/guest_view_manager_factory.h"
11 #include "components/guest_view/browser/test_guest_view_manager.h" 11 #include "components/guest_view/browser/test_guest_view_manager.h"
12 #include "content/public/common/content_switches.h"
12 #include "content/public/test/browser_test_utils.h" 13 #include "content/public/test/browser_test_utils.h"
13 #include "extensions/browser/api/extensions_api_client.h" 14 #include "extensions/browser/api/extensions_api_client.h"
14 #include "extensions/test/extension_test_message_listener.h" 15 #include "extensions/test/extension_test_message_listener.h"
16 #include "testing/gtest/include/gtest/gtest.h"
15 17
16 using extensions::ExtensionsAPIClient; 18 using extensions::ExtensionsAPIClient;
17 using guest_view::GuestViewManager; 19 using guest_view::GuestViewManager;
18 using guest_view::TestGuestViewManager; 20 using guest_view::TestGuestViewManager;
19 using guest_view::TestGuestViewManagerFactory; 21 using guest_view::TestGuestViewManagerFactory;
20 22
21 class ExtensionViewTest : public extensions::PlatformAppBrowserTest { 23 class ExtensionViewTest : public extensions::PlatformAppBrowserTest,
24 public testing::WithParamInterface<bool> {
22 public: 25 public:
23 ExtensionViewTest() { 26 ExtensionViewTest() {
24 GuestViewManager::set_factory_for_testing(&factory_); 27 GuestViewManager::set_factory_for_testing(&factory_);
25 } 28 }
26 29
27 TestGuestViewManager* GetGuestViewManager() { 30 TestGuestViewManager* GetGuestViewManager() {
28 TestGuestViewManager* manager = static_cast<TestGuestViewManager*>( 31 TestGuestViewManager* manager = static_cast<TestGuestViewManager*>(
29 TestGuestViewManager::FromBrowserContext(browser()->profile())); 32 TestGuestViewManager::FromBrowserContext(browser()->profile()));
30 // TestGuestViewManager::WaitForSingleGuestCreated may and will get called 33 // TestGuestViewManager::WaitForSingleGuestCreated may and will get called
31 // before a guest is created. 34 // before a guest is created.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 second_app_to_embed.c_str()))) { 67 second_app_to_embed.c_str()))) {
65 LOG(ERROR) << "UNABLE TO START TEST."; 68 LOG(ERROR) << "UNABLE TO START TEST.";
66 return; 69 return;
67 } 70 }
68 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); 71 ASSERT_TRUE(done_listener.WaitUntilSatisfied());
69 } 72 }
70 73
71 private: 74 private:
72 void SetUpCommandLine(base::CommandLine* command_line) override { 75 void SetUpCommandLine(base::CommandLine* command_line) override {
73 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); 76 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
77
78 bool use_cross_process_frames_for_guests = GetParam();
79 if (use_cross_process_frames_for_guests)
80 command_line->AppendSwitch(switches::kUseCrossProcessFramesForGuests);
74 } 81 }
75 82
76 TestGuestViewManagerFactory factory_; 83 TestGuestViewManagerFactory factory_;
77 }; 84 };
78 85
86 INSTANTIATE_TEST_CASE_P(ExtensionViewTests, ExtensionViewTest, testing::Bool());
87
79 // Tests that <extensionview> can be created and added to the DOM. 88 // Tests that <extensionview> can be created and added to the DOM.
80 IN_PROC_BROWSER_TEST_F(ExtensionViewTest, 89 IN_PROC_BROWSER_TEST_P(ExtensionViewTest,
81 TestExtensionViewCreationShouldSucceed) { 90 TestExtensionViewCreationShouldSucceed) {
82 TestHelper("testExtensionViewCreationShouldSucceed", 91 TestHelper("testExtensionViewCreationShouldSucceed",
83 "extension_view/creation", "", ""); 92 "extension_view/creation", "", "");
84 } 93 }
85 94
86 // Tests that verify that <extensionview> does not change extension ID if 95 // Tests that verify that <extensionview> does not change extension ID if
87 // someone tries to change it in JavaScript. 96 // someone tries to change it in JavaScript.
88 IN_PROC_BROWSER_TEST_F(ExtensionViewTest, ShimExtensionAttribute) { 97 IN_PROC_BROWSER_TEST_P(ExtensionViewTest, ShimExtensionAttribute) {
89 const extensions::Extension* skeleton_app = 98 const extensions::Extension* skeleton_app =
90 InstallPlatformApp("extension_view/skeleton"); 99 InstallPlatformApp("extension_view/skeleton");
91 TestHelper("testExtensionAttribute", "extension_view/extension_attribute", 100 TestHelper("testExtensionAttribute", "extension_view/extension_attribute",
92 skeleton_app->id(), ""); 101 skeleton_app->id(), "");
93 } 102 }
94 103
95 // Tests that verify that <extensionview> does not change src if 104 // Tests that verify that <extensionview> does not change src if
96 // someone tries to change it in JavaScript. 105 // someone tries to change it in JavaScript.
97 IN_PROC_BROWSER_TEST_F(ExtensionViewTest, ShimSrcAttribute) { 106 IN_PROC_BROWSER_TEST_P(ExtensionViewTest, ShimSrcAttribute) {
98 const extensions::Extension* skeleton_app = 107 const extensions::Extension* skeleton_app =
99 InstallPlatformApp("extension_view/skeleton"); 108 InstallPlatformApp("extension_view/skeleton");
100 TestHelper("testSrcAttribute", "extension_view/src_attribute", 109 TestHelper("testSrcAttribute", "extension_view/src_attribute",
101 skeleton_app->id(), ""); 110 skeleton_app->id(), "");
102 } 111 }
103 112
104 // Tests that verify that <extensionview> can call the load function. 113 // Tests that verify that <extensionview> can call the load function.
105 // Flaky under MemorySanitizer: https://crbug.com/545656 114 // Flaky under MemorySanitizer: https://crbug.com/545656
106 IN_PROC_BROWSER_TEST_F(ExtensionViewTest, DISABLED_LoadAPICall) { 115 IN_PROC_BROWSER_TEST_P(ExtensionViewTest, DISABLED_LoadAPICall) {
107 const extensions::Extension* skeleton_app = 116 const extensions::Extension* skeleton_app =
108 InstallPlatformApp("extension_view/skeleton"); 117 InstallPlatformApp("extension_view/skeleton");
109 const extensions::Extension* skeleton_app_two = 118 const extensions::Extension* skeleton_app_two =
110 InstallPlatformApp("extension_view/skeleton_two"); 119 InstallPlatformApp("extension_view/skeleton_two");
111 TestHelper("testLoadAPIFunction", "extension_view/load_api", 120 TestHelper("testLoadAPIFunction", "extension_view/load_api",
112 skeleton_app->id(), 121 skeleton_app->id(),
113 skeleton_app_two->id()); 122 skeleton_app_two->id());
114 } 123 }
115 124
116 // Flaky under MemorySanitizer: https://crbug.com/512092 125 // Flaky under MemorySanitizer: https://crbug.com/512092
117 // Flaky elsewhere: https://crbug.com/538114 126 // Flaky elsewhere: https://crbug.com/538114
118 // Tests that verify that <extensionview> can queue up multiple calls to the 127 // Tests that verify that <extensionview> can queue up multiple calls to the
119 // load function. 128 // load function.
120 IN_PROC_BROWSER_TEST_F(ExtensionViewTest, DISABLED_QueuedLoadAPICall) { 129 IN_PROC_BROWSER_TEST_P(ExtensionViewTest, DISABLED_QueuedLoadAPICall) {
121 const extensions::Extension* skeleton_app = 130 const extensions::Extension* skeleton_app =
122 InstallPlatformApp("extension_view/skeleton"); 131 InstallPlatformApp("extension_view/skeleton");
123 const extensions::Extension* skeleton_app_two = 132 const extensions::Extension* skeleton_app_two =
124 InstallPlatformApp("extension_view/skeleton_two"); 133 InstallPlatformApp("extension_view/skeleton_two");
125 TestHelper("testQueuedLoadAPIFunction", "extension_view/load_api", 134 TestHelper("testQueuedLoadAPIFunction", "extension_view/load_api",
126 skeleton_app->id(), 135 skeleton_app->id(),
127 skeleton_app_two->id()); 136 skeleton_app_two->id());
128 } 137 }
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698