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

Unified Diff: content/test/content_browser_test_utils.cc

Issue 10803026: Get content_browsertest working. I've added a simple test for now, and will convert the tests in sr… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: get it working on mac + linux, fix unittests crash, and fix unittest link error and add missing dep… Created 8 years, 5 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 | « content/test/content_browser_test_utils.h ('k') | content/test/content_test_launcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/content_browser_test_utils.cc
===================================================================
--- content/test/content_browser_test_utils.cc (revision 0)
+++ content/test/content_browser_test_utils.cc (revision 0)
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 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 "content/test/content_browser_test_utils.h"
+
+#include "base/bind.h"
+#include "base/file_path.h"
+#include "base/path_service.h"
+#include "base/run_loop.h"
+#include "content/public/browser/navigation_controller.h"
+#include "content/public/browser/notification_source.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/common/content_paths.h"
+#include "content/public/test/browser_test_utils.h"
+#include "content/public/test/test_navigation_observer.h"
+#include "content/shell/shell.h"
+#include "net/base/net_util.h"
+
+namespace content {
+
+FilePath GetTestFilePath(const char* dir, const char* file) {
+ FilePath path;
+ PathService::Get(DIR_TEST_DATA, &path);
+ return path.Append(
+ FilePath().AppendASCII(dir).Append(FilePath().AppendASCII(file)));
+}
+
+GURL GetTestUrl(const char* dir, const char* file) {
+ return net::FilePathToFileURL(GetTestFilePath(dir, file));
+}
+
+void NavigateToURL(Shell* window, const GURL& url) {
+ NavigationController* controller = &window->web_contents()->GetController();
+ TestNavigationObserver same_tab_observer(
+ Source<NavigationController>(controller),
+ NULL,
+ 1);
+
+ window->LoadURL(url);
+
+ base::RunLoop run_loop;
+ same_tab_observer.WaitForObservation(
+ base::Bind(&RunThisRunLoop, base::Unretained(&run_loop)),
+ GetQuitTaskForRunLoop(&run_loop));
+}
+
+} // namespace content
« no previous file with comments | « content/test/content_browser_test_utils.h ('k') | content/test/content_test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698