OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/location.h" | 5 #include "base/location.h" |
6 #include "base/single_thread_task_runner.h" | 6 #include "base/single_thread_task_runner.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
9 #include "chrome/browser/extensions/activity_log/activity_log.h" | 9 #include "chrome/browser/extensions/activity_log/activity_log.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 command_line->AppendSwitchASCII(switches::kPrerenderMode, | 35 command_line->AppendSwitchASCII(switches::kPrerenderMode, |
36 switches::kPrerenderModeSwitchValueEnabled); | 36 switches::kPrerenderModeSwitchValueEnabled); |
37 } | 37 } |
38 | 38 |
39 static void Prerender_Arguments( | 39 static void Prerender_Arguments( |
40 const std::string& extension_id, | 40 const std::string& extension_id, |
41 uint16 port, | 41 uint16 port, |
42 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { | 42 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { |
43 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below | 43 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below |
44 base::ThreadTaskRunnerHandle::Get()->PostTask( | 44 base::ThreadTaskRunnerHandle::Get()->PostTask( |
45 FROM_HERE, base::MessageLoop::QuitClosure()); | 45 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
46 | 46 |
47 ASSERT_TRUE(i->size()); | 47 ASSERT_TRUE(i->size()); |
48 scoped_refptr<Action> last = i->front(); | 48 scoped_refptr<Action> last = i->front(); |
49 | 49 |
50 ASSERT_EQ(extension_id, last->extension_id()); | 50 ASSERT_EQ(extension_id, last->extension_id()); |
51 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type()); | 51 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type()); |
52 ASSERT_EQ("[\"/google_cs.js\"]", | 52 ASSERT_EQ("[\"/google_cs.js\"]", |
53 ActivityLogPolicy::Util::Serialize(last->args())); | 53 ActivityLogPolicy::Util::Serialize(last->args())); |
54 ASSERT_EQ( | 54 ASSERT_EQ( |
55 base::StringPrintf("http://www.google.com.bo:%u/test.html", port), | 55 base::StringPrintf("http://www.google.com.bo:%u/test.html", port), |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 "", | 119 "", |
120 -1, | 120 -1, |
121 base::Bind( | 121 base::Bind( |
122 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port)); | 122 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port)); |
123 | 123 |
124 // Allow invocation of Prerender_Arguments | 124 // Allow invocation of Prerender_Arguments |
125 base::MessageLoop::current()->Run(); | 125 base::MessageLoop::current()->Run(); |
126 } | 126 } |
127 | 127 |
128 } // namespace extensions | 128 } // namespace extensions |
OLD | NEW |