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

Side by Side Diff: chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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) 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 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 0, launcher.Pass()); 188 0, launcher.Pass());
189 ASSERT_TRUE(native_message_process_host_.get()); 189 ASSERT_TRUE(native_message_process_host_.get());
190 base::RunLoop().RunUntilIdle(); 190 base::RunLoop().RunUntilIdle();
191 191
192 native_message_process_host_->Send(kTestMessage); 192 native_message_process_host_->Send(kTestMessage);
193 base::RunLoop().RunUntilIdle(); 193 base::RunLoop().RunUntilIdle();
194 194
195 std::string output; 195 std::string output;
196 base::TimeTicks start_time = base::TimeTicks::Now(); 196 base::TimeTicks start_time = base::TimeTicks::Now();
197 while (base::TimeTicks::Now() - start_time < TestTimeouts::action_timeout()) { 197 while (base::TimeTicks::Now() - start_time < TestTimeouts::action_timeout()) {
198 ASSERT_TRUE(file_util::ReadFileToString(temp_output_file, &output)); 198 ASSERT_TRUE(base::ReadFileToString(temp_output_file, &output));
199 if (!output.empty()) 199 if (!output.empty())
200 break; 200 break;
201 base::PlatformThread::YieldCurrentThread(); 201 base::PlatformThread::YieldCurrentThread();
202 } 202 }
203 203
204 EXPECT_EQ(FormatMessage(kTestMessage), output); 204 EXPECT_EQ(FormatMessage(kTestMessage), output);
205 } 205 }
206 206
207 // Test send message with a real client. The client just echo's back the text 207 // Test send message with a real client. The client just echo's back the text
208 // it received. 208 // it received.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 read_message_run_loop_->Run(); 246 read_message_run_loop_->Run();
247 EXPECT_TRUE(last_message_parsed_->GetInteger("id", &id)); 247 EXPECT_TRUE(last_message_parsed_->GetInteger("id", &id));
248 EXPECT_EQ(2, id); 248 EXPECT_EQ(2, id);
249 EXPECT_TRUE(last_message_parsed_->GetString("echo.foo", &text)); 249 EXPECT_TRUE(last_message_parsed_->GetString("echo.foo", &text));
250 EXPECT_EQ("bar", text); 250 EXPECT_EQ("bar", text);
251 EXPECT_TRUE(last_message_parsed_->GetString("caller_url", &url)); 251 EXPECT_TRUE(last_message_parsed_->GetString("caller_url", &url));
252 EXPECT_EQ(expected_url, url); 252 EXPECT_EQ(expected_url, url);
253 } 253 }
254 254
255 } // namespace extensions 255 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698