| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/webui/web_ui_browsertest.h" | 4 #include "chrome/browser/ui/webui/web_ui_browsertest.h" |
| 5 | 5 |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // testing. | 273 // testing. |
| 274 class MockWebUIProvider | 274 class MockWebUIProvider |
| 275 : public TestChromeWebUIControllerFactory::WebUIProvider { | 275 : public TestChromeWebUIControllerFactory::WebUIProvider { |
| 276 public: | 276 public: |
| 277 MockWebUIProvider() {} | 277 MockWebUIProvider() {} |
| 278 | 278 |
| 279 // Returns a new WebUI | 279 // Returns a new WebUI |
| 280 WebUIController* NewWebUI(content::WebUI* web_ui, const GURL& url) OVERRIDE { | 280 WebUIController* NewWebUI(content::WebUI* web_ui, const GURL& url) OVERRIDE { |
| 281 WebUIController* controller = new content::WebUIController(web_ui); | 281 WebUIController* controller = new content::WebUIController(web_ui); |
| 282 Profile* profile = Profile::FromWebUI(web_ui); | 282 Profile* profile = Profile::FromWebUI(web_ui); |
| 283 profile->GetChromeURLDataManager()->AddDataSource( | 283 ChromeURLDataManager::AddDataSource(profile, new MockWebUIDataSource()); |
| 284 new MockWebUIDataSource()); | |
| 285 return controller; | 284 return controller; |
| 286 } | 285 } |
| 287 | 286 |
| 288 private: | 287 private: |
| 289 DISALLOW_COPY_AND_ASSIGN(MockWebUIProvider); | 288 DISALLOW_COPY_AND_ASSIGN(MockWebUIProvider); |
| 290 }; | 289 }; |
| 291 | 290 |
| 292 base::LazyInstance<MockWebUIProvider> mock_provider_ = | 291 base::LazyInstance<MockWebUIProvider> mock_provider_ = |
| 293 LAZY_INSTANCE_INITIALIZER; | 292 LAZY_INSTANCE_INITIALIZER; |
| 294 | 293 |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 // testDone directly and expect pass result. | 685 // testDone directly and expect pass result. |
| 687 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 686 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
| 688 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 687 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
| 689 } | 688 } |
| 690 | 689 |
| 691 // Test that calling testDone during RunJavascriptTest still completes when | 690 // Test that calling testDone during RunJavascriptTest still completes when |
| 692 // waiting for async result. | 691 // waiting for async result. |
| 693 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 692 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
| 694 ASSERT_TRUE(RunJavascriptTest("testDone")); | 693 ASSERT_TRUE(RunJavascriptTest("testDone")); |
| 695 } | 694 } |
| OLD | NEW |