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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // DataSource for the dummy URL. If no data source is provided then an error | 246 // DataSource for the dummy URL. If no data source is provided then an error |
247 // page is shown. While this doesn't matter for most tests, without it, | 247 // page is shown. While this doesn't matter for most tests, without it, |
248 // navigation to different anchors cannot be listened to (via the hashchange | 248 // navigation to different anchors cannot be listened to (via the hashchange |
249 // event). | 249 // event). |
250 class MockWebUIDataSource : public ChromeURLDataManager::DataSource { | 250 class MockWebUIDataSource : public ChromeURLDataManager::DataSource { |
251 public: | 251 public: |
252 MockWebUIDataSource() | 252 MockWebUIDataSource() |
253 : ChromeURLDataManager::DataSource("dummyurl", MessageLoop::current()) {} | 253 : ChromeURLDataManager::DataSource("dummyurl", MessageLoop::current()) {} |
254 | 254 |
255 private: | 255 private: |
| 256 virtual ~MockWebUIDataSource() {} |
| 257 |
256 virtual void StartDataRequest(const std::string& path, | 258 virtual void StartDataRequest(const std::string& path, |
257 bool is_incognito, | 259 bool is_incognito, |
258 int request_id) OVERRIDE { | 260 int request_id) OVERRIDE { |
259 std::string dummy_html = "<html><body>Dummy</body></html>"; | 261 std::string dummy_html = "<html><body>Dummy</body></html>"; |
260 scoped_refptr<base::RefCountedString> response = | 262 scoped_refptr<base::RefCountedString> response = |
261 base::RefCountedString::TakeString(&dummy_html); | 263 base::RefCountedString::TakeString(&dummy_html); |
262 SendResponse(request_id, response); | 264 SendResponse(request_id, response); |
263 } | 265 } |
264 | 266 |
265 std::string GetMimeType(const std::string& path) const OVERRIDE { | 267 std::string GetMimeType(const std::string& path) const OVERRIDE { |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 // testDone directly and expect pass result. | 688 // testDone directly and expect pass result. |
687 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 689 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
688 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 690 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
689 } | 691 } |
690 | 692 |
691 // Test that calling testDone during RunJavascriptTest still completes when | 693 // Test that calling testDone during RunJavascriptTest still completes when |
692 // waiting for async result. | 694 // waiting for async result. |
693 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 695 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
694 ASSERT_TRUE(RunJavascriptTest("testDone")); | 696 ASSERT_TRUE(RunJavascriptTest("testDone")); |
695 } | 697 } |
OLD | NEW |