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

Unified Diff: chrome/browser/chromeos/login/login_browsertest.cc

Issue 190663012: Run ContentMain in a browser_test's browser process. This removes duplication of code in the browse… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: try to fix android by restoring old path just for it Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_browser_main_mac.mm ('k') | chrome/browser/chromeos/login/login_utils_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/login_browsertest.cc
===================================================================
--- chrome/browser/chromeos/login/login_browsertest.cc (revision 257432)
+++ chrome/browser/chromeos/login/login_browsertest.cc (working copy)
@@ -4,9 +4,6 @@
#include "ash/shell.h"
#include "base/command_line.h"
-#include "chrome/browser/chrome_browser_main.h"
-#include "chrome/browser/chrome_browser_main_extra_parts.h"
-#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/login/login_display_host_impl.h"
#include "chrome/browser/chromeos/login/login_wizard.h"
@@ -18,11 +15,9 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/interactive_test_utils.h"
+#include "chrome/test/base/tracing.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chromeos/chromeos_switches.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "content/public/browser/notification_service.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_system.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -67,58 +62,6 @@
}
};
-// Used to add an observer to NotificationService after it's created.
-class TestBrowserMainExtraParts
- : public ChromeBrowserMainExtraParts,
- public content::NotificationObserver {
- public:
- TestBrowserMainExtraParts() {}
- virtual ~TestBrowserMainExtraParts() {}
-
- // ChromeBrowserMainExtraParts implementation.
- virtual void PreEarlyInitialization() OVERRIDE {
- registrar_.Add(this, chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
- content::NotificationService::AllSources());
- }
-
- void set_quit_task(const base::Closure& quit_task) { quit_task_ = quit_task; }
-
- private:
- // Overridden from content::NotificationObserver:
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE {
- quit_task_.Run();
- }
-
- content::NotificationRegistrar registrar_;
- base::Closure quit_task_;
-
- DISALLOW_COPY_AND_ASSIGN(TestBrowserMainExtraParts);
-};
-
-class TestContentBrowserClient : public chrome::ChromeContentBrowserClient {
- public:
- TestContentBrowserClient() {}
- virtual ~TestContentBrowserClient() {}
-
- virtual content::BrowserMainParts* CreateBrowserMainParts(
- const content::MainFunctionParams& parameters) OVERRIDE {
- ChromeBrowserMainParts* main_parts = static_cast<ChromeBrowserMainParts*>(
- ChromeContentBrowserClient::CreateBrowserMainParts(parameters));
-
- browser_main_extra_parts_ = new TestBrowserMainExtraParts();
- main_parts->AddParts(browser_main_extra_parts_);
- return main_parts;
- }
-
- TestBrowserMainExtraParts* browser_main_extra_parts_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TestContentBrowserClient);
-};
-
-
class LoginSigninTest : public InProcessBrowserTest {
protected:
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
@@ -126,18 +69,9 @@
command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests);
}
- virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
- content_browser_client_.reset(new TestContentBrowserClient());
- original_content_browser_client_ = content::SetBrowserClientForTesting(
- content_browser_client_.get());
+ virtual void SetUpOnMainThread() OVERRIDE {
+ ASSERT_TRUE(tracing::BeginTracingWithWatch("ui", "ui", "ShowLoginWebUI", 1));
}
-
- virtual void TearDownInProcessBrowserTestFixture() OVERRIDE {
- content::SetBrowserClientForTesting(original_content_browser_client_);
- }
-
- scoped_ptr<TestContentBrowserClient> content_browser_client_;
- content::ContentBrowserClient* original_content_browser_client_;
};
// After a chrome crash, the session manager will restart chrome with
@@ -188,11 +122,10 @@
// Verifies that the webui for login comes up successfully.
IN_PROC_BROWSER_TEST_F(LoginSigninTest, WebUIVisible) {
- scoped_refptr<content::MessageLoopRunner> runner =
- new content::MessageLoopRunner;
- content_browser_client_->browser_main_extra_parts_->set_quit_task(
- runner->QuitClosure());
- runner->Run();
+ base::TimeDelta no_timeout;
+ EXPECT_TRUE(tracing::WaitForWatchEvent(no_timeout));
+ std::string json_events;
+ ASSERT_TRUE(tracing::EndTracing(&json_events));
}
INSTANTIATE_TEST_CASE_P(LoginUserTestInstantiation,
« no previous file with comments | « chrome/browser/chrome_browser_main_mac.mm ('k') | chrome/browser/chromeos/login/login_utils_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698