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

Side by Side Diff: chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc

Issue 1102173002: Move GuestView layer in browser to components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test change to build Created 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "base/prefs/scoped_user_pref_update.h" 7 #include "base/prefs/scoped_user_pref_update.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/content_settings/cookie_settings.h" 9 #include "chrome/browser/content_settings/cookie_settings.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
11 #include "chrome/browser/signin/signin_promo.h" 11 #include "chrome/browser/signin/signin_promo.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" 14 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h"
15 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" 15 #include "chrome/browser/ui/webui/signin/inline_login_ui.h"
16 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 16 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
17 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 17 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
18 #include "chrome/browser/ui/webui/signin/login_ui_test_utils.h" 18 #include "chrome/browser/ui/webui/signin/login_ui_test_utils.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "chrome/grit/chromium_strings.h" 21 #include "chrome/grit/chromium_strings.h"
22 #include "chrome/grit/generated_resources.h" 22 #include "chrome/grit/generated_resources.h"
23 #include "chrome/test/base/in_process_browser_test.h" 23 #include "chrome/test/base/in_process_browser_test.h"
24 #include "chrome/test/base/test_browser_window.h" 24 #include "chrome/test/base/test_browser_window.h"
25 #include "chrome/test/base/test_chrome_web_ui_controller_factory.h" 25 #include "chrome/test/base/test_chrome_web_ui_controller_factory.h"
26 #include "chrome/test/base/testing_browser_process.h" 26 #include "chrome/test/base/testing_browser_process.h"
27 #include "chrome/test/base/ui_test_utils.h" 27 #include "chrome/test/base/ui_test_utils.h"
28 #include "components/guest_view/browser/guest_view_manager.h"
28 #include "components/signin/core/browser/signin_manager.h" 29 #include "components/signin/core/browser/signin_manager.h"
29 #include "components/signin/core/common/profile_management_switches.h" 30 #include "components/signin/core/common/profile_management_switches.h"
30 #include "components/signin/core/common/signin_pref_names.h" 31 #include "components/signin/core/common/signin_pref_names.h"
31 #include "content/public/browser/render_frame_host.h" 32 #include "content/public/browser/render_frame_host.h"
32 #include "content/public/browser/render_process_host.h" 33 #include "content/public/browser/render_process_host.h"
33 #include "content/public/browser/session_storage_namespace.h" 34 #include "content/public/browser/session_storage_namespace.h"
34 #include "content/public/browser/storage_partition.h" 35 #include "content/public/browser/storage_partition.h"
35 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
36 #include "content/public/browser/web_ui_controller.h" 37 #include "content/public/browser/web_ui_controller.h"
37 #include "content/public/common/url_constants.h" 38 #include "content/public/common/url_constants.h"
38 #include "content/public/test/browser_test_utils.h" 39 #include "content/public/test/browser_test_utils.h"
39 #include "content/public/test/test_navigation_observer.h" 40 #include "content/public/test/test_navigation_observer.h"
40 #include "extensions/browser/guest_view/guest_view_manager.h"
41 #include "google_apis/gaia/fake_gaia.h" 41 #include "google_apis/gaia/fake_gaia.h"
42 #include "google_apis/gaia/gaia_switches.h" 42 #include "google_apis/gaia/gaia_switches.h"
43 #include "net/base/url_util.h" 43 #include "net/base/url_util.h"
44 #include "net/test/embedded_test_server/embedded_test_server.h" 44 #include "net/test/embedded_test_server/embedded_test_server.h"
45 #include "net/test/embedded_test_server/http_request.h" 45 #include "net/test/embedded_test_server/http_request.h"
46 #include "net/test/embedded_test_server/http_response.h" 46 #include "net/test/embedded_test_server/http_response.h"
47 #include "testing/gmock/include/gmock/gmock.h" 47 #include "testing/gmock/include/gmock/gmock.h"
48 #include "testing/gtest/include/gtest/gtest.h" 48 #include "testing/gtest/include/gtest/gtest.h"
49 #include "ui/base/l10n/l10n_util.h" 49 #include "ui/base/l10n/l10n_util.h"
50 50
51 using ::testing::_; 51 using ::testing::_;
52 using ::testing::AtLeast; 52 using ::testing::AtLeast;
53 using ::testing::Invoke; 53 using ::testing::Invoke;
54 using ::testing::InvokeWithoutArgs; 54 using ::testing::InvokeWithoutArgs;
55 using ::testing::Return; 55 using ::testing::Return;
56 56
57 using guestview::GuestViewManager;
57 using login_ui_test_utils::ExecuteJsToSigninInSigninFrame; 58 using login_ui_test_utils::ExecuteJsToSigninInSigninFrame;
58 using login_ui_test_utils::WaitUntilUIReady; 59 using login_ui_test_utils::WaitUntilUIReady;
59 60
60 namespace { 61 namespace {
61 62
62 struct ContentInfo { 63 struct ContentInfo {
63 ContentInfo(content::WebContents* contents, 64 ContentInfo(content::WebContents* contents,
64 int pid, 65 int pid,
65 content::StoragePartition* storage_partition) { 66 content::StoragePartition* storage_partition) {
66 this->contents = contents; 67 this->contents = contents;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (switches::IsEnableWebviewBasedSignin()) { 182 if (switches::IsEnableWebviewBasedSignin()) {
182 ContentInfo info = NavigateAndGetInfo( 183 ContentInfo info = NavigateAndGetInfo(
183 browser(), 184 browser(),
184 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), 185 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false),
185 CURRENT_TAB); 186 CURRENT_TAB);
186 WaitUntilUIReady(browser()); 187 WaitUntilUIReady(browser());
187 188
188 // Make sure storage partition of embedded webview is different from 189 // Make sure storage partition of embedded webview is different from
189 // parent. 190 // parent.
190 std::set<content::WebContents*> set; 191 std::set<content::WebContents*> set;
191 extensions::GuestViewManager* manager = 192 GuestViewManager* manager = GuestViewManager::FromBrowserContext(
192 extensions::GuestViewManager::FromBrowserContext( 193 info.contents->GetBrowserContext());
193 info.contents->GetBrowserContext());
194 manager->ForEachGuest(info.contents, base::Bind(&AddToSet, &set)); 194 manager->ForEachGuest(info.contents, base::Bind(&AddToSet, &set));
195 ASSERT_EQ(1u, set.size()); 195 ASSERT_EQ(1u, set.size());
196 content::WebContents* webview_contents = *set.begin(); 196 content::WebContents* webview_contents = *set.begin();
197 content::RenderProcessHost* process = 197 content::RenderProcessHost* process =
198 webview_contents->GetRenderProcessHost(); 198 webview_contents->GetRenderProcessHost();
199 ASSERT_NE(info.pid, process->GetID()); 199 ASSERT_NE(info.pid, process->GetID());
200 ASSERT_NE(info.storage_partition, process->GetStoragePartition()); 200 ASSERT_NE(info.storage_partition, process->GetStoragePartition());
201 } else { 201 } else {
202 GURL test_url = ui_test_utils::GetTestUrl( 202 GURL test_url = ui_test_utils::GetTestUrl(
203 base::FilePath(base::FilePath::kCurrentDirectory), 203 base::FilePath(base::FilePath::kCurrentDirectory),
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 ->AddObserver(&observer); 466 ->AddObserver(&observer);
467 base::RunLoop run_loop; 467 base::RunLoop run_loop;
468 EXPECT_CALL(observer, OnUntrustedLoginUIShown()) 468 EXPECT_CALL(observer, OnUntrustedLoginUIShown())
469 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 469 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
470 470
471 ExecuteJsToSigninInSigninFrame(browser(), "email@gmail.com", "password"); 471 ExecuteJsToSigninInSigninFrame(browser(), "email@gmail.com", "password");
472 run_loop.Run(); 472 run_loop.Run();
473 base::MessageLoop::current()->RunUntilIdle(); 473 base::MessageLoop::current()->RunUntilIdle();
474 } 474 }
475 #endif // OS_CHROMEOS 475 #endif // OS_CHROMEOS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698