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 14 matching lines...) Expand all Loading... |
25 #include "chrome/test/base/test_tab_strip_model_observer.h" | 25 #include "chrome/test/base/test_tab_strip_model_observer.h" |
26 #include "chrome/test/base/ui_test_utils.h" | 26 #include "chrome/test/base/ui_test_utils.h" |
27 #include "content/public/browser/navigation_controller.h" | 27 #include "content/public/browser/navigation_controller.h" |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
29 #include "content/public/browser/web_ui_controller.h" | 29 #include "content/public/browser/web_ui_controller.h" |
30 #include "content/public/browser/web_ui_message_handler.h" | 30 #include "content/public/browser/web_ui_message_handler.h" |
31 #include "net/base/net_util.h" | 31 #include "net/base/net_util.h" |
32 #include "testing/gmock/include/gmock/gmock.h" | 32 #include "testing/gmock/include/gmock/gmock.h" |
33 #include "testing/gtest/include/gtest/gtest-spi.h" | 33 #include "testing/gtest/include/gtest/gtest-spi.h" |
34 #include "ui/base/resource/resource_bundle.h" | 34 #include "ui/base/resource/resource_bundle.h" |
| 35 #include "ui/base/resource/resource_handle.h" |
35 | 36 |
36 using content::NavigationController; | 37 using content::NavigationController; |
37 using content::RenderViewHost; | 38 using content::RenderViewHost; |
38 using content::WebContents; | 39 using content::WebContents; |
39 using content::WebUIController; | 40 using content::WebUIController; |
40 using content::WebUIMessageHandler; | 41 using content::WebUIMessageHandler; |
41 | 42 |
42 namespace { | 43 namespace { |
43 | 44 |
44 const FilePath::CharType kMockJS[] = FILE_PATH_LITERAL("mock4js.js"); | 45 const FilePath::CharType kMockJS[] = FILE_PATH_LITERAL("mock4js.js"); |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 GURL(kDummyURL).host(), mock_provider_.Pointer()); | 315 GURL(kDummyURL).host(), mock_provider_.Pointer()); |
315 | 316 |
316 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_)); | 317 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_)); |
317 test_data_directory_ = test_data_directory_.Append(kWebUITestFolder); | 318 test_data_directory_ = test_data_directory_.Append(kWebUITestFolder); |
318 ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, | 319 ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, |
319 &gen_test_data_directory_)); | 320 &gen_test_data_directory_)); |
320 | 321 |
321 // TODO(dtseng): should this be part of every BrowserTest or just WebUI test. | 322 // TODO(dtseng): should this be part of every BrowserTest or just WebUI test. |
322 FilePath resources_pack_path; | 323 FilePath resources_pack_path; |
323 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 324 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
324 ResourceBundle::GetSharedInstance().AddDataPack(resources_pack_path); | 325 ResourceBundle::GetSharedInstance().AddDataPack( |
| 326 resources_pack_path, ui::ResourceHandle::kScaleFactor1x); |
325 | 327 |
326 FilePath mockPath; | 328 FilePath mockPath; |
327 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &mockPath)); | 329 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &mockPath)); |
328 mockPath = mockPath.AppendASCII("chrome"); | 330 mockPath = mockPath.AppendASCII("chrome"); |
329 mockPath = mockPath.AppendASCII("third_party"); | 331 mockPath = mockPath.AppendASCII("third_party"); |
330 mockPath = mockPath.AppendASCII("mock4js"); | 332 mockPath = mockPath.AppendASCII("mock4js"); |
331 mockPath = mockPath.Append(kMockJS); | 333 mockPath = mockPath.Append(kMockJS); |
332 AddLibrary(mockPath); | 334 AddLibrary(mockPath); |
333 AddLibrary(FilePath(kWebUILibraryJS)); | 335 AddLibrary(FilePath(kWebUILibraryJS)); |
334 } | 336 } |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 // testDone directly and expect pass result. | 690 // testDone directly and expect pass result. |
689 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 691 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
690 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 692 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
691 } | 693 } |
692 | 694 |
693 // Test that calling testDone during RunJavascriptTest still completes when | 695 // Test that calling testDone during RunJavascriptTest still completes when |
694 // waiting for async result. | 696 // waiting for async result. |
695 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 697 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
696 ASSERT_TRUE(RunJavascriptTest("testDone")); | 698 ASSERT_TRUE(RunJavascriptTest("testDone")); |
697 } | 699 } |
OLD | NEW |