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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 void SetUpCommandLine(base::CommandLine* command_line) override { | 34 void SetUpCommandLine(base::CommandLine* command_line) override { |
35 ExtensionBrowserTest::SetUpCommandLine(command_line); | 35 ExtensionBrowserTest::SetUpCommandLine(command_line); |
36 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging); | 36 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging); |
37 command_line->AppendSwitchASCII(switches::kPrerenderMode, | 37 command_line->AppendSwitchASCII(switches::kPrerenderMode, |
38 switches::kPrerenderModeSwitchValueEnabled); | 38 switches::kPrerenderModeSwitchValueEnabled); |
39 } | 39 } |
40 | 40 |
41 static void Prerender_Arguments( | 41 static void Prerender_Arguments( |
42 const std::string& extension_id, | 42 const std::string& extension_id, |
43 uint16_t port, | 43 uint16_t port, |
44 scoped_ptr<std::vector<scoped_refptr<Action>>> i) { | 44 std::unique_ptr<std::vector<scoped_refptr<Action>>> i) { |
45 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below | 45 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below |
46 base::ThreadTaskRunnerHandle::Get()->PostTask( | 46 base::ThreadTaskRunnerHandle::Get()->PostTask( |
47 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 47 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
48 | 48 |
49 ASSERT_TRUE(i->size()); | 49 ASSERT_TRUE(i->size()); |
50 scoped_refptr<Action> last = i->front(); | 50 scoped_refptr<Action> last = i->front(); |
51 | 51 |
52 ASSERT_EQ(extension_id, last->extension_id()); | 52 ASSERT_EQ(extension_id, last->extension_id()); |
53 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type()); | 53 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type()); |
54 ASSERT_EQ("[\"/google_cs.js\"]", | 54 ASSERT_EQ("[\"/google_cs.js\"]", |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 content::WindowedNotificationObserver page_observer( | 99 content::WindowedNotificationObserver page_observer( |
100 content::NOTIFICATION_LOAD_STOP, | 100 content::NOTIFICATION_LOAD_STOP, |
101 content::NotificationService::AllSources()); | 101 content::NotificationService::AllSources()); |
102 | 102 |
103 GURL url(base::StringPrintf( | 103 GURL url(base::StringPrintf( |
104 "http://www.google.com.bo:%u/test.html", | 104 "http://www.google.com.bo:%u/test.html", |
105 port)); | 105 port)); |
106 | 106 |
107 const gfx::Size kSize(640, 480); | 107 const gfx::Size kSize(640, 480); |
108 scoped_ptr<prerender::PrerenderHandle> prerender_handle( | 108 std::unique_ptr<prerender::PrerenderHandle> prerender_handle( |
109 prerender_manager->AddPrerenderFromOmnibox( | 109 prerender_manager->AddPrerenderFromOmnibox( |
110 url, | 110 url, |
111 web_contents->GetController().GetDefaultSessionStorageNamespace(), | 111 web_contents->GetController().GetDefaultSessionStorageNamespace(), |
112 kSize)); | 112 kSize)); |
113 | 113 |
114 page_observer.Wait(); | 114 page_observer.Wait(); |
115 | 115 |
116 activity_log->GetFilteredActions( | 116 activity_log->GetFilteredActions( |
117 ext->id(), | 117 ext->id(), |
118 Action::ACTION_ANY, | 118 Action::ACTION_ANY, |
119 "", | 119 "", |
120 "", | 120 "", |
121 "", | 121 "", |
122 -1, | 122 -1, |
123 base::Bind( | 123 base::Bind( |
124 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port)); | 124 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port)); |
125 | 125 |
126 // Allow invocation of Prerender_Arguments | 126 // Allow invocation of Prerender_Arguments |
127 base::MessageLoop::current()->Run(); | 127 base::MessageLoop::current()->Run(); |
128 } | 128 } |
129 | 129 |
130 } // namespace extensions | 130 } // namespace extensions |
OLD | NEW |