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

Side by Side Diff: chrome/browser/printing/print_dialog_cloud_uitest.cc

Issue 3983005: Revert 63600 - Thread IO safety: annotate file_util, and block IO thread from... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 4
5 #include "chrome/browser/printing/print_dialog_cloud.h" 5 #include "chrome/browser/printing/print_dialog_cloud.h"
6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h"
7 7
8 #include <functional> 8 #include <functional>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/singleton.h" 13 #include "base/singleton.h"
14 #include "base/thread_restrictions.h"
15 #include "base/values.h" 14 #include "base/values.h"
16 #include "chrome/browser/browser_list.h" 15 #include "chrome/browser/browser_list.h"
17 #include "chrome/browser/browser_thread.h" 16 #include "chrome/browser/browser_thread.h"
18 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 17 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
19 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" 18 #include "chrome/browser/printing/cloud_print/cloud_print_url.h"
20 #include "chrome/browser/renderer_host/render_view_host.h" 19 #include "chrome/browser/renderer_host/render_view_host.h"
21 #include "chrome/browser/tab_contents/tab_contents.h" 20 #include "chrome/browser/tab_contents/tab_contents.h"
22 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
24 #include "chrome/test/in_process_browser_test.h" 23 #include "chrome/test/in_process_browser_test.h"
25 #include "chrome/test/ui_test_utils.h" 24 #include "chrome/test/ui_test_utils.h"
26 #include "net/url_request/url_request_filter.h" 25 #include "net/url_request/url_request_filter.h"
27 #include "net/url_request/url_request_test_job.h" 26 #include "net/url_request/url_request_test_job.h"
28 #include "net/url_request/url_request_unittest.h" 27 #include "net/url_request/url_request_unittest.h"
29 28
30 namespace { 29 namespace {
31 30
32 class TestData { 31 class TestData {
33 public: 32 public:
34 TestData() {} 33 TestData() {}
35 34
36 const char* GetTestData() { 35 char* GetTestData() {
37 // Fetching this data blocks the IO thread, but we don't really care because
38 // this is a test.
39 base::ThreadRestrictions::ScopedAllowIO allow_io;
40
41 if (test_data_.empty()) { 36 if (test_data_.empty()) {
42 FilePath test_data_directory; 37 FilePath test_data_directory;
43 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory); 38 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory);
44 FilePath test_file = 39 FilePath test_file =
45 test_data_directory.AppendASCII("printing/cloud_print_uitest.html"); 40 test_data_directory.AppendASCII("printing/cloud_print_uitest.html");
46 file_util::ReadFileToString(test_file, &test_data_); 41 file_util::ReadFileToString(test_file, &test_data_);
47 } 42 }
48 return test_data_.c_str(); 43 return &test_data_[0];
49 } 44 }
50 private: 45 private:
51 std::string test_data_; 46 std::string test_data_;
52 }; 47 };
53 48
54 // A simple test URLRequestJob. We don't care what it does, only that 49 // A simple test URLRequestJob. We don't care what it does, only that
55 // whether it starts and finishes. 50 // whether it starts and finishes.
56 class SimpleTestJob : public URLRequestTestJob { 51 class SimpleTestJob : public URLRequestTestJob {
57 public: 52 public:
58 explicit SimpleTestJob(URLRequest* request) 53 explicit SimpleTestJob(URLRequest* request)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 231
237 std::wstring window_print(L"window.print()"); 232 std::wstring window_print(L"window.print()");
238 browser()->GetSelectedTabContents()->render_view_host()-> 233 browser()->GetSelectedTabContents()->render_view_host()->
239 ExecuteJavascriptInWebFrame(std::wstring(), window_print); 234 ExecuteJavascriptInWebFrame(std::wstring(), window_print);
240 235
241 ui_test_utils::RunMessageLoop(); 236 ui_test_utils::RunMessageLoop();
242 237
243 ASSERT_TRUE(Singleton<TestController>()->result()); 238 ASSERT_TRUE(Singleton<TestController>()->result());
244 } 239 }
245 #endif 240 #endif
OLDNEW
« no previous file with comments | « chrome/browser/net/url_request_mock_util.cc ('k') | chrome/browser/service/service_process_control.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698