| Index: content/browser/webui/web_ui_mojo_browsertest.cc
|
| diff --git a/content/browser/webui/web_ui_mojo_browsertest.cc b/content/browser/webui/web_ui_mojo_browsertest.cc
|
| index 9d941c9f6c1a7f33d46a864ae43386538eb2df82..3f5a6de8118d98975cc4ac1c2c3ececee13bf1e2 100644
|
| --- a/content/browser/webui/web_ui_mojo_browsertest.cc
|
| +++ b/content/browser/webui/web_ui_mojo_browsertest.cc
|
| @@ -7,7 +7,6 @@
|
| #include "base/command_line.h"
|
| #include "base/files/file_path.h"
|
| #include "base/files/file_util.h"
|
| -#include "base/path_service.h"
|
| #include "base/run_loop.h"
|
| #include "base/strings/string_util.h"
|
| #include "content/browser/webui/web_ui_controller_factory_registry.h"
|
| @@ -53,22 +52,10 @@
|
| id == mojo::kValidatorModuleName)
|
| return false;
|
|
|
| - if (id.find(".mojom") != std::string::npos) {
|
| - std::string contents;
|
| - CHECK(base::ReadFileToString(mojo::test::GetFilePathForJSResource(id),
|
| - &contents, std::string::npos))
|
| - << id;
|
| - base::RefCountedString* ref_contents = new base::RefCountedString;
|
| - ref_contents->data() = contents;
|
| - callback.Run(ref_contents);
|
| - return true;
|
| - }
|
| -
|
| - base::FilePath path;
|
| - DCHECK(base::PathService::Get(content::DIR_TEST_DATA, &path));
|
| - path = path.AppendASCII(id.substr(0, id.find("?")));
|
| std::string contents;
|
| - CHECK(base::ReadFileToString(path, &contents, std::string::npos)) << id;
|
| + CHECK(base::ReadFileToString(mojo::test::GetFilePathForJSResource(id),
|
| + &contents,
|
| + std::string::npos)) << id;
|
| base::RefCountedString* ref_contents = new base::RefCountedString;
|
| ref_contents->data() = contents;
|
| callback.Run(ref_contents);
|
| @@ -103,14 +90,13 @@
|
| // WebUIController that sets up mojo bindings.
|
| class TestWebUIController : public WebUIController {
|
| public:
|
| - TestWebUIController(WebUI* web_ui, base::RunLoop* run_loop)
|
| - : WebUIController(web_ui), run_loop_(run_loop) {
|
| + TestWebUIController(WebUI* web_ui, base::RunLoop* run_loop)
|
| + : WebUIController(web_ui),
|
| + run_loop_(run_loop) {
|
| content::WebUIDataSource* data_source =
|
| - WebUIDataSource::Create("mojo-web-ui");
|
| - data_source->AddMojoResources();
|
| + WebUIDataSource::AddMojoDataSource(
|
| + web_ui->GetWebContents()->GetBrowserContext());
|
| data_source->SetRequestFilter(base::Bind(&GetResource));
|
| - content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
|
| - data_source);
|
| }
|
|
|
| protected:
|
| @@ -219,7 +205,7 @@
|
| ASSERT_TRUE(embedded_test_server()->Start());
|
| base::RunLoop run_loop;
|
| factory()->set_run_loop(&run_loop);
|
| - GURL test_url("chrome://mojo-web-ui/web_ui_mojo.html?ping");
|
| + GURL test_url(embedded_test_server()->GetURL("/web_ui_mojo.html?ping"));
|
| NavigateToURL(shell(), test_url);
|
| // RunLoop is quit when message received from page.
|
| run_loop.Run();
|
| @@ -248,7 +234,7 @@
|
|
|
| ASSERT_TRUE(embedded_test_server()->Start());
|
| NavigateToURL(shell(),
|
| - GURL("chrome://mojo-web-ui/web_ui_mojo_shell_test.html"));
|
| + embedded_test_server()->GetURL("/web_ui_mojo_shell_test.html"));
|
|
|
| DOMMessageQueue message_queue;
|
| std::string message;
|
|
|