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

Unified Diff: chrome/browser/dom_ui/dom_ui_browsertest.cc

Issue 6286068: Reland 73532. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/dom_ui/dom_ui_browsertest.h ('k') | chrome/browser/dom_ui/settings_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/dom_ui_browsertest.cc
===================================================================
--- chrome/browser/dom_ui/dom_ui_browsertest.cc (revision 73540)
+++ chrome/browser/dom_ui/dom_ui_browsertest.cc (working copy)
@@ -10,6 +10,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/ui_test_utils.h"
+#include "ui/base/resource/resource_bundle.h"
static const FilePath::CharType* kDOMUILibraryJS =
FILE_PATH_LITERAL("test_api.js");
@@ -19,16 +20,20 @@
bool DOMUITest::RunDOMUITest(const FilePath::CharType* src_path) {
std::string content;
BuildJavaScriptTest(FilePath(src_path), &content);
- handler_->Attach(
- browser()->GetSelectedTabContents()->dom_ui());
- return handler_->Execute(content);
+ SetupHandlers();
+ return test_handler_->Execute(content);
}
-DOMUITest::DOMUITest() : handler_(new DOMUITestHandler()) {}
+DOMUITest::DOMUITest() : test_handler_(new DOMUITestHandler()) {}
void DOMUITest::SetUpInProcessBrowserTestFixture() {
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_));
test_data_directory_ = test_data_directory_.Append(kDOMUITestFolder);
+
+ // TODO(dtseng): should this be part of every BrowserTest or just DOMUI test.
+ FilePath resources_pack_path;
+ PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path);
+ ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
}
void DOMUITest::BuildJavaScriptTest(const FilePath& src_path,
@@ -46,6 +51,17 @@
content->append(src_content);
}
+void DOMUITest::SetupHandlers() {
+ DOMUI* dom_ui_instance =
+ browser()->GetSelectedTabContents()->dom_ui();
+ ASSERT_TRUE(dom_ui_instance != NULL);
+ dom_ui_instance->register_callback_overwrites(true);
+ test_handler_->Attach(dom_ui_instance);
+
+ if (GetMockMessageHandler())
+ GetMockMessageHandler()->Attach(dom_ui_instance);
+}
+
IN_PROC_BROWSER_TEST_F(DOMUITest, TestSamplePass) {
// Navigate to UI.
// TODO(dtseng): make accessor for subclasses to return?
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_browsertest.h ('k') | chrome/browser/dom_ui/settings_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698