Commit 49c08c85 authored by dzhioev's avatar dzhioev Committed by Commit bot

Remove InlineLoginHandlerChromeOS and exclude InlineLoginUI from CrOS build.

BUG=546731
TBR=sky@chromium.org

Review URL: https://codereview.chromium.org/1536553002

Cr-Commit-Position: refs/heads/master@{#371993}
parent 7963c649
......@@ -42,7 +42,7 @@
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/policy/test/local_policy_test_server.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/signin/inline_login_ui.h"
#include "chrome/browser/ui/webui/signin/get_auth_frame.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
......@@ -866,8 +866,8 @@ guest_view::TestGuestViewManager* SAMLEnrollmentTest::GetGuestViewManager() {
}
content::WebContents* SAMLEnrollmentTest::GetEnrollmentContents() {
content::RenderFrameHost* frame_host = InlineLoginUI::GetAuthFrame(
GetLoginUI()->GetWebContents(), GURL(), gaia_frame_parent_);
content::RenderFrameHost* frame_host =
signin::GetAuthFrame(GetLoginUI()->GetWebContents(), gaia_frame_parent_);
if (!frame_host)
return nullptr;
return content::WebContents::FromRenderFrameHost(frame_host);
......
......@@ -15,7 +15,7 @@
#include "chrome/browser/chromeos/login/ui/webui_login_view.h"
#include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/ui/webui/signin/inline_login_ui.h"
#include "chrome/browser/ui/webui/signin/get_auth_frame.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chromeos/chromeos_switches.h"
......@@ -245,8 +245,8 @@ void OobeBaseTest::WaitForSigninScreen() {
}
void OobeBaseTest::ExecuteJsInSigninFrame(const std::string& js) {
content::RenderFrameHost* frame = InlineLoginUI::GetAuthFrame(
GetLoginUI()->GetWebContents(), GURL(), gaia_frame_parent_);
content::RenderFrameHost* frame =
signin::GetAuthFrame(GetLoginUI()->GetWebContents(), gaia_frame_parent_);
ASSERT_TRUE(content::ExecuteScript(frame, js));
}
......
......@@ -11,7 +11,7 @@
#include "chrome/browser/signin/signin_promo.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/signin/inline_login_ui.h"
#include "chrome/browser/ui/webui/signin/get_auth_frame.h"
#include "chrome/common/url_constants.h"
#include "components/constrained_window/constrained_window_views.h"
#include "components/signin/core/browser/signin_error_controller.h"
......@@ -157,8 +157,8 @@ class ModalSigninDelegate : public views::DialogDelegateView,
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override {
auto auth_web_contents = InlineLoginUI::GetAuthFrameWebContents(
content_view_->GetWebContents(), GURL(), "signin-frame");
auto auth_web_contents = signin::GetAuthFrameWebContents(
content_view_->GetWebContents(), "signin-frame");
if (auth_web_contents) {
if (auth_web_contents->GetController().CanGoBack())
auth_web_contents->GetController().GoBack();
......@@ -171,8 +171,8 @@ class ModalSigninDelegate : public views::DialogDelegateView,
// content::WebContentsDelegate
void LoadingStateChanged(
content::WebContents* source, bool to_different_document) override {
auto auth_web_contents = InlineLoginUI::GetAuthFrameWebContents(
content_view_->GetWebContents(), GURL(), "signin-frame");
auto auth_web_contents = signin::GetAuthFrameWebContents(
content_view_->GetWebContents(), "signin-frame");
if (auth_web_contents) {
if (auth_web_contents->GetController().CanGoBack())
host_view_->ShowBackArrow();
......
......@@ -51,10 +51,7 @@
#include "chrome/browser/ui/webui/predictors/predictors_ui.h"
#include "chrome/browser/ui/webui/profiler_ui.h"
#include "chrome/browser/ui/webui/settings/md_settings_ui.h"
#include "chrome/browser/ui/webui/signin/inline_login_ui.h"
#include "chrome/browser/ui/webui/signin/profile_signin_confirmation_ui.h"
#include "chrome/browser/ui/webui/signin/sync_confirmation_ui.h"
#include "chrome/browser/ui/webui/signin/user_manager_ui.h"
#include "chrome/browser/ui/webui/signin_internals_ui.h"
#include "chrome/browser/ui/webui/supervised_user_internals_ui.h"
#include "chrome/browser/ui/webui/sync_internals_ui.h"
......@@ -127,6 +124,12 @@
#include "chrome/browser/ui/webui/popular_sites_internals_ui.h"
#endif
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
#include "chrome/browser/ui/webui/signin/inline_login_ui.h"
#include "chrome/browser/ui/webui/signin/sync_confirmation_ui.h"
#include "chrome/browser/ui/webui/signin/user_manager_ui.h"
#endif
#if defined(OS_CHROMEOS)
#include "base/sys_info.h"
#include "chrome/browser/ui/webui/chromeos/bluetooth_pairing_ui.h"
......@@ -493,8 +496,6 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
#else
if (url.host() == chrome::kChromeUICopresenceHost)
return &NewWebUI<CopresenceUI>;
if (url.host() == chrome::kChromeUIChromeSigninHost)
return &NewWebUI<InlineLoginUI>;
if (url.SchemeIs(content::kChromeDevToolsScheme))
return &NewWebUI<DevToolsUI>;
......@@ -509,6 +510,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<PopularSitesInternalsUI>;
#endif
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
if (url.host() == chrome::kChromeUIChromeSigninHost)
return &NewWebUI<InlineLoginUI>;
if (url.host() == chrome::kChromeUIUserManagerHost)
return &NewWebUI<UserManagerUI>;
if (url.host() == chrome::kChromeUISyncConfirmationHost)
......
......@@ -25,7 +25,7 @@
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
#include "chrome/browser/ui/webui/signin/inline_login_ui.h"
#include "chrome/browser/ui/webui/signin/get_auth_frame.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
......@@ -54,8 +54,6 @@ namespace {
const char kJsScreenPath[] = "login.GaiaSigninScreen";
const char kAuthIframeParentName[] = "signin-frame";
const char kAuthIframeParentOrigin[] =
"chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/";
const char kRestrictiveProxyURL[] = "https://www.google.com/generate_204";
......@@ -604,10 +602,8 @@ void GaiaScreenHandler::ShowSigninScreenForTest(const std::string& username,
void GaiaScreenHandler::SubmitLoginFormForTest() {
VLOG(2) << "Submit login form for test, user=" << test_user_;
content::RenderFrameHost* frame = InlineLoginUI::GetAuthFrame(
web_ui()->GetWebContents(),
GURL(kAuthIframeParentOrigin),
kAuthIframeParentName);
content::RenderFrameHost* frame =
signin::GetAuthFrame(web_ui()->GetWebContents(), kAuthIframeParentName);
std::string code =
"document.getElementById('identifier').value = '" + test_user_ + "';"
......
......@@ -56,13 +56,16 @@
#include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h"
#include "chrome/browser/ui/webui/options/chromeos/user_image_source.h"
#include "chrome/browser/ui/webui/test_files_request_filter.h"
#include "chrome/browser/ui/webui/theme_source.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chromeos/chromeos_switches.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/content_switches.h"
#include "grit/browser_resources.h"
#include "grit/chrome_unscaled_resources.h"
#include "ui/base/resource/resource_bundle.h"
......@@ -139,6 +142,13 @@ content::WebUIDataSource* CreateOobeUIDataSource(
source->AddResourcePath("Roboto-Bold.ttf", IDR_FONT_ROBOTO_BOLD);
}
// Only add a filter when runing as test.
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
const bool is_running_test = command_line->HasSwitch(::switches::kTestName) ||
command_line->HasSwitch(::switches::kTestType);
if (is_running_test)
source->SetRequestFilter(::test::GetTestFilesRequestFilter());
return source;
}
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/signin/get_auth_frame.h"
#include <set>
#include "base/bind.h"
#include "components/guest_view/browser/guest_view_manager.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
namespace {
bool AddWebContentsToSet(std::set<content::WebContents*>* frame_set,
const std::string& web_view_name,
content::WebContents* web_contents) {
auto* web_view = extensions::WebViewGuest::FromWebContents(web_contents);
if (web_view && web_view->name() == web_view_name)
frame_set->insert(web_contents);
return false;
}
} // namespace
namespace signin {
content::RenderFrameHost* GetAuthFrame(content::WebContents* web_contents,
const std::string& parent_frame_name) {
content::WebContents* auth_web_contents =
GetAuthFrameWebContents(web_contents, parent_frame_name);
return auth_web_contents ? auth_web_contents->GetMainFrame() : nullptr;
}
content::WebContents* GetAuthFrameWebContents(
content::WebContents* web_contents,
const std::string& parent_frame_name) {
std::set<content::WebContents*> frame_set;
auto* manager = guest_view::GuestViewManager::FromBrowserContext(
web_contents->GetBrowserContext());
if (manager) {
manager->ForEachGuest(
web_contents,
base::Bind(&AddWebContentsToSet, &frame_set, parent_frame_name));
}
DCHECK_GE(1U, frame_set.size());
if (!frame_set.empty())
return *frame_set.begin();
return nullptr;
}
} // namespace signin
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_GET_AUTH_FRAME_H_
#define CHROME_BROWSER_UI_WEBUI_SIGNIN_GET_AUTH_FRAME_H_
#include <string>
namespace content {
class RenderFrameHost;
class WebContents;
}
namespace signin {
// Gets a webview within an auth page that has the specified parent frame name
// (i.e. <webview name="foobar"></webview>).
content::RenderFrameHost* GetAuthFrame(content::WebContents* web_contents,
const std::string& parent_frame_name);
content::WebContents* GetAuthFrameWebContents(
content::WebContents* web_contents,
const std::string& parent_frame_name);
} // namespace signin
#endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_GET_AUTH_FRAME_H_
......@@ -41,7 +41,7 @@
#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/user_manager.h"
#include "chrome/browser/ui/webui/signin/inline_login_ui.h"
#include "chrome/browser/ui/webui/signin/get_auth_frame.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/common/url_constants.h"
......@@ -470,16 +470,16 @@ void InlineLoginHandlerImpl::DidCommitProvisionalLoadForFrame(
if (!web_contents())
return;
// Returns early if this is not a gaia iframe navigation.
const GURL kGaiaExtOrigin(
GaiaUrls::GetInstance()->signin_completed_continue_url().GetOrigin());
content::RenderFrameHost* gaia_frame = InlineLoginUI::GetAuthFrame(
web_contents(), kGaiaExtOrigin, "signin-frame");
// Returns early if this is not a gaia webview navigation.
content::RenderFrameHost* gaia_frame =
signin::GetAuthFrame(web_contents(), "signin-frame");
if (render_frame_host != gaia_frame)
return;
// Loading any untrusted (e.g., HTTP) URLs in the privileged sign-in process
// will require confirmation before the sign in takes effect.
const GURL kGaiaExtOrigin(
GaiaUrls::GetInstance()->signin_completed_continue_url().GetOrigin());
if (!url.is_empty()) {
GURL origin(url.GetOrigin());
if (url.spec() != url::kAboutBlankURL &&
......
......@@ -5,58 +5,25 @@
#include "chrome/browser/ui/webui/signin/inline_login_ui.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/strings/string_split.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/browser/ui/webui/metrics_handler.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/browser/ui/webui/test_files_request_filter.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "components/guest_view/browser/guest_view_manager.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/content_switches.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "grit/browser_resources.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/ui/webui/chromeos/login/inline_login_handler_chromeos.h"
#else
#include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h"
#endif
namespace {
bool HandleTestFileRequestCallback(
const std::string& path,
const content::WebUIDataSource::GotDataCallback& callback) {
std::vector<std::string> url_substr = base::SplitString(
path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (url_substr.size() != 2 || url_substr[0] != "test")
return false;
std::string contents;
base::FilePath test_data_dir;
PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
if (!base::ReadFileToString(
test_data_dir.AppendASCII("webui").AppendASCII(url_substr[1]),
&contents, std::string::npos))
return false;
base::RefCountedString* ref_contents = new base::RefCountedString();
ref_contents->data() = contents;
callback.Run(ref_contents);
return true;
}
content::WebUIDataSource* CreateWebUIDataSource() {
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIChromeSigninHost);
......@@ -71,7 +38,7 @@ content::WebUIDataSource* CreateWebUIDataSource() {
const bool is_running_test = command_line->HasSwitch(::switches::kTestName) ||
command_line->HasSwitch(::switches::kTestType);
if (is_running_test)
source->SetRequestFilter(base::Bind(&HandleTestFileRequestCallback));
source->SetRequestFilter(test::GetTestFilesRequestFilter());
source->AddResourcePath("inline_login.css", IDR_INLINE_LOGIN_CSS);
source->AddResourcePath("inline_login.js", IDR_INLINE_LOGIN_JS);
......@@ -81,15 +48,6 @@ content::WebUIDataSource* CreateWebUIDataSource() {
return source;
}
bool AddWebContentsToSet(std::set<content::WebContents*>* frame_set,
const std::string& web_view_name,
content::WebContents* web_contents) {
auto* web_view = extensions::WebViewGuest::FromWebContents(web_contents);
if (web_view && web_view->name() == web_view_name)
frame_set->insert(web_contents);
return false;
}
} // empty namespace
InlineLoginUI::InlineLoginUI(content::WebUI* web_ui)
......@@ -97,12 +55,7 @@ InlineLoginUI::InlineLoginUI(content::WebUI* web_ui)
auth_extension_(Profile::FromWebUI(web_ui)) {
Profile* profile = Profile::FromWebUI(web_ui);
content::WebUIDataSource::Add(profile, CreateWebUIDataSource());
#if defined(OS_CHROMEOS)
web_ui->AddMessageHandler(new chromeos::InlineLoginHandlerChromeOS());
#else
web_ui->AddMessageHandler(new InlineLoginHandlerImpl());
#endif
web_ui->AddMessageHandler(new MetricsHandler());
content::WebContents* contents = web_ui->GetWebContents();
......@@ -120,32 +73,3 @@ InlineLoginUI::InlineLoginUI(content::WebUI* web_ui)
InlineLoginUI::~InlineLoginUI() {}
// Gets the Gaia iframe within a WebContents.
content::RenderFrameHost* InlineLoginUI::GetAuthFrame(
content::WebContents* web_contents,
const GURL& parent_origin,
const std::string& parent_frame_name) {
content::WebContents* auth_web_contents = GetAuthFrameWebContents(
web_contents, parent_origin, parent_frame_name);
return auth_web_contents ? auth_web_contents->GetMainFrame() : nullptr;
}
content::WebContents* InlineLoginUI::GetAuthFrameWebContents(
content::WebContents* web_contents,
const GURL& parent_origin,
const std::string& parent_frame_name) {
std::set<content::WebContents*> frame_set;
auto* manager =
guest_view::GuestViewManager::FromBrowserContext(
web_contents->GetBrowserContext());
if (manager) {
manager->ForEachGuest(
web_contents,
base::Bind(&AddWebContentsToSet, &frame_set, parent_frame_name));
}
DCHECK_GE(1U, frame_set.size());
if (!frame_set.empty())
return *frame_set.begin();
return nullptr;
}
......@@ -9,10 +9,6 @@
#include "chrome/browser/extensions/signin/scoped_gaia_auth_extension.h"
#include "ui/web_dialogs/web_dialog_ui.h"
namespace content {
class RenderFrameHost;
}
// Inline login WebUI in various signin flows for ChromeOS and Chrome desktop.
// The authentication is carried out via the host gaia_auth extension. Upon
// success, the profile of the webui should be populated with proper cookies.
......@@ -22,18 +18,6 @@ class InlineLoginUI : public ui::WebDialogUI {
explicit InlineLoginUI(content::WebUI* web_ui);
~InlineLoginUI() override;
// Gets the frame (iframe or webview) within an auth page that has the
// specified parent origin if |parent_origin| is not empty, and the specified
// parent frame name.
static content::RenderFrameHost* GetAuthFrame(
content::WebContents* web_contents,
const GURL& parent_origin,
const std::string& parent_frame_name);
static content::WebContents* GetAuthFrameWebContents(
content::WebContents* web_contents,
const GURL& parent_origin,
const std::string& parent_frame_name);
private:
ScopedGaiaAuthExtension auth_extension_;
......
......@@ -353,8 +353,6 @@ IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, OneProcessLimit) {
ASSERT_NE(info1.pid, info3.pid);
}
#if !defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, CanOfferNoProfile) {
std::string error_message;
EXPECT_FALSE(InlineLoginHandlerImpl::CanOffer(
......@@ -758,8 +756,6 @@ IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest,
base::MessageLoop::current()->RunUntilIdle();
}
#endif // OS_CHROMEOS
class InlineLoginUISafeIframeBrowserTest : public InProcessBrowserTest {
public:
FooWebUIProvider& foo_provider() { return foo_provider_; }
......@@ -822,17 +818,10 @@ IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, NoWebUIInIframe) {
ui_test_utils::NavigateToURL(browser(), url);
}
// Flaky on CrOS, http://crbug.com/364759.
#if defined(OS_CHROMEOS)
#define MAYBE_TopFrameNavigationDisallowed DISABLED_TopFrameNavigationDisallowed
#else
#define MAYBE_TopFrameNavigationDisallowed TopFrameNavigationDisallowed
#endif
// Make sure that the gaia iframe cannot trigger top-frame navigation.
// TODO(guohui): flaky on trybot crbug/364759.
IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest,
MAYBE_TopFrameNavigationDisallowed) {
TopFrameNavigationDisallowed) {
// Loads into gaia iframe a web page that attempts to deframe on load.
GURL deframe_url(embedded_test_server()->GetURL("/login/deframe.html"));
GURL url(net::AppendOrReplaceQueryParameter(GetSigninPromoURL(), "frameUrl",
......@@ -867,7 +856,6 @@ IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest,
EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL());
}
#if !defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest,
ConfirmationRequiredForNonsecureSignin) {
FakeGaia fake_gaia;
......@@ -896,4 +884,3 @@ IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest,
run_loop.Run();
base::MessageLoop::current()->RunUntilIdle();
}
#endif // OS_CHROMEOS
......@@ -6,7 +6,7 @@
#include "chrome/browser/signin/signin_tracker_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/signin/inline_login_ui.h"
#include "chrome/browser/ui/webui/signin/get_auth_frame.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
......@@ -139,8 +139,7 @@ void WaitUntilElementExistsInSigninFrame(Browser* browser,
content::WebContents* web_contents =
browser->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(content::ExecuteScriptAndExtractString(
InlineLoginUI::GetAuthFrame(web_contents, GURL(), "signin-frame"),
js, &message));
signin::GetAuthFrame(web_contents, "signin-frame"), js, &message));
ASSERT_EQ("found", message) <<
"Failed to find element with id " << element_id;
......@@ -152,9 +151,10 @@ bool ElementExistsInSigninFrame(Browser* browser,
browser->tab_strip_model()->GetActiveWebContents();
bool result = false;
EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
InlineLoginUI::GetAuthFrame(web_contents, GURL(), "signin-frame"),
signin::GetAuthFrame(web_contents, "signin-frame"),
"window.domAutomationController.send("
" document.getElementById('" + element_id + "') != null);",
" document.getElementById('" +
element_id + "') != null);",
&result));
return result;
}
......@@ -167,15 +167,15 @@ void SigninInNewGaiaFlow(Browser* browser,
content::WebContents* web_contents =
browser->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(content::ExecuteScript(InlineLoginUI::GetAuthFrame(
web_contents, GURL(), "signin-frame"), js));
ASSERT_TRUE(content::ExecuteScript(
signin::GetAuthFrame(web_contents, "signin-frame"), js));
WaitUntilElementExistsInSigninFrame(browser, "Passwd");
js = "document.getElementById('Passwd').value = '" + password + "';"
"document.getElementById('signIn').click();";
ASSERT_TRUE(content::ExecuteScript(InlineLoginUI::GetAuthFrame(
web_contents, GURL(), "signin-frame"), js));
ASSERT_TRUE(content::ExecuteScript(
signin::GetAuthFrame(web_contents, "signin-frame"), js));
}
void SigninInOldGaiaFlow(Browser* browser,
......@@ -188,8 +188,8 @@ void SigninInOldGaiaFlow(Browser* browser,
content::WebContents* web_contents =
browser->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(content::ExecuteScript(InlineLoginUI::GetAuthFrame(
web_contents, GURL(), "signin-frame"), js));
ASSERT_TRUE(content::ExecuteScript(
signin::GetAuthFrame(web_contents, "signin-frame"), js));
}
void ExecuteJsToSigninInSigninFrame(Browser* browser,
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/test_files_request_filter.h"
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/memory/ref_counted_memory.h"
#include "base/path_service.h"
#include "base/strings/string_split.h"
#include "chrome/common/chrome_paths.h"
namespace {
bool HandleTestFileRequestCallback(
const std::string& path,
const content::WebUIDataSource::GotDataCallback& callback) {
std::vector<std::string> url_substr =
base::SplitString(path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (url_substr.size() != 2 || url_substr[0] != "test")
return false;
std::string contents;
base::FilePath test_data_dir;
PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
if (!base::ReadFileToString(
test_data_dir.AppendASCII("webui").AppendASCII(url_substr[1]),
&contents, std::string::npos))
return false;
base::RefCountedString* ref_contents = new base::RefCountedString();
ref_contents->data() = contents;
callback.Run(ref_contents);
return true;
}
} // namespace
namespace test {
content::WebUIDataSource::HandleRequestCallback GetTestFilesRequestFilter() {
return base::Bind(&HandleTestFileRequestCallback);
}
} // namespace test
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_TEST_FILES_REQUEST_FILTER_H_
#define CHROME_BROWSER_UI_WEBUI_TEST_FILES_REQUEST_FILTER_H_
#include "content/public/browser/web_ui_data_source.h"
namespace test {
// Returns a callback to be used as a filter in WebUIDataSource.
// The filter responds with a content of "%DIR_TEST_DATA%/webui/<filename>" if
// request path has "/test/<filename>" format.
content::WebUIDataSource::HandleRequestCallback GetTestFilesRequestFilter();
} // namespace test
#endif // CHROME_BROWSER_UI_WEBUI_TEST_FILES_REQUEST_FILTER_H_
......@@ -39,9 +39,13 @@ class WebUIWebViewBrowserTest : public WebUIBrowserTest {
}
GURL GetWebViewEnabledWebUIURL() const {
#if defined(OS_CHROMEOS)
return GURL(chrome::kChromeUIOobeURL).Resolve("/login");
#else
return GURL(signin::GetPromoURL(
signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE,
signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, false));
#endif
}
private:
......
......@@ -248,8 +248,6 @@
'browser/ui/webui/chromeos/login/hid_detection_screen_handler.h',
'browser/ui/webui/chromeos/login/host_pairing_screen_handler.cc',
'browser/ui/webui/chromeos/login/host_pairing_screen_handler.h',
'browser/ui/webui/chromeos/login/inline_login_handler_chromeos.cc',
'browser/ui/webui/chromeos/login/inline_login_handler_chromeos.h',
'browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc',
'browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h',
'browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc',
......@@ -393,6 +391,8 @@
'browser/ui/webui/sync_internals_message_handler.h',
'browser/ui/webui/sync_internals_ui.cc',
'browser/ui/webui/sync_internals_ui.h',
'browser/ui/webui/test_files_request_filter.cc',
'browser/ui/webui/test_files_request_filter.h',
'browser/ui/webui/theme_source.cc',
'browser/ui/webui/theme_source.h',
'browser/ui/webui/translate_internals/translate_internals_handler.cc',
......@@ -1319,6 +1319,10 @@
'browser/ui/views/profiles/new_avatar_button.h',
'browser/ui/webui/app_launcher_page_ui.cc',
'browser/ui/webui/app_launcher_page_ui.h',
'browser/ui/webui/signin/inline_login_ui.cc',
'browser/ui/webui/signin/inline_login_ui.h',
'browser/ui/webui/signin/inline_login_handler.cc',
'browser/ui/webui/signin/inline_login_handler.h',
'browser/ui/webui/signin/inline_login_handler_impl.cc',
'browser/ui/webui/signin/inline_login_handler_impl.h',
'browser/ui/webui/signin/sync_confirmation_handler.cc',
......@@ -2008,10 +2012,8 @@
'browser/ui/webui/settings/settings_manage_profile_handler.h',
'browser/ui/webui/settings/settings_startup_pages_handler.cc',
'browser/ui/webui/settings/settings_startup_pages_handler.h',
'browser/ui/webui/signin/inline_login_handler.cc',
'browser/ui/webui/signin/inline_login_handler.h',
'browser/ui/webui/signin/inline_login_ui.cc',
'browser/ui/webui/signin/inline_login_ui.h',
'browser/ui/webui/signin/get_auth_frame.cc',
'browser/ui/webui/signin/get_auth_frame.h',
'browser/ui/webui/signin/login_ui_service.cc',
'browser/ui/webui/signin/login_ui_service.h',
'browser/ui/webui/signin/login_ui_service_factory.cc',
......
......@@ -2363,6 +2363,8 @@
'browser/ui/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc',
# chromeos does not use cross-platform panels
'browser/ui/panels/panel_extension_browsertest.cc',
# inline login UI is disabled on chromeos
'browser/ui/webui/signin/inline_login_ui_browsertest.cc',
# chromeos does not use the desktop user manager
'browser/ui/webui/signin/user_manager_ui_browsertest.cc',
],
......
......@@ -1030,6 +1030,9 @@ if (!is_android) {
# chromeos does not use cross-platform panels
"../browser/ui/panels/panel_extension_browsertest.cc",
# inline login UI is disabled on chromeos
"../browser/ui/webui/signin/inline_login_ui_browsertest.cc",
# chromeos does not use the desktop user manager
"../browser/ui/webui/signin/user_manager_ui_browsertest.cc",
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment