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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log_browsertest.cc

Issue 19234003: Extension activity log database refactoring (step 2) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address some reviewer comments Created 7 years, 5 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
OLDNEW
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/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "chrome/browser/extensions/activity_log/activity_log.h" 6 #include "chrome/browser/extensions/activity_log/activity_log.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/prerender/prerender_handle.h" 9 #include "chrome/browser/prerender/prerender_handle.h"
10 #include "chrome/browser/prerender/prerender_manager.h" 10 #include "chrome/browser/prerender/prerender_manager.h"
(...skipping 16 matching lines...) Expand all
27 protected: 27 protected:
28 // Make sure the activity log is turned on. 28 // Make sure the activity log is turned on.
29 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 29 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
30 ExtensionBrowserTest::SetUpCommandLine(command_line); 30 ExtensionBrowserTest::SetUpCommandLine(command_line);
31 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging); 31 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging);
32 command_line->AppendSwitch(switches::kEnableExtensionActivityLogTesting); 32 command_line->AppendSwitch(switches::kEnableExtensionActivityLogTesting);
33 command_line->AppendSwitchASCII(switches::kPrerenderMode, 33 command_line->AppendSwitchASCII(switches::kPrerenderMode,
34 switches::kPrerenderModeSwitchValueEnabled); 34 switches::kPrerenderModeSwitchValueEnabled);
35 } 35 }
36 36
37 static void Prerender_Arguments(int port, 37 static void Prerender_Arguments(
38 const std::string& extension_id,
39 int port,
38 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { 40 scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
39 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below 41 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below
40 base::MessageLoop::current()->PostTask( 42 base::MessageLoop::current()->PostTask(
41 FROM_HERE, base::MessageLoop::QuitClosure()); 43 FROM_HERE, base::MessageLoop::QuitClosure());
42 44
43 ASSERT_TRUE(i->size()); 45 ASSERT_TRUE(i->size());
44 scoped_refptr<Action> last = i->front(); 46 scoped_refptr<Action> last = i->front();
45 47
46 std::string args = base::StringPrintf( 48 std::string args = base::StringPrintf(
47 "Injected scripts (\"/google_cs.js \") " 49 "ID=%s CATEGORY=content_script API= ARGS=[\"\\\"/google_cs.js \\\"\"] "
48 "onto http://www.google.com.bo:%d/test.html (prerender)", 50 "PAGE_URL=http://www.google.com.bo:%d/test.html "
49 port); 51 "OTHER={\"dom_verb\":3,\"extra\":\"(prerender)\",\"page_title\":\"www."
52 "google.com.bo:%d/test.html\"}",
53 extension_id.c_str(), port, port);
50 // TODO: Replace PrintForDebug with field testing 54 // TODO: Replace PrintForDebug with field testing
51 // when this feature will be available 55 // when this feature will be available
52 ASSERT_EQ(args, last->PrintForDebug()); 56 ASSERT_EQ(args, last->PrintForDebug());
53 } 57 }
54 }; 58 };
55 59
56 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) { 60 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) {
57 host_resolver()->AddRule("*", "127.0.0.1"); 61 host_resolver()->AddRule("*", "127.0.0.1");
58 StartEmbeddedTestServer(); 62 StartEmbeddedTestServer();
59 int port = embedded_test_server()->port(); 63 int port = embedded_test_server()->port();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 scoped_ptr<prerender::PrerenderHandle> prerender_handle( 95 scoped_ptr<prerender::PrerenderHandle> prerender_handle(
92 prerender_manager->AddPrerenderFromLocalPredictor( 96 prerender_manager->AddPrerenderFromLocalPredictor(
93 url, 97 url,
94 web_contents->GetController().GetSessionStorageNamespace(), 98 web_contents->GetController().GetSessionStorageNamespace(),
95 kSize)); 99 kSize));
96 100
97 page_observer.Wait(); 101 page_observer.Wait();
98 102
99 activity_log->GetActions( 103 activity_log->GetActions(
100 ext->id(), 0, base::Bind( 104 ext->id(), 0, base::Bind(
101 ActivityLogPrerenderTest::Prerender_Arguments, port)); 105 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port));
102 106
103 // Allow invocation of Prerender_Arguments 107 // Allow invocation of Prerender_Arguments
104 base::MessageLoop::current()->Run(); 108 base::MessageLoop::current()->Run();
105 } 109 }
106 110
107 } // namespace extensions 111 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698