text
stringlengths
4
1.01M
<?php /* Class to send push notifications using Google Cloud Messaging for Android Example usage ----------------------- $an = new GCMPushMessage($apiKey); $an->setDevices($devices); $response = $an->send($message); ----------------------- $apiKey Your GCM api key $devices An array or string of registered device tokens $message The mesasge you want to push out @author Matt Grundy Adapted from the code available at: http://stackoverflow.com/questions/11242743/gcm-with-php-google-cloud-messaging */ class GCMPushMessage { // the URL of the GCM API endpoint private $url = 'https://android.googleapis.com/gcm/send'; // the server API key - setup on class init private $serverApiKey = ""; // array of devices to send to private $devices = array(); /* Constructor @param $apiKeyIn the server API key */ function GCMPushMessage($apiKeyIn){ $this->serverApiKey = $apiKeyIn; } /* Set the devices to send to @param $deviceIds array of device tokens to send to */ function setDevices($deviceIds){ if(is_array($deviceIds)){ $this->devices = $deviceIds; } else { $this->devices = array($deviceIds); } } /* Send the message to the device @param $message The message to send @param $data Array of data to accompany the message */ function send($message, $data = false){ if(!is_array($this->devices) || count($this->devices) == 0){ throw new GCMPushMessageArgumentException("No devices set"); } if(strlen($this->serverApiKey) < 8){ throw new GCMPushMessageArgumentException("Server API Key not set"); } $fields = array( 'registration_ids' => $this->devices, 'data' => array( "message" => $message ), ); if(is_array($data)){ foreach ($data as $key => $value) { $fields['data'][$key] = $value; } } $headers = array( 'Authorization: key=' . $this->serverApiKey, 'Content-Type: application/json' ); // Open connection $ch = curl_init(); // Set the url, number of POST vars, POST data curl_setopt( $ch, CURLOPT_URL, $this->url ); curl_setopt( $ch, CURLOPT_POST, true ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields ) ); // Avoids problem with https certificate curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); // Execute post $result = curl_exec($ch); // Close connection curl_close($ch); return $result; } } class GCMPushMessageArgumentException extends Exception { public function __construct($message, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); } public function __toString() { return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; } }
export * from './code-editor-grid.component';
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef __TESTS_SCRIPT_HPP__ #define __TESTS_SCRIPT_HPP__ #include <gtest/gtest.h> namespace mesos { namespace internal { namespace tests { // Helper used by TEST_SCRIPT to execute the script. void execute(const std::string& script); } // namespace tests { } // namespace internal { } // namespace mesos { // Runs the given script (relative to src/tests). We execute this // script in temporary directory and pipe its output to '/dev/null' // unless the verbose option is specified. The "test" passes if the // script returns 0. #define TEST_SCRIPT(test_case_name, test_name, script) \ TEST(test_case_name, test_name) { \ mesos::internal::tests::execute(script); \ } #endif // __TESTS_SCRIPT_HPP__
var tests = []; for (var file in window.__karma__.files) { if (/Spec\.js$/.test(file)) { tests.push(file); } } requirejs.config({ // Karma serves files from '/base' baseUrl: '.', paths: { }, shim: { 'underscore': { exports: '_' } }, // ask Require.js to load these files (all our tests) deps: tests, // start test run, once Require.js is done callback: window.__karma__.start });
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the Free Software Foundation. This program is also distributed with certain software (including but not limited to OpenSSL) that is licensed under separate terms, as designated in a particular file or component or in included license documentation. The authors of MySQL hereby grant you an additional permission to link the program and your derivative works with the separately licensed software that they have included with MySQL. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file storage/perfschema/table_esms_global_by_event_name.cc Table EVENTS_STATEMENTS_SUMMARY_GLOBAL_BY_EVENT_NAME (implementation). */ #include "my_global.h" #include "my_thread.h" #include "pfs_instr_class.h" #include "pfs_column_types.h" #include "pfs_column_values.h" #include "table_esms_global_by_event_name.h" #include "pfs_global.h" #include "pfs_instr.h" #include "pfs_timer.h" #include "pfs_visitor.h" #include "field.h" THR_LOCK table_esms_global_by_event_name::m_table_lock; static const TABLE_FIELD_TYPE field_types[]= { { { C_STRING_WITH_LEN("EVENT_NAME") }, { C_STRING_WITH_LEN("varchar(128)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("COUNT_STAR") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_TIMER_WAIT") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("MIN_TIMER_WAIT") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("AVG_TIMER_WAIT") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("MAX_TIMER_WAIT") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_LOCK_TIME") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_ERRORS") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_WARNINGS") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_ROWS_AFFECTED") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_ROWS_SENT") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_ROWS_EXAMINED") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_CREATED_TMP_DISK_TABLES") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_CREATED_TMP_TABLES") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_SELECT_FULL_JOIN") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_SELECT_FULL_RANGE_JOIN") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_SELECT_RANGE") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_SELECT_RANGE_CHECK") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_SELECT_SCAN") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_SORT_MERGE_PASSES") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_SORT_RANGE") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_SORT_ROWS") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_SORT_SCAN") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_NO_INDEX_USED") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} }, { { C_STRING_WITH_LEN("SUM_NO_GOOD_INDEX_USED") }, { C_STRING_WITH_LEN("bigint(20)") }, { NULL, 0} } }; TABLE_FIELD_DEF table_esms_global_by_event_name::m_field_def= { 25, field_types }; PFS_engine_table_share table_esms_global_by_event_name::m_share= { { C_STRING_WITH_LEN("events_statements_summary_global_by_event_name") }, &pfs_truncatable_acl, table_esms_global_by_event_name::create, NULL, /* write_row */ table_esms_global_by_event_name::delete_all_rows, table_esms_global_by_event_name::get_row_count, sizeof(PFS_simple_index), &m_table_lock, &m_field_def, false, /* checked */ false /* perpetual */ }; PFS_engine_table* table_esms_global_by_event_name::create(void) { return new table_esms_global_by_event_name(); } int table_esms_global_by_event_name::delete_all_rows(void) { reset_events_statements_by_thread(); reset_events_statements_by_account(); reset_events_statements_by_user(); reset_events_statements_by_host(); reset_events_statements_global(); return 0; } ha_rows table_esms_global_by_event_name::get_row_count(void) { return statement_class_max; } table_esms_global_by_event_name::table_esms_global_by_event_name() : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(1), m_next_pos(1) {} void table_esms_global_by_event_name::reset_position(void) { m_pos= 1; m_next_pos= 1; } int table_esms_global_by_event_name::rnd_init(bool scan) { m_normalizer= time_normalizer::get(statement_timer); return 0; } int table_esms_global_by_event_name::rnd_next(void) { PFS_statement_class *statement_class; if (global_instr_class_statements_array == NULL) return HA_ERR_END_OF_FILE; m_pos.set_at(&m_next_pos); statement_class= find_statement_class(m_pos.m_index); if (statement_class) { make_row(statement_class); m_next_pos.set_after(&m_pos); return 0; } return HA_ERR_END_OF_FILE; } int table_esms_global_by_event_name::rnd_pos(const void *pos) { PFS_statement_class *statement_class; set_position(pos); if (global_instr_class_statements_array == NULL) return HA_ERR_END_OF_FILE; statement_class=find_statement_class(m_pos.m_index); if (statement_class) { make_row(statement_class); return 0; } return HA_ERR_RECORD_DELETED; } void table_esms_global_by_event_name ::make_row(PFS_statement_class *klass) { m_row_exists= false; if (klass->is_mutable()) return; m_row.m_event_name.make_row(klass); PFS_connection_statement_visitor visitor(klass); PFS_connection_iterator::visit_global(true, /* hosts */ false, /* users */ true, /* accounts */ true, /* threads */ false, /* THDs */ & visitor); m_row.m_stat.set(m_normalizer, & visitor.m_stat); m_row_exists= true; } int table_esms_global_by_event_name ::read_row_values(TABLE *table, unsigned char *, Field **fields, bool read_all) { Field *f; if (unlikely(! m_row_exists)) return HA_ERR_RECORD_DELETED; /* Set the null bits */ DBUG_ASSERT(table->s->null_bytes == 0); for (; (f= *fields) ; fields++) { if (read_all || bitmap_is_set(table->read_set, f->field_index)) { switch(f->field_index) { case 0: /* NAME */ m_row.m_event_name.set_field(f); break; default: /* 1, ... COUNT/SUM/MIN/AVG/MAX */ m_row.m_stat.set_field(f->field_index - 1, f); break; } } } return 0; }
# Angular 4 + spin.js Not long ago I was working on a project using Angular 4 and as with many applications I needed a loading indicator. After doing a bit of searching I decided to use Spin.js, a really cool JavaScript library that can be used to render a 'spinner' without using external images/css. I then started thinking, how do I do this with Angular 4... do I need a component that I put in every page, is there a way to share a single root level component with my app, etc. I then came across a really good blog by Tom Buyse explaining how to setup an observable subscription in order to control a single component using a service that you pass around your application (Thanks Tom!). I think this can be a really useful pattern of development for a number of purposes, but here's a look at how I created an Angular2 spinner component with Spin.js. (Note: I eventually found better aesthetics using @angular/material's progress indicator and abandoned this, but it was still a good learning effort) ### The spinner component First of all I created the component that I'll put an instance of in my root application view. ``` @Component({ selector: 'sjs-spinner', templateUrl: './spinner.component.html' }) export class SpinnerComponent implements OnInit, OnDestroy { . ``` In the component I exposed the Spin.js options as Angular2 component inputs ``` @Input() lines: number = 12; // The number of lines to draw @Input() length: number = 20; // The length of each line @Input() width: number = 12; // The line thickness @Input() radius: number = 50; // The radius of the inner circle @Input() scale: number = 1.0; // Scales overall size of the spinner . . . ``` Then on the component's ngOnInit callback I initialize the component with a setup of inputs from the view specifying spin.js options. It's important to do so in the ngOnInit callback as in the constructor would be too early and the inputs are not passed from the parent view element. ``` ngOnInit() { this.initSpinner(); this.createServiceSubscription(); } private initSpinner() { let options = { lines: this.lines, length: this.length, width: this.width, radius: this.radius, scale: this.scale, corners: this.corners, color: this.color, opacity: this.opacity, rotate: this.rotate, direction: this.direction, speed: this.speed, trail: this.trail, fps: this.fps, zIndex: 2e9, // Artificially high z-index to keep on top className: this.className, top: this.top, left: this.left, shadow: this.shadow, hwaccel: this.hwaccel, position: this.position }; console.log('Creating spinner with options:'); console.log(JSON.stringify((options))); this.spinner = new Spinner(options); } ``` Now we've got an instance of the spin.js object created than we can show and hide as needed. Next comes the magic, we create a service that holds a shared observable in order to control the spinner component from other components within the application. Note: it's important to import the Rxjs 'share' operator in order to create the shared observable, I did so in a file called rxjs-operators.ts that I've imported into my main application component. ``` @Injectable() export class SpinnerService { private spinnerObserver: Observer<boolean>; public spinnerObservable: Observable<boolean>; constructor() { this.spinnerObservable = new Observable<boolean>(observer => { this.spinnerObserver = observer; } ).share(); } } ``` The spinner component can then subscribe to this observable and receive notifications from the service as whether it should show or hide the spinner. I've also called this subscription code from within the ngOnInit callback, though it'd be fine to do so within the component constructor as well. ``` private createServiceSubscription() { this.subscription = this.spinnerService.spinnerObservable.subscribe(show => { if (show) { this.startSpinner(); } else { this.stopSpinner(); } }); } ``` The service can use the observable in order to trigger the show and hide states in the component. ``` show() { if (this.spinnerObserver) { this.spinnerObserver.next(true); } } hide() { if (this.spinnerObserver) { this.spinnerObserver.next(false); } } ``` Now I can drop an instance of my spinner component in my main app component specifying it's view options: ``` <ng2-spinner [radius]="25" [lines]="15" [width]="8" [length]="15" [opacity]="0.1" [shadow]="true"></ng2-spinner> ``` And pass around the spinner service to control showing/hiding it everywhere else in my application ``` constructor(private spinnerService: SpinnerService) { } public spin(event: MouseEvent): void { event.preventDefault(); this.spinnerService.show(); setTimeout(() => { this.spinnerService.hide(); }, 1000); } ``` I think this is a really useful pattern and can imagine it'll come in handy on my current and future projects. So far I really like Angular2, I think it brings some sanity back to client side web application development. I can only imagine I'll get more than 1 grumble about that comment, but so far I've found it to be a great development experience. http://tombuyse.com/creating-a-loading-indicator-in-angular-2-ionic-2/ http://spin.js.org/
module AdminAnnotationsHelper end
{default_translation_domain domain='comment.fo.default'} {$locale={lang attr="locale"}} {$customer_id={customer attr="id"}} {ifloop rel="comments"} {function name=comment_stars empty=1} {$star='<span class="glyphicon glyphicon-star"></span>'} {$star_empty='<span class="glyphicon glyphicon-star-empty"></span>'} {for $foo=0 to 4} {if $value > $foo} {$star nofilter} {elseif $empty == 1} {$star_empty nofilter} {/if} {/for} {/function} {loop name="comments" type="comment" ref="{$ref}" ref_id="{$ref_id}" status="1" order="created_reverse" offset="{$start}" limit="{$count}" } {if $CUSTOMER_ID} {loop name="customer" type="customer" id="{$CUSTOMER_ID}" current="false" limit="1"} {$username="{$FIRSTNAME} {$LASTNAME|truncate:2:"...":false}"} {$image="http://www.gravatar.com/avatar/{$EMAIL|trim|strtolower|md5}?d=mm&s=64"} {/loop} {elseloop rel="customer"} {$username={intl l="Anonymous"} } {$image={image file='assets/img/avatar.png'}} {/elseloop} {else} {$username=$USERNAME} {$image="http://www.gravatar.com/avatar/{$EMAIL|trim|strtolower|md5}?d=mm&s=64"} {/if} <div id="comment-customer" class="comment-item media"> <img src="{$image}" alt="" class="pull-left" /> <div class="media-body"> <p> {intl l="By <strong>%username</strong>" username={$username}} {if $RATING}<span class="text-primary">{comment_stars value=$RATING}</span>{/if} </p> <h3 class="comment-title media-heading">{$TITLE}</h3> <p class="comment-message">{$CONTENT}</p> <div class="comment-alert alert hidden"></div> <ul class="comment-extra list-inline"> <li class="comment-date">{format_date date="{$CREATED}" output="date"}</li> {if $VERIFIED} <li class="comment-verified comment--is-verified">{intl l="Verified"}</li> {else} <li class="comment-verified">{intl l="Verified"}</li> {/if} {if $customer_id && $customer_id == $CUSTOMER_ID} <li><a href="{url path="/comment/delete/{$ID}"}" class="delete-trigger" data-id="{$ID}" data-message="{intl l="Are you sure ?"}">{intl l="Delete"}</a></li> {else} <li class="comment-abuse"> {form name="comment.abuse.form"} <form id="form-add-comment" action="{url path="/comment/abuse"}" method="post" novalidate> {form_hidden_fields form=$form} {form_field form=$form field="id"} <input type="hidden" name="{$name}" value="{$ID}" /> <a href="#" class="abuse-trigger">{intl l="Mark as inappropriate"}</a> {/form_field} </form> {/form} </li> {/if} </ul> </div> </div> {/loop} {if {count type="comment" ref="{$ref}" ref_id="{$ref_id}" status="1" } > $start + $count } <div class="comments-more"> <a href="#" class="comments-more-link">{intl l="Load more comments..."}</a> </div> {/if} {/ifloop} {elseloop rel="comments"} <div class="alert alert-info"> {if $start == 0 } {intl l="There are no comments yet"} {else} {intl l="No more comments"} {/if} </div> {/elseloop}
/*************************************************************************** * Copyright (C) 2007 by Benedikt Sauter * * sauter@ixbat.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ /* * This file is based on Dominic Rath's amt_jtagaccel.c. * * usbprog is a free programming adapter. You can easily install * different firmware versions from an "online pool" over USB. * The adapter can be used for programming and debugging AVR and ARM * processors, as USB to RS232 converter, as JTAG interface or as * simple I/O interface (5 lines). * * http://www.embedded-projects.net/usbprog */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <jtag/interface.h> #include <jtag/commands.h> #include "usb_common.h" #define VID 0x1781 #define PID 0x0c63 /* Pins at usbprog */ #define TDO_BIT 0 #define TDI_BIT 3 #define TCK_BIT 2 #define TMS_BIT 1 static void usbprog_end_state(tap_state_t state); static void usbprog_state_move(void); static void usbprog_path_move(struct pathmove_command *cmd); static void usbprog_runtest(int num_cycles); static void usbprog_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size); #define UNKOWN_COMMAND 0x00 #define PORT_DIRECTION 0x01 #define PORT_SET 0x02 #define PORT_GET 0x03 #define PORT_SETBIT 0x04 #define PORT_GETBIT 0x05 #define WRITE_TDI 0x06 #define READ_TDO 0x07 #define WRITE_AND_READ 0x08 #define WRITE_TMS 0x09 #define WRITE_TMS_CHAIN 0x0A struct usbprog_jtag { struct usb_dev_handle* usb_handle; }; static struct usbprog_jtag * usbprog_jtag_handle; static struct usbprog_jtag* usbprog_jtag_open(void); //static void usbprog_jtag_close(struct usbprog_jtag *usbprog_jtag); static void usbprog_jtag_init(struct usbprog_jtag *usbprog_jtag); static unsigned char usbprog_jtag_message(struct usbprog_jtag *usbprog_jtag, char *msg, int msglen); static void usbprog_jtag_read_tdo(struct usbprog_jtag *usbprog_jtag, char * buffer, int size); static void usbprog_jtag_write_tdi(struct usbprog_jtag *usbprog_jtag, char * buffer, int size); static void usbprog_jtag_write_and_read(struct usbprog_jtag *usbprog_jtag, char * buffer, int size); static void usbprog_jtag_write_tms(struct usbprog_jtag *usbprog_jtag, char tms_scan); static char tms_chain[64]; static int tms_chain_index; static void usbprog_jtag_tms_collect(char tms_scan); static void usbprog_jtag_tms_send(struct usbprog_jtag *usbprog_jtag); static void usbprog_write(int tck, int tms, int tdi); static void usbprog_reset(int trst, int srst); static void usbprog_jtag_set_direction(struct usbprog_jtag *usbprog_jtag, unsigned char direction); static void usbprog_jtag_write_slice(struct usbprog_jtag *usbprog_jtag,unsigned char value); //static unsigned char usbprog_jtag_get_port(struct usbprog_jtag *usbprog_jtag); static void usbprog_jtag_set_bit(struct usbprog_jtag *usbprog_jtag,int bit, int value); //static int usbprog_jtag_get_bit(struct usbprog_jtag *usbprog_jtag, int bit); static int usbprog_speed(int speed) { return ERROR_OK; } static int usbprog_execute_queue(void) { struct jtag_command *cmd = jtag_command_queue; /* currently processed command */ int scan_size; enum scan_type type; uint8_t *buffer; while (cmd) { switch (cmd->type) { case JTAG_RESET: #ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst); #endif if (cmd->cmd.reset->trst == 1) { tap_set_state(TAP_RESET); } usbprog_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); break; case JTAG_RUNTEST: #ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, cmd->cmd.runtest->end_state); #endif usbprog_end_state(cmd->cmd.runtest->end_state); usbprog_runtest(cmd->cmd.runtest->num_cycles); break; case JTAG_TLR_RESET: #ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("statemove end in %i", cmd->cmd.statemove->end_state); #endif usbprog_end_state(cmd->cmd.statemove->end_state); usbprog_state_move(); break; case JTAG_PATHMOVE: #ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]); #endif usbprog_path_move(cmd->cmd.pathmove); break; case JTAG_SCAN: #ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("scan end in %i", cmd->cmd.scan->end_state); #endif usbprog_end_state(cmd->cmd.scan->end_state); scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer); type = jtag_scan_type(cmd->cmd.scan); usbprog_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size); if (jtag_read_buffer(buffer, cmd->cmd.scan) != ERROR_OK) return ERROR_JTAG_QUEUE_FAILED; if (buffer) free(buffer); break; case JTAG_SLEEP: #ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("sleep %i", cmd->cmd.sleep->us); #endif jtag_sleep(cmd->cmd.sleep->us); break; default: LOG_ERROR("BUG: unknown JTAG command type encountered"); exit(-1); } cmd = cmd->next; } return ERROR_OK; } static int usbprog_init(void) { usbprog_jtag_handle = usbprog_jtag_open(); tms_chain_index = 0; if (usbprog_jtag_handle == 0) { LOG_ERROR("Can't find USB JTAG Interface! Please check connection and permissions."); return ERROR_JTAG_INIT_FAILED; } LOG_INFO("USB JTAG Interface ready!"); usbprog_jtag_init(usbprog_jtag_handle); usbprog_reset(0, 0); usbprog_write(0, 0, 0); return ERROR_OK; } static int usbprog_quit(void) { return ERROR_OK; } /*************** jtag execute commands **********************/ static void usbprog_end_state(tap_state_t state) { if (tap_is_state_stable(state)) tap_set_end_state(state); else { LOG_ERROR("BUG: %i is not a valid end state", state); exit(-1); } } static void usbprog_state_move(void) { int i = 0, tms = 0; uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); usbprog_jtag_write_tms(usbprog_jtag_handle, (char)tms_scan); for (i = 0; i < tms_count; i++) { tms = (tms_scan >> i) & 1; } tap_set_state(tap_get_end_state()); } static void usbprog_path_move(struct pathmove_command *cmd) { int num_states = cmd->num_states; int state_count; /* There may be queued transitions, and before following a specified path, we must flush those queued transitions */ usbprog_jtag_tms_send(usbprog_jtag_handle); state_count = 0; while (num_states) { if (tap_state_transition(tap_get_state(), false) == cmd->path[state_count]) { /* LOG_INFO("1"); */ usbprog_write(0, 0, 0); usbprog_write(1, 0, 0); } else if (tap_state_transition(tap_get_state(), true) == cmd->path[state_count]) { /* LOG_INFO("2"); */ usbprog_write(0, 1, 0); usbprog_write(1, 1, 0); } else { LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_name(tap_get_state()), tap_state_name(cmd->path[state_count])); exit(-1); } tap_set_state(cmd->path[state_count]); state_count++; num_states--; } tap_set_end_state(tap_get_state()); } static void usbprog_runtest(int num_cycles) { int i; /* only do a state_move when we're not already in IDLE */ if (tap_get_state() != TAP_IDLE) { usbprog_end_state(TAP_IDLE); usbprog_state_move(); } /* execute num_cycles */ if (num_cycles > 0) { usbprog_jtag_tms_send(usbprog_jtag_handle); usbprog_write(0, 0, 0); } else { usbprog_jtag_tms_send(usbprog_jtag_handle); /* LOG_INFO("NUM CYCLES %i",num_cycles); */ } for (i = 0; i < num_cycles; i++) { usbprog_write(1, 0, 0); usbprog_write(0, 0, 0); } #ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("runtest: cur_state %s end_state %s", tap_state_name(tap_get_state()), tap_state_name(tap_get_end_state())); #endif /* finish in end_state */ /* usbprog_end_state(saved_end_state); if (tap_get_state() != tap_get_end_state()) usbprog_state_move(); */ } static void usbprog_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size) { tap_state_t saved_end_state = tap_get_end_state(); if (ir_scan) usbprog_end_state(TAP_IRSHIFT); else usbprog_end_state(TAP_DRSHIFT); /* Only move if we're not already there */ if (tap_get_state() != tap_get_end_state()) usbprog_state_move(); usbprog_end_state(saved_end_state); usbprog_jtag_tms_send(usbprog_jtag_handle); void (*f)(struct usbprog_jtag *usbprog_jtag, char * buffer, int size); switch (type) { case SCAN_OUT: f = &usbprog_jtag_write_tdi; break; case SCAN_IN: f = &usbprog_jtag_read_tdo; break; case SCAN_IO: f = &usbprog_jtag_write_and_read; break; default: LOG_ERROR("unknown scan type: %i", type); exit(-1); } f(usbprog_jtag_handle, (char *)buffer, scan_size); /* The adapter does the transition to PAUSE internally */ if (ir_scan) tap_set_state(TAP_IRPAUSE); else tap_set_state(TAP_DRPAUSE); if (tap_get_state() != tap_get_end_state()) usbprog_state_move(); } /*************** jtag wrapper functions *********************/ static void usbprog_write(int tck, int tms, int tdi) { unsigned char output_value = 0x00; if (tms) output_value |= (1 << TMS_BIT); if (tdi) output_value |= (1 << TDI_BIT); if (tck) output_value |= (1 << TCK_BIT); usbprog_jtag_write_slice(usbprog_jtag_handle,output_value); } /* (1) assert or (0) deassert reset lines */ static void usbprog_reset(int trst, int srst) { LOG_DEBUG("trst: %i, srst: %i", trst, srst); if (trst) usbprog_jtag_set_bit(usbprog_jtag_handle, 5, 0); else usbprog_jtag_set_bit(usbprog_jtag_handle, 5, 1); if (srst) usbprog_jtag_set_bit(usbprog_jtag_handle, 4, 0); else usbprog_jtag_set_bit(usbprog_jtag_handle, 4, 1); } /*************** jtag lowlevel functions ********************/ struct usb_bus *busses; struct usbprog_jtag* usbprog_jtag_open(void) { usb_set_debug(10); usb_init(); const uint16_t vids[] = { VID, 0 }; const uint16_t pids[] = { PID, 0 }; struct usb_dev_handle *dev; if (jtag_usb_open(vids, pids, &dev) != ERROR_OK) return NULL; struct usbprog_jtag *tmp = malloc(sizeof(struct usbprog_jtag)); tmp->usb_handle = dev; usb_set_configuration(dev, 1); usb_claim_interface(dev, 0); usb_set_altinterface(dev, 0); return tmp; } #if 0 static void usbprog_jtag_close(struct usbprog_jtag *usbprog_jtag) { usb_close(usbprog_jtag->usb_handle); free(usbprog_jtag); } #endif static unsigned char usbprog_jtag_message(struct usbprog_jtag *usbprog_jtag, char *msg, int msglen) { int res = usb_bulk_write(usbprog_jtag->usb_handle, 3, msg,msglen, 100); if ((msg[0] == 2) || (msg[0] == 1) || (msg[0] == 4) || (msg[0] == 0) || \ (msg[0] == 6) || (msg[0] == 0x0A) || (msg[0] == 9)) return 1; if (res == msglen) { /* LOG_INFO("HALLLLOOO %i",(int)msg[0]); */ res = usb_bulk_read(usbprog_jtag->usb_handle, 0x82, msg, 2, 100); if (res > 0) return (unsigned char)msg[1]; else return -1; } else return -1; return 0; } static void usbprog_jtag_init(struct usbprog_jtag *usbprog_jtag) { usbprog_jtag_set_direction(usbprog_jtag, 0xFE); } static void usbprog_jtag_write_and_read(struct usbprog_jtag *usbprog_jtag, char * buffer, int size) { char tmp[64]; /* fastes packet size for usb controller */ int send_bits, bufindex = 0, fillindex = 0, i, loops; char swap; /* 61 byte can be transfered (488 bit) */ while (size > 0) { if (size > 488) { send_bits = 488; size = size - 488; loops = 61; } else { send_bits = size; loops = size / 8; loops++; size = 0; } tmp[0] = WRITE_AND_READ; tmp[1] = (char)(send_bits >> 8); /* high */ tmp[2] = (char)(send_bits); /* low */ i = 0; for (i = 0; i < loops; i++) { tmp[3 + i] = buffer[bufindex]; bufindex++; } if (usb_bulk_write(usbprog_jtag->usb_handle, 3, tmp, 64, 1000) == 64) { /* LOG_INFO("HALLLLOOO2 %i",(int)tmp[0]); */ usleep(1); int timeout = 0; while (usb_bulk_read(usbprog_jtag->usb_handle, 0x82, tmp, 64, 1000) < 1) { timeout++; if (timeout > 10) break; } for (i = 0; i < loops; i++) { swap = tmp[3 + i]; buffer[fillindex++] = swap; } } } } static void usbprog_jtag_read_tdo(struct usbprog_jtag *usbprog_jtag, char * buffer, int size) { char tmp[64]; /* fastes packet size for usb controller */ int send_bits, fillindex = 0, i, loops; char swap; /* 61 byte can be transfered (488 bit) */ while (size > 0) { if (size > 488) { send_bits = 488; size = size - 488; loops = 61; } else { send_bits = size; loops = size / 8; loops++; size = 0; } tmp[0] = WRITE_AND_READ; tmp[1] = (char)(send_bits >> 8); /* high */ tmp[2] = (char)(send_bits); /* low */ usb_bulk_write(usbprog_jtag->usb_handle, 3, tmp, 3, 1000); /* LOG_INFO("HALLLLOOO3 %i",(int)tmp[0]); */ int timeout = 0; usleep(1); while (usb_bulk_read(usbprog_jtag->usb_handle, 0x82, tmp, 64, 10) < 1) { timeout++; if (timeout > 10) break; } for (i = 0; i < loops; i++) { swap = tmp[3 + i]; buffer[fillindex++] = swap; } } } static void usbprog_jtag_write_tdi(struct usbprog_jtag *usbprog_jtag, char * buffer, int size) { char tmp[64]; /* fastes packet size for usb controller */ int send_bits, bufindex = 0, i, loops; /* 61 byte can be transfered (488 bit) */ while (size > 0) { if (size > 488) { send_bits = 488; size = size - 488; loops = 61; } else { send_bits = size; loops = size/8; /* if (loops == 0) */ loops++; size = 0; } tmp[0] = WRITE_TDI; tmp[1] = (char)(send_bits >> 8); /* high */ tmp[2] = (char)(send_bits); /* low */ i = 0; for (i = 0; i < loops; i++) { tmp[3 + i] = buffer[bufindex]; bufindex++; } usb_bulk_write(usbprog_jtag->usb_handle, 3, tmp, 64, 1000); } } static void usbprog_jtag_write_tms(struct usbprog_jtag *usbprog_jtag, char tms_scan) { usbprog_jtag_tms_collect(tms_scan); } static void usbprog_jtag_set_direction(struct usbprog_jtag *usbprog_jtag, unsigned char direction) { char tmp[2]; tmp[0] = PORT_DIRECTION; tmp[1] = (char)direction; usbprog_jtag_message(usbprog_jtag, tmp, 2); } static void usbprog_jtag_write_slice(struct usbprog_jtag *usbprog_jtag,unsigned char value) { char tmp[2]; tmp[0] = PORT_SET; tmp[1] = (char)value; usbprog_jtag_message(usbprog_jtag, tmp, 2); } #if 0 static unsigned char usbprog_jtag_get_port(struct usbprog_jtag *usbprog_jtag) { char tmp[2]; tmp[0] = PORT_GET; tmp[1] = 0x00; return usbprog_jtag_message(usbprog_jtag, tmp, 2); } #endif static void usbprog_jtag_set_bit(struct usbprog_jtag *usbprog_jtag,int bit, int value) { char tmp[3]; tmp[0] = PORT_SETBIT; tmp[1] = (char)bit; if (value == 1) tmp[2] = 0x01; else tmp[2] = 0x00; usbprog_jtag_message(usbprog_jtag, tmp, 3); } #if 0 static int usbprog_jtag_get_bit(struct usbprog_jtag *usbprog_jtag, int bit) { char tmp[2]; tmp[0] = PORT_GETBIT; tmp[1] = (char)bit; if (usbprog_jtag_message(usbprog_jtag, tmp, 2) > 0) return 1; else return 0; } #endif static void usbprog_jtag_tms_collect(char tms_scan) { tms_chain[tms_chain_index] = tms_scan; tms_chain_index++; } static void usbprog_jtag_tms_send(struct usbprog_jtag *usbprog_jtag) { int i; /* LOG_INFO("TMS SEND"); */ if (tms_chain_index > 0) { char tmp[tms_chain_index + 2]; tmp[0] = WRITE_TMS_CHAIN; tmp[1] = (char)(tms_chain_index); for (i = 0; i < tms_chain_index + 1; i++) tmp[2 + i] = tms_chain[i]; usb_bulk_write(usbprog_jtag->usb_handle, 3, tmp, tms_chain_index + 2, 1000); tms_chain_index = 0; } } struct jtag_interface usbprog_interface = { .name = "usbprog", .execute_queue = usbprog_execute_queue, .speed = usbprog_speed, .init = usbprog_init, .quit = usbprog_quit };
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <string> #include <utility> #include "base/bind.h" #include "base/command_line.h" #include "base/containers/contains.h" #include "base/files/file_util.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_samples.h" #include "base/metrics/statistics_recorder.h" #include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/threading/thread_restrictions.h" #include "build/build_config.h" #include "build/buildflag.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/password_manager/chrome_password_manager_client.h" #include "chrome/browser/password_manager/password_manager_test_base.h" #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" #include "chrome/browser/ui/autofill/chrome_autofill_client.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/login/login_handler.h" #include "chrome/browser/ui/login/login_handler_test_utils.h" #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/test/test_browser_dialog.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/base/ui_test_utils.h" #include "components/autofill/content/browser/content_autofill_driver.h" #include "components/autofill/content/browser/content_autofill_driver_factory.h" #include "components/autofill/content/common/mojom/autofill_driver.mojom-test-utils.h" #include "components/autofill/content/common/mojom/autofill_driver.mojom.h" #include "components/autofill/core/browser/autofill_test_utils.h" #include "components/autofill/core/browser/proto/api_v1.pb.h" #include "components/autofill/core/browser/test_autofill_client.h" #include "components/autofill/core/common/autofill_features.h" #include "components/autofill/core/common/autofill_switches.h" #include "components/autofill/core/common/form_field_data.h" #include "components/autofill/core/common/mojom/autofill_types.mojom-shared.h" #include "components/autofill/core/common/unique_ids.h" #include "components/password_manager/content/browser/content_password_manager_driver.h" #include "components/password_manager/content/browser/content_password_manager_driver_factory.h" #include "components/password_manager/core/browser/form_parsing/password_field_prediction.h" #include "components/password_manager/core/browser/http_auth_manager.h" #include "components/password_manager/core/browser/http_auth_observer.h" #include "components/password_manager/core/browser/password_form.h" #include "components/password_manager/core/browser/password_form_manager.h" #include "components/password_manager/core/browser/password_manager_client.h" #include "components/password_manager/core/browser/password_manager_driver.h" #include "components/password_manager/core/browser/password_store_interface.h" #include "components/password_manager/core/browser/test_password_store.h" #include "components/password_manager/core/common/password_manager_features.h" #include "components/signin/public/base/signin_buildflags.h" #include "components/version_info/version_info.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "content/public/test/back_forward_cache_util.h" #include "content/public/test/browser_test.h" #include "content/public/test/prerender_test_util.h" #include "content/public/test/test_utils.h" #include "net/base/filename_util.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" #include "testing/gmock/include/gmock/gmock.h" #include "third_party/blink/public/common/input/web_input_event.h" #include "third_party/blink/public/common/input/web_keyboard_event.h" #include "ui/events/keycodes/keyboard_codes.h" #include "ui/gfx/geometry/point.h" #if BUILDFLAG(ENABLE_DICE_SUPPORT) #include "chrome/browser/password_manager/password_manager_signin_intercept_test_helper.h" #include "chrome/browser/signin/dice_web_signin_interceptor.h" #include "chrome/browser/signin/identity_manager_factory.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "components/signin/public/identity_manager/primary_account_mutator.h" #endif // ENABLE_DICE_SUPPORT using autofill::ParsingResult; using base::ASCIIToUTF16; using base::Feature; using testing::_; using testing::ElementsAre; using FieldPrediction = autofill::AutofillQueryResponse::FormSuggestion:: FieldSuggestion::FieldPrediction; namespace password_manager { namespace { class PasswordManagerBrowserTest : public PasswordManagerBrowserTestBase { public: PasswordManagerBrowserTest() { // Turn off waiting for server predictions before filing. It makes filling // behaviour more deterministic. Filling with server predictions is tested // in PasswordFormManager unit tests. password_manager::PasswordFormManager:: set_wait_for_server_predictions_for_filling(false); } ~PasswordManagerBrowserTest() override = default; }; // Test class for testing password manager with the BackForwardCache feature // enabled. More info about the BackForwardCache, see: // http://doc/1YrBKX_eFMA9KoYof-eVThT35jcTqWcH_rRxYbR5RapU class PasswordManagerBackForwardCacheBrowserTest : public PasswordManagerBrowserTest { public: void SetUpOnMainThread() override { host_resolver()->AddRule("*", "127.0.0.1"); PasswordManagerBrowserTest ::SetUpOnMainThread(); } bool IsGetCredentialsSuccessful() { return "success" == content::EvalJs(WebContents()->GetMainFrame(), R"( new Promise(resolve => { navigator.credentials.get({password: true, unmediated: true }) .then(m => { resolve("success"); }) .catch(()=> { resolve("error"); }); }); )"); } void SetUpCommandLine(base::CommandLine* command_line) override { scoped_feature_list_.InitWithFeaturesAndParameters( {{::features::kBackForwardCache, {{"TimeToLiveInBackForwardCacheInSeconds", "3600"}, {"ignore_outstanding_network_request_for_testing", "true"}}}}, // Allow BackForwardCache for all devices regardless of their memory. {::features::kBackForwardCacheMemoryControls}); PasswordManagerBrowserTest::SetUpCommandLine(command_line); } private: base::test::ScopedFeatureList scoped_feature_list_; }; class MockHttpAuthObserver : public password_manager::HttpAuthObserver { public: MOCK_METHOD(void, OnAutofillDataAvailable, (const std::u16string& username, const std::u16string& password), (override)); MOCK_METHOD(void, OnLoginModelDestroying, (), (override)); }; GURL GetFileURL(const char* filename) { base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath path; base::PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("password").AppendASCII(filename); CHECK(base::PathExists(path)); return net::FilePathToFileURL(path); } // Handles |request| to "/basic_auth". If "Authorization" header is present, // responds with a non-empty HTTP 200 page (regardless of its value). Otherwise // serves a Basic Auth challenge. std::unique_ptr<net::test_server::HttpResponse> HandleTestAuthRequest( const net::test_server::HttpRequest& request) { if (!base::StartsWith(request.relative_url, "/basic_auth", base::CompareCase::SENSITIVE)) return nullptr; auto http_response = std::make_unique<net::test_server::BasicHttpResponse>(); if (base::Contains(request.headers, "Authorization")) { http_response->set_code(net::HTTP_OK); http_response->set_content("Success!"); } else { http_response->set_code(net::HTTP_UNAUTHORIZED); std::string realm = base::EndsWith(request.relative_url, "/empty_realm", base::CompareCase::SENSITIVE) ? "\"\"" : "\"test realm\""; http_response->AddCustomHeader("WWW-Authenticate", "Basic realm=" + realm); } return http_response; } class ObservingAutofillClient : public autofill::TestAutofillClient, public content::WebContentsUserData<ObservingAutofillClient> { public: ObservingAutofillClient(const ObservingAutofillClient&) = delete; ObservingAutofillClient& operator=(const ObservingAutofillClient&) = delete; // Wait until the autofill popup is shown. void WaitForAutofillPopup() { base::RunLoop run_loop; run_loop_ = &run_loop; run_loop.Run(); DCHECK(!run_loop_); } bool popup_shown() const { return popup_shown_; } void ShowAutofillPopup( const autofill::AutofillClient::PopupOpenArgs& open_args, base::WeakPtr<autofill::AutofillPopupDelegate> delegate) override { if (run_loop_) run_loop_->Quit(); run_loop_ = nullptr; popup_shown_ = true; } private: explicit ObservingAutofillClient(content::WebContents* web_contents) {} friend class content::WebContentsUserData<ObservingAutofillClient>; base::RunLoop* run_loop_ = nullptr; bool popup_shown_ = false; WEB_CONTENTS_USER_DATA_KEY_DECL(); }; WEB_CONTENTS_USER_DATA_KEY_IMPL(ObservingAutofillClient); void TestPromptNotShown(const char* failure_message, content::WebContents* web_contents) { SCOPED_TRACE(testing::Message(failure_message)); NavigationObserver observer(web_contents); std::string fill_and_submit = "document.getElementById('username_failed').value = 'temp';" "document.getElementById('password_failed').value = 'random';" "document.getElementById('failed_form').submit()"; ASSERT_TRUE(content::ExecuteScript(web_contents, fill_and_submit)); observer.Wait(); EXPECT_FALSE(BubbleObserver(web_contents).IsSavePromptShownAutomatically()); } // Generate HTML for a simple password form with the specified action URL. std::string GeneratePasswordFormForAction(const GURL& action_url) { return "<form method='POST' action='" + action_url.spec() + "'" " onsubmit='return true;' id='testform'>" " <input type='password' id='password_field'>" "</form>"; } // Inject an about:blank frame with a password form that uses the specified // action URL into |web_contents|. void InjectBlankFrameWithPasswordForm(content::WebContents* web_contents, const GURL& action_url) { std::string form_html = GeneratePasswordFormForAction(action_url); std::string inject_blank_frame_with_password_form = "var frame = document.createElement('iframe');" "frame.id = 'iframe';" "document.body.appendChild(frame);" "frame.contentDocument.body.innerHTML = \"" + form_html + "\""; ASSERT_TRUE(content::ExecuteScript(web_contents, inject_blank_frame_with_password_form)); } // Inject an iframe with a password form that uses the specified action URL into // |web_contents|. void InjectFrameWithPasswordForm(content::WebContents* web_contents, const GURL& action_url) { std::string form_html = GeneratePasswordFormForAction(action_url); std::string inject_blank_frame_with_password_form = "var ifr = document.createElement('iframe');" "ifr.setAttribute('id', 'iframeResult');" "document.body.appendChild(ifr);" "ifr.contentWindow.document.open();" "ifr.contentWindow.document.write(\"" + form_html + "\");" "ifr.contentWindow.document.close();"; ASSERT_TRUE(content::ExecuteScript(web_contents, inject_blank_frame_with_password_form)); } // Fills in a fake password and submits the form in |frame|, waiting for the // submit navigation to finish. |action_url| is the form action URL to wait // for. void SubmitInjectedPasswordForm(content::WebContents* web_contents, content::RenderFrameHost* frame, const GURL& action_url) { std::string submit_form = "document.getElementById('password_field').value = 'pa55w0rd';" "document.getElementById('testform').submit();"; NavigationObserver observer(web_contents); observer.SetPathToWaitFor(action_url.path()); ASSERT_TRUE(content::ExecuteScript(frame, submit_form)); observer.Wait(); } // Actual tests --------------------------------------------------------------- IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForNormalSubmit) { NavigateToFile("/password/password_form.html"); // Fill a form and submit through a <input type="submit"> button. Nothing // special. NavigationObserver observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); // Save the password and check the store. BubbleObserver bubble_observer(WebContents()); EXPECT_TRUE(bubble_observer.IsSavePromptShownAutomatically()); bubble_observer.AcceptSavePrompt(); WaitForPasswordStore(); CheckThatCredentialsStored("temp", "random"); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptIfFormReappeared) { NavigateToFile("/password/failed.html"); TestPromptNotShown("normal form", WebContents()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptIfChangePasswordFormReappearedEmpty) { NavigateToFile("/password/update_form_empty_fields.html"); // Fill a form and submit through a <input type="submit"> button. Nothing // special. NavigationObserver observer(WebContents()); std::string fill_and_submit = "document.getElementById('password').value = 'old_pass';" "document.getElementById('new_password_1').value = 'new_pass';" "document.getElementById('new_password_2').value = 'new_pass';" "document.getElementById('chg_submit_wo_username_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(BubbleObserver(WebContents()).IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptIfFormReappearedWithPartsHidden) { NavigateToFile("/password/failed_partly_visible.html"); TestPromptNotShown("partly visible form", WebContents()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptIfFormReappearedInputOutsideFor) { NavigateToFile("/password/failed_input_outside.html"); TestPromptNotShown("form with input outside", WebContents()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptAfterCredentialsAPIPasswordStore) { NavigateToFile("/password/password_form.html"); // Simulate the Credential Manager API function store() is called and // PasswordManager instance is notified about that. ChromePasswordManagerClient::FromWebContents(WebContents()) ->NotifyStorePasswordCalled(); // Fill a form and submit through a <input type="submit"> button. The // renderer should not send "PasswordFormsParsed" messages after the page // was loaded. NavigationObserver observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); BubbleObserver prompt_observer(WebContents()); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForSubmitWithSameDocumentNavigation) { NavigateToFile("/password/password_navigate_before_submit.html"); // Fill a form and submit through a <input type="submit"> button. Nothing // special. The form does an in-page navigation before submitting. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, LoginSuccessWithUnrelatedForm) { // Log in, see a form on the landing page. That form is not related to the // login form (=has different input fields), so we should offer saving the // password. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_unrelated').value = 'temp';" "document.getElementById('password_unrelated').value = 'random';" "document.getElementById('submit_unrelated').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, LoginFailed) { NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_failed').value = 'temp';" "document.getElementById('password_failed').value = 'random';" "document.getElementById('submit_failed').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForSubmitUsingJavaScript) { NavigateToFile("/password/password_form.html"); // Fill a form and submit using <button> that calls submit() on the form. // This should work regardless of the type of element, as long as submit() is // called. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForDynamicForm) { // Adding a PSL matching form is a workaround explained later. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; GURL psl_orogin = embedded_test_server()->GetURL("psl.example.com", "/"); signin_form.signon_realm = psl_orogin.spec(); signin_form.url = psl_orogin; signin_form.username_value = u"unused_username"; signin_form.password_value = u"unused_password"; password_store->AddLogin(signin_form); // Show the dynamic form. ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( "example.com", "/password/dynamic_password_form.html"))); ASSERT_TRUE(content::ExecuteScript( WebContents(), "document.getElementById('create_form_button').click();")); // Blink has a timer for 0.3 seconds before it updates the browser with the // new dynamic form. We wait for the form being detected by observing the UI // state. The state changes due to the matching credential saved above. Later // the form submission is definitely noticed by the browser. BubbleObserver(WebContents()).WaitForManagementState(); // Fill the dynamic password form and submit. NavigationObserver observer(WebContents()); std::string fill_and_submit = "document.dynamic_form.username.value = 'tempro';" "document.dynamic_form.password.value = 'random';" "document.dynamic_form.submit()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(BubbleObserver(WebContents()).IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptForNavigation) { NavigateToFile("/password/password_form.html"); // Don't fill the password form, just navigate away. Shouldn't prompt. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture( RenderFrameHost(), "window.location.href = 'done.html';")); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptForSubFrameNavigation) { NavigateToFile("/password/multi_frames.html"); // If you are filling out a password form in one frame and a different frame // navigates, this should not trigger the infobar. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); observer.SetPathToWaitFor("/password/done.html"); std::string fill = "var first_frame = document.getElementById('first_frame');" "var frame_doc = first_frame.contentDocument;" "frame_doc.getElementById('username_field').value = 'temp';" "frame_doc.getElementById('password_field').value = 'random';"; std::string navigate_frame = "var second_iframe = document.getElementById('second_frame');" "second_iframe.contentWindow.location.href = 'done.html';"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill)); ASSERT_TRUE(content::ExecuteScript(WebContents(), navigate_frame)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptForSameFormWithDifferentAction) { // Log in, see a form on the landing page. That form is related to the login // form (has a different action but has same input fields), so we should not // offer saving the password. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_different_action').value = 'temp';" "document.getElementById('password_different_action').value = 'random';" "document.getElementById('submit_different_action').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptForActionMutation) { NavigateToFile("/password/password_form_action_mutation.html"); // Need to pay attention for a message that XHR has finished since there // is no navigation to wait for. content::DOMMessageQueue message_queue; BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_action_mutation').value = 'temp';" "document.getElementById('password_action_mutation').value = 'random';" "document.getElementById('submit_action_mutation').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); std::string message; while (message_queue.WaitForMessage(&message)) { if (message == "\"XHR_FINISHED\"") break; } EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptForFormWithEnteredUsername) { // Log in, see a form on the landing page. That form is not related to the // login form but has the same username as was entered previously, so we // should not offer saving the password. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_contains_username').value = 'temp';" "document.getElementById('password_contains_username').value = 'random';" "document.getElementById('submit_contains_username').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForDifferentFormWithEmptyAction) { // Log in, see a form on the landing page. That form is not related to the // signin form. The signin and the form on the landing page have empty // actions, so we should offer saving the password. NavigateToFile("/password/navigate_to_same_url_empty_actions.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username').value = 'temp';" "document.getElementById('password').value = 'random';" "document.getElementById('submit-button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptAfterSubmitWithSubFrameNavigation) { NavigateToFile("/password/multi_frames.html"); // Make sure that we prompt to save password even if a sub-frame navigation // happens first. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); observer.SetPathToWaitFor("/password/done.html"); std::string navigate_frame = "var second_iframe = document.getElementById('second_frame');" "second_iframe.contentWindow.location.href = 'other.html';"; std::string fill_and_submit = "var first_frame = document.getElementById('first_frame');" "var frame_doc = first_frame.contentDocument;" "frame_doc.getElementById('username_field').value = 'temp';" "frame_doc.getElementById('password_field').value = 'random';" "frame_doc.getElementById('input_submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), navigate_frame)); ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, NoPromptForFailedLoginFromMainFrameWithMultiFramesSameDocument) { NavigateToFile("/password/multi_frames.html"); // Make sure that we don't prompt to save the password for a failed login // from the main frame with multiple frames in the same page. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_failed').value = 'temp';" "document.getElementById('password_failed').value = 'random';" "document.getElementById('submit_failed').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, NoPromptForFailedLoginFromSubFrameWithMultiFramesSameDocument) { NavigateToFile("/password/multi_frames.html"); // Make sure that we don't prompt to save the password for a failed login // from a sub-frame with multiple frames in the same page. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "var first_frame = document.getElementById('first_frame');" "var frame_doc = first_frame.contentDocument;" "frame_doc.getElementById('username_failed').value = 'temp';" "frame_doc.getElementById('password_failed').value = 'random';" "frame_doc.getElementById('submit_failed').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.SetPathToWaitFor("/password/failed.html"); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForXHRSubmit) { NavigateToFile("/password/password_xhr_submit.html"); // Verify that we show the save password prompt if a form returns false // in its onsubmit handler but instead logs in/navigates via XHR. // Note that calling 'submit()' on a form with javascript doesn't call // the onsubmit handler, so we click the submit button instead. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForXHRSubmitWithoutNavigation) { NavigateToFile("/password/password_xhr_submit.html"); // Need to pay attention for a message that XHR has finished since there // is no navigation to wait for. content::DOMMessageQueue message_queue; // Verify that if XHR without navigation occurs and the form has been filled // out we try and save the password. Note that in general the submission // doesn't need to be via form.submit(), but for testing purposes it's // necessary since we otherwise ignore changes made to the value of these // fields by script. BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "navigate = false;" "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); std::string message; while (message_queue.WaitForMessage(&message)) { if (message == "\"XHR_FINISHED\"") break; } EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForXHRSubmitWithoutNavigation_SignupForm) { NavigateToFile("/password/password_xhr_submit.html"); // Need to pay attention for a message that XHR has finished since there // is no navigation to wait for. content::DOMMessageQueue message_queue; // Verify that if XHR without navigation occurs and the form has been filled // out we try and save the password. Note that in general the submission // doesn't need to be via form.submit(), but for testing purposes it's // necessary since we otherwise ignore changes made to the value of these // fields by script. BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "navigate = false;" "document.getElementById('signup_username_field').value = 'temp';" "document.getElementById('signup_password_field').value = 'random';" "document.getElementById('confirmation_password_field').value = 'random';" "document.getElementById('signup_submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); std::string message; while (message_queue.WaitForMessage(&message)) { if (message == "\"XHR_FINISHED\"") break; } EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptForXHRSubmitWithoutNavigationWithUnfilledForm) { NavigateToFile("/password/password_xhr_submit.html"); // Need to pay attention for a message that XHR has finished since there // is no navigation to wait for. content::DOMMessageQueue message_queue; // Verify that if XHR without navigation occurs and the form has NOT been // filled out we don't prompt. BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "navigate = false;" "document.getElementById('username_field').value = 'temp';" "document.getElementById('submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); std::string message; while (message_queue.WaitForMessage(&message)) { if (message == "\"XHR_FINISHED\"") break; } EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, NoPromptForXHRSubmitWithoutNavigationWithUnfilledForm_SignupForm) { NavigateToFile("/password/password_xhr_submit.html"); // Need to pay attention for a message that XHR has finished since there // is no navigation to wait for. content::DOMMessageQueue message_queue; // Verify that if XHR without navigation occurs and the form has NOT been // filled out we don't prompt. BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "navigate = false;" "document.getElementById('signup_username_field').value = 'temp';" "document.getElementById('signup_submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); std::string message; while (message_queue.WaitForMessage(&message)) { if (message == "\"XHR_FINISHED\"") break; } EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForFetchSubmit) { NavigateToFile("/password/password_fetch_submit.html"); // Verify that we show the save password prompt if a form returns false // in its onsubmit handler but instead logs in/navigates via Fetch. // Note that calling 'submit()' on a form with javascript doesn't call // the onsubmit handler, so we click the submit button instead. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForFetchSubmitWithoutNavigation) { NavigateToFile("/password/password_fetch_submit.html"); // Need to pay attention for a message that XHR has finished since there // is no navigation to wait for. content::DOMMessageQueue message_queue; // Verify that if XHR without navigation occurs and the form has been filled // out we try and save the password. Note that in general the submission // doesn't need to be via form.submit(), but for testing purposes it's // necessary since we otherwise ignore changes made to the value of these // fields by script. BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "navigate = false;" "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); std::string message; while (message_queue.WaitForMessage(&message)) { if (message == "\"FETCH_FINISHED\"") break; } EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForFetchSubmitWithoutNavigation_SignupForm) { NavigateToFile("/password/password_fetch_submit.html"); // Need to pay attention for a message that Fetch has finished since there // is no navigation to wait for. content::DOMMessageQueue message_queue; // Verify that if Fetch without navigation occurs and the form has been filled // out we try and save the password. Note that in general the submission // doesn't need to be via form.submit(), but for testing purposes it's // necessary since we otherwise ignore changes made to the value of these // fields by script. BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "navigate = false;" "document.getElementById('signup_username_field').value = 'temp';" "document.getElementById('signup_password_field').value = 'random';" "document.getElementById('confirmation_password_field').value = 'random';" "document.getElementById('signup_submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); std::string message; while (message_queue.WaitForMessage(&message)) { if (message == "\"FETCH_FINISHED\"") break; } EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, NoPromptForFetchSubmitWithoutNavigationWithUnfilledForm) { NavigateToFile("/password/password_fetch_submit.html"); // Need to pay attention for a message that Fetch has finished since there // is no navigation to wait for. content::DOMMessageQueue message_queue; // Verify that if Fetch without navigation occurs and the form has NOT been // filled out we don't prompt. BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "navigate = false;" "document.getElementById('username_field').value = 'temp';" "document.getElementById('submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); std::string message; while (message_queue.WaitForMessage(&message)) { if (message == "\"FETCH_FINISHED\"") break; } EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, NoPromptForFetchSubmitWithoutNavigationWithUnfilledForm_SignupForm) { NavigateToFile("/password/password_fetch_submit.html"); // Need to pay attention for a message that Fetch has finished since there // is no navigation to wait for. content::DOMMessageQueue message_queue; // Verify that if Fetch without navigation occurs and the form has NOT been // filled out we don't prompt. BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "navigate = false;" "document.getElementById('signup_username_field').value = 'temp';" "document.getElementById('signup_submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); std::string message; while (message_queue.WaitForMessage(&message)) { if (message == "\"FETCH_FINISHED\"") break; } EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptIfLinkClicked) { NavigateToFile("/password/password_form.html"); // Verify that if the user takes a direct action to leave the page, we don't // prompt to save the password even if the form is already filled out. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_click_link = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('link').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_click_link)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, VerifyPasswordGenerationUpload) { // Disable Autofill requesting access to AddressBook data. This causes // the test to hang on Mac. autofill::test::DisableSystemServices(browser()->profile()->GetPrefs()); // Visit a signup form. NavigateToFile("/password/signup_form.html"); // Enter a password and save it. NavigationObserver first_observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('other_info').value = 'stuff';" "document.getElementById('username_field').value = 'my_username';" "document.getElementById('password_field').value = 'password';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); first_observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); prompt_observer.AcceptSavePrompt(); // Now navigate to a login form that has similar HTML markup. NavigateToFile("/password/password_form.html"); // Simulate a user click to force an autofill of the form's DOM value, not // just the suggested value. content::SimulateMouseClick(WebContents(), 0, blink::WebMouseEvent::Button::kLeft); WaitForElementValue("username_field", "my_username"); WaitForElementValue("password_field", "password"); // Submit the form and verify that there is no infobar (as the password // has already been saved). NavigationObserver second_observer(WebContents()); BubbleObserver second_prompt_observer(WebContents()); std::string submit_form = "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), submit_form)); second_observer.Wait(); EXPECT_FALSE(second_prompt_observer.IsSavePromptShownAutomatically()); // Verify that we sent two pings to Autofill. One vote for of PASSWORD for // the current form, and one vote for ACCOUNT_CREATION_PASSWORD on the // original form since it has more than 2 text input fields and was used for // the first time on a different form. base::HistogramBase* upload_histogram = base::StatisticsRecorder::FindHistogram( "PasswordGeneration.UploadStarted"); ASSERT_TRUE(upload_histogram); std::unique_ptr<base::HistogramSamples> snapshot = upload_histogram->SnapshotSamples(); EXPECT_EQ(0, snapshot->GetCount(0 /* failure */)); EXPECT_EQ(2, snapshot->GetCount(1 /* success */)); autofill::test::ReenableSystemServices(); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForSubmitFromIframe) { NavigateToFile("/password/password_submit_from_iframe.html"); // Submit a form in an iframe, then cause the whole page to navigate without a // user gesture. We expect the save password prompt to be shown here, because // some pages use such iframes for login forms. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "var iframe = document.getElementById('test_iframe');" "var iframe_doc = iframe.contentDocument;" "iframe_doc.getElementById('username_field').value = 'temp';" "iframe_doc.getElementById('password_field').value = 'random';" "iframe_doc.getElementById('submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForInputElementWithoutName) { // Check that the prompt is shown for forms where input elements lack the // "name" attribute but the "id" is present. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field_no_name').value = 'temp';" "document.getElementById('password_field_no_name').value = 'random';" "document.getElementById('input_submit_button_no_name').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForInputElementWithoutId) { // Check that the prompt is shown for forms where input elements lack the // "id" attribute but the "name" attribute is present. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementsByName('username_field_no_id')[0].value = 'temp';" "document.getElementsByName('password_field_no_id')[0].value = 'random';" "document.getElementsByName('input_submit_button_no_id')[0].click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForInputElementWithoutIdAndName) { // Check that prompt is shown for forms where the input fields lack both // the "id" and the "name" attributes. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "var form = document.getElementById('testform_elements_no_id_no_name');" "var username = form.children[0];" "username.value = 'temp';" "var password = form.children[1];" "password.value = 'random';" "form.children[2].click()"; // form.children[2] is the submit button. ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); prompt_observer.AcceptSavePrompt(); // Check that credentials are stored. WaitForPasswordStore(); CheckThatCredentialsStored("temp", "random"); } // Test for checking that no prompt is shown for URLs with file: scheme. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptForFileSchemeURLs) { GURL url = GetFileURL("password_form.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptForLandingPageWithHTTPErrorStatusCode) { // Check that no prompt is shown for forms where the landing page has // HTTP status 404. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field_http_error').value = 'temp';" "document.getElementById('password_field_http_error').value = 'random';" "document.getElementById('input_submit_button_http_error').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, DeleteFrameBeforeSubmit) { NavigateToFile("/password/multi_frames.html"); NavigationObserver observer(WebContents()); // Make sure we save some password info from an iframe and then destroy it. std::string save_and_remove = "var first_frame = document.getElementById('first_frame');" "var frame_doc = first_frame.contentDocument;" "frame_doc.getElementById('username_field').value = 'temp';" "frame_doc.getElementById('password_field').value = 'random';" "frame_doc.getElementById('input_submit_button').click();" "first_frame.parentNode.removeChild(first_frame);"; // Submit from the main frame, but without navigating through the onsubmit // handler. std::string navigate_frame = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click();" "window.location.href = 'done.html';"; ASSERT_TRUE(content::ExecuteScript(WebContents(), save_and_remove)); ASSERT_TRUE(content::ExecuteScript(WebContents(), navigate_frame)); observer.Wait(); // The only thing we check here is that there is no use-after-free reported. } // Get form data for /password/nonplaceholder_username.html autofill::FormData GetPlaceholderUsernameFormData( password_manager::PasswordForm signin_form) { // Build server predictions autofill::FormData form_data; constexpr autofill::FormRendererId form_id(1); form_data.unique_renderer_id = form_id; form_data.name_attribute = u"testform"; form_data.name = form_data.name_attribute; form_data.action = GURL(signin_form.action.spec() + "password/done.html"); form_data.url = signin_form.url; // Username autofill::FormFieldData username_field; username_field.form_control_type = "text"; username_field.id_attribute = u"username_field"; username_field.name = username_field.id_attribute; username_field.value = u"example@example.com"; username_field.label = username_field.value; username_field.unique_renderer_id = autofill::FieldRendererId(1); form_data.fields.push_back(username_field); // Password autofill::FormFieldData password_field; password_field.form_control_type = "password"; password_field.id_attribute = u"password_field"; password_field.name = password_field.id_attribute; password_field.value = u"htmlPass"; password_field.label = password_field.value; password_field.unique_renderer_id = autofill::FieldRendererId(2); form_data.fields.push_back(password_field); return form_data; } // If there is a username and password with prefilled values, do not overwrite // the password if the username does not look like a placeholder value IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NonPlaceholderPasswordNotOverwritten) { // Save a credential to the password store. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.url = embedded_test_server()->base_url(); signin_form.action = embedded_test_server()->base_url(); signin_form.username_value = u"example@example.com"; signin_form.password_value = u"savedPass"; password_store->AddLogin(signin_form); password_manager::PasswordFormManager:: set_wait_for_server_predictions_for_filling(true); // Get form data autofill::FormData form_data = GetPlaceholderUsernameFormData(signin_form); // Username bool is_placeholder = false; autofill::FormStructure form_structure(form_data); std::vector<FieldPrediction> username_predictions; FieldPrediction username_prediction; username_prediction.set_type(autofill::USERNAME); username_predictions.push_back(username_prediction); form_structure.field(0)->set_server_predictions(username_predictions); form_structure.field(0)->set_may_use_prefilled_placeholder(is_placeholder); // Password std::vector<FieldPrediction> password_predictions; FieldPrediction password_prediction; password_prediction.set_type(autofill::PASSWORD); password_predictions.push_back(password_prediction); form_structure.field(1)->set_server_predictions(password_predictions); // Navigate to the page NavigateToFile("/password/nonplaceholder_username.html"); // Use autofill predictions autofill::ChromeAutofillClient* autofill_client = autofill::ChromeAutofillClient::FromWebContents(WebContents()); autofill_client->PropagateAutofillPredictions(WebContents()->GetMainFrame(), {&form_structure}); // Check original values before interaction CheckElementValue("username_field", "example@example.com"); CheckElementValue("password_field", "htmlPass"); // Have user interact with the page content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); // Now make sure the fields aren't overwritten CheckElementValue("username_field", "example@example.com"); CheckElementValue("password_field", "htmlPass"); } // If there is a username and password with prefilled values, overwrite the // password if the username looks like a placeholder value IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PlaceholderPasswordOverwritten) { // Save a credential to the password store. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.url = embedded_test_server()->base_url(); signin_form.action = embedded_test_server()->base_url(); signin_form.username_value = u"example@example.com"; signin_form.password_value = u"savedPass"; password_store->AddLogin(signin_form); password_manager::PasswordFormManager:: set_wait_for_server_predictions_for_filling(true); // Get form data autofill::FormData form_data = GetPlaceholderUsernameFormData(signin_form); // Username bool is_placeholder = true; autofill::FormStructure form_structure(form_data); std::vector<FieldPrediction> username_predictions; FieldPrediction username_prediction; username_prediction.set_type(autofill::USERNAME); username_predictions.push_back(username_prediction); form_structure.field(0)->set_server_predictions(username_predictions); form_structure.field(0)->set_may_use_prefilled_placeholder(is_placeholder); // Password std::vector<FieldPrediction> password_predictions; FieldPrediction password_prediction; password_prediction.set_type(autofill::PASSWORD); password_predictions.push_back(password_prediction); form_structure.field(1)->set_server_predictions(password_predictions); // Navigate to the page NavigateToFile("/password/nonplaceholder_username.html"); // Use autofill predictions autofill::ChromeAutofillClient* autofill_client = autofill::ChromeAutofillClient::FromWebContents(WebContents()); autofill_client->PropagateAutofillPredictions(WebContents()->GetMainFrame(), {&form_structure}); // Check original values before interaction CheckElementValue("username_field", "example@example.com"); CheckElementValue("password_field", "htmlPass"); // Have user interact with the page content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); // Now make sure the fields are overwritten CheckElementValue("username_field", "example@example.com"); WaitForElementValue("password_field", "savedPass"); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, UsernameAndPasswordValueAccessible) { // At first let us save a credential to the password store. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.url = embedded_test_server()->base_url(); signin_form.action = embedded_test_server()->base_url(); signin_form.username_value = u"admin"; signin_form.password_value = u"12345"; password_store->AddLogin(signin_form); // Steps from https://crbug.com/337429#c37. // Navigate to the page, click a link that opens a second tab, reload the // first tab and observe that the password is accessible. NavigateToFile("/password/form_and_link.html"); // Click on a link to open a new tab, then switch back to the first one. EXPECT_EQ(1, browser()->tab_strip_model()->count()); std::string click = "document.getElementById('testlink').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), click)); EXPECT_EQ(2, browser()->tab_strip_model()->count()); browser()->tab_strip_model()->ActivateTabAt(0); // Reload the original page to have the saved credentials autofilled. NavigationObserver reload_observer(WebContents()); NavigateToFile("/password/form_and_link.html"); reload_observer.Wait(); // Now check that the username and the password are not accessible yet. CheckElementValue("username_field", ""); CheckElementValue("password_field", ""); // Let the user interact with the page. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); // Wait until that interaction causes the username and the password value to // be revealed. WaitForElementValue("username_field", "admin"); WaitForElementValue("password_field", "12345"); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PasswordValueAccessibleOnSubmit) { // At first let us save a credential to the password store. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.url = embedded_test_server()->base_url(); signin_form.action = embedded_test_server()->base_url(); signin_form.username_value = u"admin"; signin_form.password_value = u"random_secret"; password_store->AddLogin(signin_form); NavigateToFile("/password/form_and_link.html"); NavigationObserver submit_observer(WebContents()); // Submit the form via a tap on the submit button. content::SimulateMouseClickOrTapElementWithId(WebContents(), "input_submit_button"); submit_observer.Wait(); std::string query = WebContents()->GetURL().query(); EXPECT_THAT(query, testing::HasSubstr("random_secret")); } // Test fix for crbug.com/338650. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, DontPromptForPasswordFormWithDefaultValue) { NavigateToFile("/password/password_form_with_default_value.html"); // Don't prompt if we navigate away even if there is a password value since // it's not coming from the user. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); NavigateToFile("/password/done.html"); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, DontPromptForPasswordFormWithReadonlyPasswordField) { NavigateToFile("/password/password_form_with_password_readonly.html"); // Fill a form and submit through a <input type="submit"> button. Nothing // special. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptWhenEnableAutomaticPasswordSavingSwitchIsNotSet) { NavigateToFile("/password/password_form.html"); // Fill a form and submit through a <input type="submit"> button. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } // Test fix for crbug.com/368690. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptWhenReloading) { NavigateToFile("/password/password_form.html"); std::string fill = "document.getElementById('username_redirect').value = 'temp';" "document.getElementById('password_redirect').value = 'random';"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill)); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); GURL url = embedded_test_server()->GetURL("/password/password_form.html"); NavigateParams params(browser(), url, ::ui::PAGE_TRANSITION_RELOAD); ui_test_utils::NavigateToURL(&params); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } // Test that if a form gets dynamically added between the form parsing and // rendering, and while the main frame still loads, it still is registered, and // thus saving passwords from it works. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, FormsAddedBetweenParsingAndRendering) { NavigateToFile("/password/between_parsing_and_rendering.html"); NavigationObserver observer(WebContents()); std::string submit = "document.getElementById('username').value = 'temp';" "document.getElementById('password').value = 'random';" "document.getElementById('submit-button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), submit)); observer.Wait(); EXPECT_TRUE(BubbleObserver(WebContents()).IsSavePromptShownAutomatically()); } // Test that if a hidden form gets dynamically added between the form parsing // and rendering, it still is registered, and autofilling works. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, HiddenFormAddedBetweenParsingAndRendering) { // At first let us save a credential to the password store. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.url = embedded_test_server()->base_url(); signin_form.action = embedded_test_server()->base_url(); signin_form.username_value = u"admin"; signin_form.password_value = u"12345"; password_store->AddLogin(signin_form); NavigateToFile("/password/between_parsing_and_rendering.html?hidden"); std::string show_form = "document.getElementsByTagName('form')[0].style.display = 'block'"; ASSERT_TRUE(content::ExecuteScript(WebContents(), show_form)); // Wait until the username is filled, to make sure autofill kicked in. WaitForElementValue("username", "admin"); WaitForElementValue("password", "12345"); } // https://crbug.com/713645 // Navigate to a page that can't load some of the subresources. Create a hidden // form when the body is loaded. Make the form visible. Chrome should autofill // the form. // The fact that the form is hidden isn't super important but reproduces the // actual bug. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, SlowPageFill) { // At first let us save a credential to the password store. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.url = embedded_test_server()->base_url(); signin_form.action = embedded_test_server()->base_url(); signin_form.username_value = u"admin"; signin_form.password_value = u"12345"; password_store->AddLogin(signin_form); GURL url = embedded_test_server()->GetURL("/password/infinite_password_form.html"); ui_test_utils::NavigateToURLWithDisposition( browser(), url, WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); // Wait for autofill. BubbleObserver bubble_observer(WebContents()); bubble_observer.WaitForManagementState(); // Show the form and make sure that the password was autofilled. std::string show_form = "document.getElementsByTagName('form')[0].style.display = 'block'"; ASSERT_TRUE(content::ExecuteScript(WebContents(), show_form)); CheckElementValue("username", "admin"); CheckElementValue("password", "12345"); } // Test that if there was no previous page load then the PasswordManagerDriver // does not think that there were SSL errors on the current page. The test opens // a new tab with a URL for which the embedded test server issues a basic auth // challenge. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoLastLoadGoodLastLoad) { // We must use a new test server here because embedded_test_server() is // already started at this point and adding the request handler to it would // not be thread safe. net::EmbeddedTestServer http_test_server; // Teach the embedded server to handle requests by issuing the basic auth // challenge. http_test_server.RegisterRequestHandler( base::BindRepeating(&HandleTestAuthRequest)); ASSERT_TRUE(http_test_server.Start()); LoginPromptBrowserTestObserver login_observer; // We need to register to all sources, because the navigation observer we are // interested in is for a new tab to be opened, and thus does not exist yet. login_observer.Register(content::NotificationService::AllSources()); password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get()); ASSERT_TRUE(password_store->IsEmpty()); content::NavigationController* nav_controller = &WebContents()->GetController(); WindowedAuthNeededObserver auth_needed_observer(nav_controller); // Navigate to a page requiring HTTP auth. ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), http_test_server.GetURL("/basic_auth"))); auth_needed_observer.Wait(); WindowedAuthSuppliedObserver auth_supplied_observer(nav_controller); // Offer valid credentials on the auth challenge. ASSERT_EQ(1u, login_observer.handlers().size()); LoginHandler* handler = *login_observer.handlers().begin(); ASSERT_TRUE(handler); NavigationObserver nav_observer(WebContents()); // Any username/password will work. handler->SetAuth(u"user", u"pwd"); auth_supplied_observer.Wait(); // The password manager should be working correctly. nav_observer.Wait(); WaitForPasswordStore(); BubbleObserver bubble_observer(WebContents()); EXPECT_TRUE(bubble_observer.IsSavePromptShownAutomatically()); bubble_observer.AcceptSavePrompt(); // Spin the message loop to make sure the password store had a chance to save // the password. WaitForPasswordStore(); EXPECT_FALSE(password_store->IsEmpty()); } // Fill out a form and click a button. The Javascript removes the form, creates // a similar one with another action, fills it out and submits. Chrome can // manage to detect the new one and create a complete matching // PasswordFormManager. Otherwise, the all-but-action matching PFM should be // used. Regardless of the internals the user sees the bubble in 100% cases. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PreferPasswordFormManagerWhichFinishedMatching) { NavigateToFile("/password/create_form_copy_on_submit.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string submit = "document.getElementById('username').value = 'overwrite_me';" "document.getElementById('password').value = 'random';" "document.getElementById('non-form-button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), submit)); observer.Wait(); WaitForPasswordStore(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } // Tests whether a attempted submission of a malicious credentials gets blocked. // This simulates a case which is described in http://crbug.com/571580. IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, NoPromptForSeparateLoginFormWhenSwitchingFromHttpsToHttp) { std::string path = "/password/password_form.html"; GURL https_url(https_test_server().GetURL(path)); ASSERT_TRUE(https_url.SchemeIs(url::kHttpsScheme)); NavigationObserver form_observer(WebContents()); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), https_url)); form_observer.Wait(); std::string fill_and_submit_redirect = "document.getElementById('username_redirect').value = 'user';" "document.getElementById('password_redirect').value = 'password';" "document.getElementById('submit_redirect').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit_redirect)); NavigationObserver redirect_observer(WebContents()); redirect_observer.SetPathToWaitFor("/password/redirect.html"); redirect_observer.Wait(); BubbleObserver prompt_observer(WebContents()); prompt_observer.WaitForAutomaticSavePrompt(); // Normally the redirect happens to done.html. Here an attack is simulated // that hijacks the redirect to a attacker controlled page. GURL http_url( embedded_test_server()->GetURL("/password/simple_password.html")); std::string attacker_redirect = "window.location.href = '" + http_url.spec() + "';"; ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture(RenderFrameHost(), attacker_redirect)); NavigationObserver attacker_observer(WebContents()); attacker_observer.SetPathToWaitFor("/password/simple_password.html"); attacker_observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); std::string fill_and_submit_attacker_form = "document.getElementById('username_field').value = 'attacker_username';" "document.getElementById('password_field').value = 'attacker_password';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE( content::ExecuteScript(WebContents(), fill_and_submit_attacker_form)); NavigationObserver done_observer(WebContents()); done_observer.SetPathToWaitFor("/password/done.html"); done_observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); prompt_observer.AcceptSavePrompt(); // Wait for password store and check that credentials are stored. WaitForPasswordStore(); CheckThatCredentialsStored("user", "password"); } // Tests that after HTTP -> HTTPS migration the credential is autofilled. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, HttpMigratedCredentialAutofilled) { // Add an http credential to the password store. GURL https_origin = https_test_server().base_url(); ASSERT_TRUE(https_origin.SchemeIs(url::kHttpsScheme)); GURL::Replacements rep; rep.SetSchemeStr(url::kHttpScheme); GURL http_origin = https_origin.ReplaceComponents(rep); password_manager::PasswordForm http_form; http_form.signon_realm = http_origin.spec(); http_form.url = http_origin; // Assume that the previous action was already HTTPS one matching the current // page. http_form.action = https_origin; http_form.username_value = u"user"; http_form.password_value = u"12345"; password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_store->AddLogin(http_form); NavigationObserver form_observer(WebContents()); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), https_test_server().GetURL("/password/password_form.html"))); form_observer.Wait(); WaitForPasswordStore(); // Let the user interact with the page, so that DOM gets modification events, // needed for autofilling fields. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); WaitForElementValue("username_field", "user"); WaitForElementValue("password_field", "12345"); } // Tests that obsolete HTTP credentials are moved when a site migrated to HTTPS // and has HSTS enabled. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ObsoleteHttpCredentialMovedOnMigrationToHstsSite) { // Add an http credential to the password store. GURL https_origin = https_test_server().base_url(); ASSERT_TRUE(https_origin.SchemeIs(url::kHttpsScheme)); GURL::Replacements rep; rep.SetSchemeStr(url::kHttpScheme); GURL http_origin = https_origin.ReplaceComponents(rep); password_manager::PasswordForm http_form; http_form.signon_realm = http_origin.spec(); http_form.url = http_origin; http_form.username_value = u"user"; http_form.password_value = u"12345"; password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get()); password_store->AddLogin(http_form); // Treat the host of the HTTPS test server as HSTS. AddHSTSHost(https_test_server().host_port_pair().host()); // Navigate to HTTPS page and trigger the migration. NavigationObserver form_observer(WebContents()); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), https_test_server().GetURL("/password/password_form.html"))); form_observer.Wait(); // Issue the query for HTTPS credentials. WaitForPasswordStore(); // Realize there are no HTTPS credentials and issue the query for HTTP // credentials instead. WaitForPasswordStore(); // Sync with IO thread before continuing. This is necessary, because the // credential migration triggers a query for the HSTS state which gets // executed on the IO thread. The actual task is empty, because only the reply // is relevant. By the time the reply is executed it is guaranteed that the // migration is completed. base::RunLoop run_loop; content::GetIOThreadTaskRunner({})->PostTaskAndReply( FROM_HERE, base::BindOnce([]() {}), run_loop.QuitClosure()); run_loop.Run(); // Migration updates should touch the password store. WaitForPasswordStore(); // Only HTTPS passwords should be present. EXPECT_TRUE( password_store->stored_passwords().at(http_origin.spec()).empty()); EXPECT_FALSE( password_store->stored_passwords().at(https_origin.spec()).empty()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptWhenPasswordFormWithoutUsernameFieldSubmitted) { password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get()); EXPECT_TRUE(password_store->IsEmpty()); NavigateToFile("/password/form_with_only_password_field.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string submit = "document.getElementById('password').value = 'password';" "document.getElementById('submit-button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); prompt_observer.AcceptSavePrompt(); WaitForPasswordStore(); EXPECT_FALSE(password_store->IsEmpty()); } // Test that if a form gets autofilled, then it gets autofilled on re-creation // as well. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ReCreatedFormsGetFilled) { // At first let us save a credential to the password store. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.url = embedded_test_server()->base_url(); signin_form.action = embedded_test_server()->base_url(); signin_form.username_value = u"temp"; signin_form.password_value = u"random"; password_store->AddLogin(signin_form); NavigateToFile("/password/dynamic_password_form.html"); const std::string create_form = "document.getElementById('create_form_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), create_form)); // Wait until the username is filled, to make sure autofill kicked in. WaitForElementValue("username_id", "temp"); // Now the form gets deleted and created again. It should get autofilled // again. const std::string delete_form = "var form = document.getElementById('dynamic_form_id');" "form.parentNode.removeChild(form);"; ASSERT_TRUE(content::ExecuteScript(WebContents(), delete_form)); ASSERT_TRUE(content::ExecuteScript(WebContents(), create_form)); WaitForElementValue("username_id", "temp"); } // Test that if the same dynamic form is created multiple times then all of them // are autofilled. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, DuplicateFormsGetFilled) { // At first let us save a credential to the password store. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.url = embedded_test_server()->base_url(); signin_form.action = embedded_test_server()->base_url(); signin_form.username_value = u"temp"; signin_form.password_value = u"random"; password_store->AddLogin(signin_form); NavigateToFile("/password/recurring_dynamic_form.html"); ASSERT_TRUE(content::ExecuteScript(WebContents(), "addForm();")); // Wait until the username is filled, to make sure autofill kicked in. WaitForJsElementValue("document.body.children[0].children[0]", "temp"); WaitForJsElementValue("document.body.children[0].children[1]", "random"); // Add one more form. ASSERT_TRUE(content::ExecuteScript(WebContents(), "addForm();")); // Wait until the username is filled, to make sure autofill kicked in. WaitForJsElementValue("document.body.children[1].children[0]", "temp"); WaitForJsElementValue("document.body.children[1].children[1]", "random"); } // Test that an autofilled credential is deleted then the password manager // doesn't try to resurrect it on navigation. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, DeletedPasswordIsNotRevived) { // At first let us save a credential to the password store. password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get()); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.url = embedded_test_server()->base_url(); signin_form.action = embedded_test_server()->base_url(); signin_form.username_value = u"admin"; signin_form.password_value = u"1234"; password_store->AddLogin(signin_form); NavigateToFile("/password/password_form.html"); // Let the user interact with the page. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); // Wait until that interaction causes the username and the password value to // be revealed. WaitForElementValue("username_field", "admin"); // Now the credential is removed via the settings or the bubble. password_store->RemoveLogin(signin_form); WaitForPasswordStore(); // Submit the form. It shouldn't revive the credential in the store. NavigationObserver observer(WebContents()); ASSERT_TRUE(content::ExecuteScript( WebContents(), "document.getElementById('input_submit_button').click()")); observer.Wait(); WaitForPasswordStore(); EXPECT_TRUE(password_store->IsEmpty()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForPushStateWhenFormDisappears) { NavigateToFile("/password/password_push_state.html"); // Verify that we show the save password prompt if 'history.pushState()' // is called after form submission is suppressed by, for example, calling // preventDefault() in a form's submit event handler. // Note that calling 'submit()' on a form with javascript doesn't call // the onsubmit handler, so we click the submit button instead. // Also note that the prompt will only show up if the form disappers // after submission NavigationObserver observer(WebContents()); observer.set_quit_on_entry_committed(true); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } // Similar to the case above, but this time the form persists after // 'history.pushState()'. And save password prompt should not show up // in this case. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptForPushStateWhenFormPersists) { NavigateToFile("/password/password_push_state.html"); // Set |should_delete_testform| to false to keep submitted form visible after // history.pushsTate(); NavigationObserver observer(WebContents()); observer.set_quit_on_entry_committed(true); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "should_delete_testform = false;" "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } // The password manager should distinguish forms with empty actions. After // successful login, the login form disappears, but the another one shouldn't be // recognized as the login form. The save prompt should appear. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForPushStateWhenFormWithEmptyActionDisappears) { NavigateToFile("/password/password_push_state.html"); NavigationObserver observer(WebContents()); observer.set_quit_on_entry_committed(true); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('ea_username_field').value = 'temp';" "document.getElementById('ea_password_field').value = 'random';" "document.getElementById('ea_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } // Similar to the case above, but this time the form persists after // 'history.pushState()'. The password manager should find the login form even // if the action of the form is empty. Save password prompt should not show up. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForPushStateWhenFormWithEmptyActionPersists) { NavigateToFile("/password/password_push_state.html"); NavigationObserver observer(WebContents()); observer.set_quit_on_entry_committed(true); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "should_delete_testform = false;" "document.getElementById('ea_username_field').value = 'temp';" "document.getElementById('ea_password_field').value = 'random';" "document.getElementById('ea_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } // Current and target URLs contain different parameters and references. This // test checks that parameters and references in origins are ignored for // form origin comparison. IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, PromptForPushStateWhenFormDisappears_ParametersInOrigins) { NavigateToFile("/password/password_push_state.html?login#r"); NavigationObserver observer(WebContents()); observer.set_quit_on_entry_committed(true); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "add_parameters_to_target_url = true;" "document.getElementById('pa_username_field').value = 'temp';" "document.getElementById('pa_password_field').value = 'random';" "document.getElementById('pa_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } // Similar to the case above, but this time the form persists after // 'history.pushState()'. The password manager should find the login form even // if target and current URLs contain different parameters or references. // Save password prompt should not show up. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForPushStateWhenFormPersists_ParametersInOrigins) { NavigateToFile("/password/password_push_state.html?login#r"); NavigationObserver observer(WebContents()); observer.set_quit_on_entry_committed(true); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "should_delete_testform = false;" "add_parameters_to_target_url = true;" "document.getElementById('pa_username_field').value = 'temp';" "document.getElementById('pa_password_field').value = 'random';" "document.getElementById('pa_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, InFrameNavigationDoesNotClearPopupState) { password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.username_value = u"temp"; signin_form.password_value = u"random123"; password_store->AddLogin(signin_form); NavigateToFile("/password/password_form.html"); // Mock out the AutofillClient so we know how long to wait. Unfortunately // there isn't otherwise a good event to wait on to verify that the popup // would have been shown. password_manager::ContentPasswordManagerDriverFactory* driver_factory = password_manager::ContentPasswordManagerDriverFactory::FromWebContents( WebContents()); ObservingAutofillClient::CreateForWebContents(WebContents()); ObservingAutofillClient* observing_autofill_client = ObservingAutofillClient::FromWebContents(WebContents()); password_manager::ContentPasswordManagerDriver* driver = driver_factory->GetDriverForFrame(WebContents()->GetMainFrame()); driver->GetPasswordAutofillManager()->set_autofill_client( observing_autofill_client); // Trigger in page navigation. std::string in_page_navigate = "location.hash = '#blah';"; ASSERT_TRUE(content::ExecJs(RenderFrameHost(), in_page_navigate, content::EXECUTE_SCRIPT_NO_USER_GESTURE)); // Click on the username field to display the popup. content::SimulateMouseClickOrTapElementWithId(WebContents(), "username_field"); // Make sure the popup would be shown. observing_autofill_client->WaitForAutofillPopup(); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ChangePwdFormBubbleShown) { NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('chg_username_field').value = 'temp';" "document.getElementById('chg_password_field').value = 'random';" "document.getElementById('chg_new_password_1').value = 'random1';" "document.getElementById('chg_new_password_2').value = 'random1';" "document.getElementById('chg_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ChangePwdFormPushStateBubbleShown) { NavigateToFile("/password/password_push_state.html"); NavigationObserver observer(WebContents()); observer.set_quit_on_entry_committed(true); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('chg_username_field').value = 'temp';" "document.getElementById('chg_password_field').value = 'random';" "document.getElementById('chg_new_password_1').value = 'random1';" "document.getElementById('chg_new_password_2').value = 'random1';" "document.getElementById('chg_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptOnBack) { // Go to a successful landing page through submitting first, so that it is // reachable through going back, and the remembered page transition is form // submit. There is no need to submit non-empty strings. NavigateToFile("/password/password_form.html"); NavigationObserver dummy_submit_observer(WebContents()); std::string just_submit = "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), just_submit)); dummy_submit_observer.Wait(); // Now go to a page with a form again, fill the form, and go back instead of // submitting it. NavigateToFile("/password/dummy_submit.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); // The (dummy) submit is necessary to provisionally save the typed password. // A user typing in the password field would not need to submit to // provisionally save it, but the script cannot trigger that just by // assigning to the field's value. std::string fill_and_back = "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click();" "window.history.back();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_back)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } // Regression test for http://crbug.com/452306 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ChangingTextToPasswordFieldOnSignupForm) { NavigateToFile("/password/signup_form.html"); // In this case, pretend that username_field is actually a password field // that starts as a text field to simulate placeholder. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string change_and_submit = "document.getElementById('other_info').value = 'username';" "document.getElementById('username_field').type = 'password';" "document.getElementById('username_field').value = 'mypass';" "document.getElementById('password_field').value = 'mypass';" "document.getElementById('testform').submit();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), change_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } // Regression test for http://crbug.com/451631 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, SavingOnManyPasswordFieldsTest) { // Simulate Macy's registration page, which contains the normal 2 password // fields for confirming the new password plus 2 more fields for security // questions and credit card. Make sure that saving works correctly for such // sites. NavigateToFile("/password/many_password_signup_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'username';" "document.getElementById('password_field').value = 'mypass';" "document.getElementById('confirm_field').value = 'mypass';" "document.getElementById('security_answer').value = 'hometown';" "document.getElementById('SSN').value = '1234';" "document.getElementById('testform').submit();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, SaveWhenIFrameDestroyedOnFormSubmit) { NavigateToFile("/password/frame_detached_on_submit.html"); // Need to pay attention for a message that XHR has finished since there // is no navigation to wait for. content::DOMMessageQueue message_queue; BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "var iframe = document.getElementById('login_iframe');" "var frame_doc = iframe.contentDocument;" "frame_doc.getElementById('username_field').value = 'temp';" "frame_doc.getElementById('password_field').value = 'random';" "frame_doc.getElementById('submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); std::string message; while (message_queue.WaitForMessage(&message)) { if (message == "\"SUBMISSION_FINISHED\"") break; } EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } // Check that a username and password are filled into forms in iframes // that don't share the security origin with the main frame, but have PSL // matched origins. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PSLMatchedCrossSiteFillTest) { GURL main_frame_url = embedded_test_server()->GetURL( "www.foo.com", "/password/password_form_in_crosssite_iframe.html"); NavigationObserver observer(WebContents()); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_frame_url)); observer.Wait(); // Create an iframe and navigate cross-site. NavigationObserver iframe_observer(WebContents()); iframe_observer.SetPathToWaitFor("/password/crossite_iframe_content.html"); GURL iframe_url = embedded_test_server()->GetURL( "abc.foo.com", "/password/crossite_iframe_content.html"); std::string create_iframe = base::StringPrintf("create_iframe('%s');", iframe_url.spec().c_str()); ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture(RenderFrameHost(), create_iframe)); iframe_observer.Wait(); // Store a password for autofill later. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = iframe_url.DeprecatedGetOriginAsURL().spec(); signin_form.url = iframe_url; signin_form.username_value = u"temp"; signin_form.password_value = u"pa55w0rd"; password_store->AddLogin(signin_form); WaitForPasswordStore(); // Visit the form again. NavigationObserver reload_observer(WebContents()); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_frame_url)); reload_observer.Wait(); NavigationObserver iframe_observer_2(WebContents()); iframe_observer_2.SetPathToWaitFor("/password/crossite_iframe_content.html"); ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture(RenderFrameHost(), create_iframe)); iframe_observer_2.Wait(); // Simulate the user interaction in the iframe which should trigger autofill. // Click in the middle of the frame to avoid the border. content::SimulateMouseClickOrTapElementWithId(WebContents(), "iframe"); std::string username_field; std::string password_field; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), "sendMessage('get_username');", &username_field)); ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), "sendMessage('get_password');", &password_field)); // Verify username and password have not been autofilled due to an insecure // origin. EXPECT_TRUE(username_field.empty()); EXPECT_TRUE(password_field.empty()); } // Check that a username and password are not filled in forms in iframes // that don't have PSL matched origins. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PSLUnMatchedCrossSiteFillTest) { GURL main_frame_url = embedded_test_server()->GetURL( "www.foo.com", "/password/password_form_in_crosssite_iframe.html"); NavigationObserver observer(WebContents()); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_frame_url)); observer.Wait(); // Create an iframe and navigate cross-site. NavigationObserver iframe_observer(WebContents()); iframe_observer.SetPathToWaitFor("/password/crossite_iframe_content.html"); GURL iframe_url = embedded_test_server()->GetURL( "www.bar.com", "/password/crossite_iframe_content.html"); std::string create_iframe = base::StringPrintf("create_iframe('%s');", iframe_url.spec().c_str()); ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture(RenderFrameHost(), create_iframe)); iframe_observer.Wait(); // Store a password for autofill later. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = iframe_url.DeprecatedGetOriginAsURL().spec(); signin_form.url = iframe_url; signin_form.username_value = u"temp"; signin_form.password_value = u"pa55w0rd"; password_store->AddLogin(signin_form); WaitForPasswordStore(); // Visit the form again. NavigationObserver reload_observer(WebContents()); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_frame_url)); reload_observer.Wait(); NavigationObserver iframe_observer_2(WebContents()); iframe_observer_2.SetPathToWaitFor("/password/crossite_iframe_content.html"); ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture(RenderFrameHost(), create_iframe)); iframe_observer_2.Wait(); // Simulate the user interaction in the iframe which should trigger autofill. // Click in the middle of the frame to avoid the border. content::SimulateMouseClickOrTapElementWithId(WebContents(), "iframe"); // Verify username is not autofilled std::string empty_username; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), "sendMessage('get_username');", &empty_username)); EXPECT_EQ("", empty_username); // Verify password is not autofilled std::string empty_password; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), "sendMessage('get_password');", &empty_password)); EXPECT_EQ("", empty_password); } // Check that a password form in an iframe of same origin will not be // filled in until user interact with the iframe. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, SameOriginIframeAutoFillTest) { // Visit the sign-up form to store a password for autofill later NavigateToFile("/password/password_form_in_same_origin_iframe.html"); NavigationObserver observer(WebContents()); observer.SetPathToWaitFor("/password/done.html"); std::string submit = "var ifrmDoc = document.getElementById('iframe').contentDocument;" "ifrmDoc.getElementById('username_field').value = 'temp';" "ifrmDoc.getElementById('password_field').value = 'pa55w0rd';" "ifrmDoc.getElementById('input_submit_button').click();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), submit)); observer.Wait(); BubbleObserver prompt_observer(WebContents()); prompt_observer.WaitForAutomaticSavePrompt(); prompt_observer.AcceptSavePrompt(); // Visit the form again NavigationObserver reload_observer(WebContents()); NavigateToFile("/password/password_form_in_same_origin_iframe.html"); reload_observer.Wait(); // Verify password and username are not accessible yet. CheckElementValue("iframe", "username_field", ""); CheckElementValue("iframe", "password_field", ""); // Simulate the user interaction in the iframe which should trigger autofill. // Click in the middle of the username to avoid the border. ASSERT_TRUE(content::ExecJs( RenderFrameHost(), "var usernameRect = document.getElementById(" "'iframe').contentDocument.getElementById('username_field')" ".getBoundingClientRect();", content::EXECUTE_SCRIPT_NO_USER_GESTURE)); int y = content::EvalJs(RenderFrameHost(), "usernameRect.top + usernameRect.bottom;", content::EXECUTE_SCRIPT_NO_USER_GESTURE) .ExtractInt(); int x = content::EvalJs(RenderFrameHost(), "usernameRect.left + usernameRect.right;", content::EXECUTE_SCRIPT_NO_USER_GESTURE) .ExtractInt(); content::SimulateMouseClickAt(WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(x / 2, y / 2)); // Verify username and password have been autofilled WaitForElementValue("iframe", "username_field", "temp"); WaitForElementValue("iframe", "password_field", "pa55w0rd"); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ChangePwdNoAccountStored) { NavigateToFile("/password/password_form.html"); // Fill a form and submit through a <input type="submit"> button. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('chg_password_wo_username_field').value = " "'old_pw';" "document.getElementById('chg_new_password_wo_username_1').value = " "'new_pw';" "document.getElementById('chg_new_password_wo_username_2').value = " "'new_pw';" "document.getElementById('chg_submit_wo_username_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); // No credentials stored before, so save bubble is shown. EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); prompt_observer.AcceptSavePrompt(); // Check that credentials are stored. WaitForPasswordStore(); CheckThatCredentialsStored("", "new_pw"); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ChangePwd1AccountStored) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.password_value = u"pw"; signin_form.username_value = u"temp"; password_store->AddLogin(signin_form); // Check that password update bubble is shown. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit_change_password = "document.getElementById('chg_password_wo_username_field').value = " "'random';" "document.getElementById('chg_new_password_wo_username_1').value = " "'new_pw';" "document.getElementById('chg_new_password_wo_username_2').value = " "'new_pw';" "document.getElementById('chg_submit_wo_username_button').click()"; ASSERT_TRUE( content::ExecuteScript(WebContents(), fill_and_submit_change_password)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsUpdatePromptShownAutomatically()); // We emulate that the user clicks "Update" button. prompt_observer.AcceptUpdatePrompt(); WaitForPasswordStore(); CheckThatCredentialsStored("temp", "new_pw"); } // This fixture disable autofill. If a password is autofilled, then all the // Javascript changes are discarded and test below would not be able to feed a // new password to the form. class PasswordManagerBrowserTestWithAutofillDisabled : public PasswordManagerBrowserTest { public: PasswordManagerBrowserTestWithAutofillDisabled() { feature_list_.InitAndEnableFeature(features::kFillOnAccountSelect); } private: base::test::ScopedFeatureList feature_list_; }; IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestWithAutofillDisabled, PasswordOverriddenUpdateBubbleShown) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.username_value = u"temp"; signin_form.password_value = u"pw"; password_store->AddLogin(signin_form); // Check that password update bubble is shown. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'new_pw';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); // The stored password "pw" was overridden with "new_pw", so update prompt is // expected. EXPECT_TRUE(prompt_observer.IsUpdatePromptShownAutomatically()); prompt_observer.AcceptUpdatePrompt(); WaitForPasswordStore(); CheckThatCredentialsStored("temp", "new_pw"); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PasswordNotOverriddenUpdateBubbleNotShown) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.username_value = u"temp"; signin_form.password_value = u"pw"; password_store->AddLogin(signin_form); // Check that password update bubble is shown. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'pw';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); // The stored password "pw" was not overridden, so update prompt is not // expected. EXPECT_FALSE(prompt_observer.IsUpdatePromptShownAutomatically()); CheckThatCredentialsStored("temp", "pw"); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, MultiplePasswordsWithPasswordSelectionEnabled) { NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); // It is important that these 3 passwords are different. Because if two of // them are the same, it is going to be treated as a password update and the // dropdown will not be shown. std::string fill_and_submit = "document.getElementById('chg_password_wo_username_field').value = " "'pass1';" "document.getElementById('chg_new_password_wo_username_1').value = " "'pass2';" "document.getElementById('chg_new_password_wo_username_2').value = " "'pass3';" "document.getElementById('chg_submit_wo_username_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); // 3 possible passwords are going to be shown in a dropdown when the password // selection feature is enabled. The first one will be selected as the main // password by default. All three will be in the all_possible_passwords // list. The save password prompt is expected. BubbleObserver bubble_observer(WebContents()); EXPECT_TRUE(bubble_observer.IsSavePromptShownAutomatically()); EXPECT_EQ(u"pass1", ManagePasswordsUIController::FromWebContents(WebContents()) ->GetPendingPassword() .password_value); EXPECT_THAT( ManagePasswordsUIController::FromWebContents(WebContents()) ->GetPendingPassword() .all_possible_passwords, ElementsAre( ValueElementPair(u"pass1", u"chg_password_wo_username_field"), ValueElementPair(u"pass2", u"chg_new_password_wo_username_1"), ValueElementPair(u"pass3", u"chg_new_password_wo_username_2"))); bubble_observer.AcceptSavePrompt(); WaitForPasswordStore(); CheckThatCredentialsStored("", "pass1"); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ChangePwdWhenTheFormContainNotUsernameTextfield) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.password_value = u"pw"; signin_form.username_value = u"temp"; password_store->AddLogin(signin_form); // Check that password update bubble is shown. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit_change_password = "document.getElementById('chg_text_field').value = '3';" "document.getElementById('chg_password_withtext_field').value" " = 'random';" "document.getElementById('chg_new_password_withtext_username_1').value" " = 'new_pw';" "document.getElementById('chg_new_password_withtext_username_2').value" " = 'new_pw';" "document.getElementById('chg_submit_withtext_button').click()"; ASSERT_TRUE( content::ExecuteScript(WebContents(), fill_and_submit_change_password)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsUpdatePromptShownAutomatically()); prompt_observer.AcceptUpdatePrompt(); WaitForPasswordStore(); CheckThatCredentialsStored("temp", "new_pw"); } // Test whether the password form with the username and password fields having // ambiguity in id attribute gets autofilled correctly. IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, AutofillSuggestionsForPasswordFormWithAmbiguousIdAttribute) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm login_form; login_form.signon_realm = embedded_test_server()->base_url().spec(); login_form.action = embedded_test_server()->GetURL("/password/done.html"); login_form.username_value = u"myusername"; login_form.password_value = u"mypassword"; password_store->AddLogin(login_form); // Now, navigate to the password form having ambiguous Ids for username and // password fields and verify whether username and password is autofilled. NavigateToFile("/password/ambiguous_password_form.html"); // Let the user interact with the page, so that DOM gets modification events, // needed for autofilling fields. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); WaitForElementValue("ambiguous_form", 0 /* elements_index */, "myusername"); WaitForElementValue("ambiguous_form", 1 /* elements_index */, "mypassword"); } // Test whether the password form having username and password fields without // name and id attribute gets autofilled correctly. IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, AutofillSuggestionsForPasswordFormWithoutNameOrIdAttribute) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm login_form; login_form.signon_realm = embedded_test_server()->base_url().spec(); login_form.action = embedded_test_server()->GetURL("/password/done.html"); login_form.username_value = u"myusername"; login_form.password_value = u"mypassword"; password_store->AddLogin(login_form); // Now, navigate to the password form having no Ids for username and password // fields and verify whether username and password is autofilled. NavigateToFile("/password/ambiguous_password_form.html"); // Let the user interact with the page, so that DOM gets modification events, // needed for autofilling fields. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); WaitForElementValue("no_name_id_form", 0 /* elements_index */, "myusername"); WaitForElementValue("no_name_id_form", 1 /* elements_index */, "mypassword"); } // Test whether the change password form having username and password fields // without name and id attribute gets autofilled correctly. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, AutofillSuggestionsForChangePwdWithEmptyNames) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm login_form; login_form.signon_realm = embedded_test_server()->base_url().spec(); login_form.action = embedded_test_server()->GetURL("/password/done.html"); login_form.username_value = u"myusername"; login_form.password_value = u"mypassword"; password_store->AddLogin(login_form); // Now, navigate to the password form having no Ids for username and password // fields and verify whether username and password is autofilled. NavigateToFile("/password/ambiguous_password_form.html"); // Let the user interact with the page, so that DOM gets modification events, // needed for autofilling fields. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); WaitForElementValue("change_pwd_but_no_autocomplete", 0 /* elements_index */, "myusername"); WaitForElementValue("change_pwd_but_no_autocomplete", 1 /* elements_index */, "mypassword"); std::string get_new_password = "window.domAutomationController.send(" " document.getElementById(" " 'change_pwd_but_no_autocomplete').elements[2].value);"; std::string new_password; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), get_new_password, &new_password)); EXPECT_EQ("", new_password); } // Test whether the change password form having username and password fields // with empty names but having |autocomplete='current-password'| gets autofilled // correctly. IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, AutofillSuggestionsForChangePwdWithEmptyNamesAndAutocomplete) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm login_form; login_form.signon_realm = embedded_test_server()->base_url().spec(); login_form.action = embedded_test_server()->GetURL("/password/done.html"); login_form.username_value = u"myusername"; login_form.password_value = u"mypassword"; password_store->AddLogin(login_form); // Now, navigate to the password form having no Ids for username and password // fields and verify whether username and password is autofilled. NavigateToFile("/password/ambiguous_password_form.html"); // Let the user interact with the page, so that DOM gets modification events, // needed for autofilling fields. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); WaitForElementValue("change_pwd", 0 /* elements_index */, "myusername"); WaitForElementValue("change_pwd", 1 /* elements_index */, "mypassword"); std::string get_new_password = "window.domAutomationController.send(" " document.getElementById('change_pwd').elements[2].value);"; std::string new_password; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), get_new_password, &new_password)); EXPECT_EQ("", new_password); } // Test whether the change password form having username and password fields // with empty names but having only new password fields having // |autocomplete='new-password'| atrribute do not get autofilled. IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, AutofillSuggestionsForChangePwdWithEmptyNamesButOnlyNewPwdField) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm login_form; login_form.signon_realm = embedded_test_server()->base_url().spec(); login_form.action = embedded_test_server()->GetURL("/password/done.html"); login_form.username_value = u"myusername"; login_form.password_value = u"mypassword"; password_store->AddLogin(login_form); // Now, navigate to the password form having no Ids for username and password // fields and verify whether username and password is autofilled. NavigateToFile("/password/ambiguous_password_form.html"); // Let the user interact with the page, so that DOM gets modification events, // needed for autofilling fields. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); std::string get_username = "window.domAutomationController.send(" " document.getElementById(" " 'change_pwd_but_no_old_pwd').elements[0].value);"; std::string actual_username; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), get_username, &actual_username)); EXPECT_EQ("", actual_username); std::string get_new_password = "window.domAutomationController.send(" " document.getElementById(" " 'change_pwd_but_no_old_pwd').elements[1].value);"; std::string new_password; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), get_new_password, &new_password)); EXPECT_EQ("", new_password); std::string get_retype_password = "window.domAutomationController.send(" " document.getElementById(" " 'change_pwd_but_no_old_pwd').elements[2].value);"; std::string retyped_password; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), get_retype_password, &retyped_password)); EXPECT_EQ("", retyped_password); } // When there are multiple HttpAuthObservers (e.g., multiple HTTP auth dialogs // as in http://crbug.com/537823), ensure that credentials from PasswordStore // distributed to them are filtered by the realm. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, BasicAuthSeparateRealms) { // We must use a new test server here because embedded_test_server() is // already started at this point and adding the request handler to it would // not be thread safe. net::EmbeddedTestServer http_test_server; http_test_server.RegisterRequestHandler( base::BindRepeating(&HandleTestAuthRequest)); ASSERT_TRUE(http_test_server.Start()); // Save credentials for "test realm" in the store. password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get()); password_manager::PasswordForm creds; creds.scheme = password_manager::PasswordForm::Scheme::kBasic; creds.signon_realm = http_test_server.base_url().spec() + "test realm"; creds.password_value = u"pw"; creds.username_value = u"temp"; password_store->AddLogin(creds); WaitForPasswordStore(); ASSERT_FALSE(password_store->IsEmpty()); // In addition to the HttpAuthObserver created automatically for the HTTP // auth dialog, also create a mock observer, for a different realm. MockHttpAuthObserver mock_login_model_observer; HttpAuthManager* httpauth_manager = ChromePasswordManagerClient::FromWebContents(WebContents()) ->GetHttpAuthManager(); password_manager::PasswordForm other_form(creds); other_form.signon_realm = "https://example.com/other realm"; httpauth_manager->SetObserverAndDeliverCredentials(&mock_login_model_observer, other_form); // The mock observer should not receive the stored credentials. EXPECT_CALL(mock_login_model_observer, OnAutofillDataAvailable(_, _)) .Times(0); // Now wait until the navigation to the test server causes a HTTP auth dialog // to appear. content::NavigationController* nav_controller = &WebContents()->GetController(); WindowedAuthNeededObserver auth_needed_observer(nav_controller); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), http_test_server.GetURL("/basic_auth"))); auth_needed_observer.Wait(); // The auth dialog caused a query to PasswordStore, make sure it was // processed. WaitForPasswordStore(); httpauth_manager->DetachObserver(&mock_login_model_observer); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ProxyAuthFilling) { GURL test_page = embedded_test_server()->GetURL("/auth-basic"); // Save credentials for "testrealm" in the store. password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get()); password_manager::PasswordForm creds; creds.scheme = password_manager::PasswordForm::Scheme::kBasic; creds.url = test_page; creds.signon_realm = embedded_test_server()->base_url().spec() + "testrealm"; creds.password_value = u"pw"; creds.username_value = u"temp"; password_store->AddLogin(creds); content::NavigationController* controller = &WebContents()->GetController(); WindowedAuthNeededObserver auth_needed_waiter(controller); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_page)); auth_needed_waiter.Wait(); BubbleObserver(WebContents()).WaitForManagementState(); } // Test whether the password form which is loaded as hidden is autofilled // correctly. This happens very often in situations when in order to sign-in the // user clicks a sign-in button and a hidden passsword form becomes visible. // This test differs from AutofillSuggestionsForProblematicPasswordForm in that // the form is hidden and in that test only some fields are hidden. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, AutofillSuggestionsHiddenPasswordForm) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm login_form; login_form.signon_realm = embedded_test_server()->base_url().spec(); login_form.action = embedded_test_server()->GetURL("/password/done.html"); login_form.username_value = u"myusername"; login_form.password_value = u"mypassword"; password_store->AddLogin(login_form); // Now, navigate to the hidden password form and verify whether username and // password is autofilled. NavigateToFile("/password/password_form.html"); // Let the user interact with the page, so that DOM gets modification events, // needed for autofilling the password. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); WaitForElementValue("hidden_password_form_username", "myusername"); WaitForElementValue("hidden_password_form_password", "mypassword"); } // Test whether the password form with the problematic invisible password field // gets autofilled correctly. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, AutofillSuggestionsForProblematicPasswordForm) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm login_form; login_form.signon_realm = embedded_test_server()->base_url().spec(); login_form.action = embedded_test_server()->GetURL("/password/done.html"); login_form.username_value = u"myusername"; login_form.password_value = u"mypassword"; password_store->AddLogin(login_form); // Now, navigate to the password form with a hidden password field and verify // whether username and password is autofilled. NavigateToFile("/password/password_form.html"); // Let the user interact with the page, so that DOM gets modification events, // needed for autofilling the password. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); WaitForElementValue("form_with_hidden_password_username", "myusername"); WaitForElementValue("form_with_hidden_password_password", "mypassword"); } // Test whether the password form with the problematic invisible password field // in ambiguous password form gets autofilled correctly. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, AutofillSuggestionsForProblematicAmbiguousPasswordForm) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm login_form; login_form.signon_realm = embedded_test_server()->base_url().spec(); login_form.action = embedded_test_server()->GetURL("/password/done.html"); login_form.username_value = u"myusername"; login_form.password_value = u"mypassword"; password_store->AddLogin(login_form); // Now, navigate to the password form having ambiguous Ids for username and // password fields and verify whether username and password is autofilled. NavigateToFile("/password/ambiguous_password_form.html"); // Let the user interact with the page, so that DOM gets modification events, // needed for autofilling fields. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); WaitForElementValue("hidden_password_form", 0 /* elements_index */, "myusername"); WaitForElementValue("hidden_password_form", 2 /* elements_index */, "mypassword"); } // Check that the internals page contains logs from the renderer. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, InternalsPage_Renderer) { // Open the internals page. ui_test_utils::NavigateToURLWithDisposition( browser(), GURL("chrome://password-manager-internals"), WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); content::WebContents* internals_web_contents = WebContents(); // The renderer is supposed to ask whether logging is available. To avoid // race conditions between the answer "Logging is available" arriving from // the browser and actual logging callsites reached in the renderer, open // first an arbitrary page to ensure that the renderer queries the // availability of logging and has enough time to receive the answer. ui_test_utils::NavigateToURLWithDisposition( browser(), embedded_test_server()->GetURL("/password/done.html"), WindowOpenDisposition::NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); content::WebContents* forms_web_contents = browser()->tab_strip_model()->GetActiveWebContents(); // Now navigate to another page, containing some forms, so that the renderer // attempts to log. It should be a different page than the current one, // because just reloading the current one sometimes confused the Wait() call // and lead to timeouts (https://crbug.com/804398). NavigationObserver observer(forms_web_contents); ui_test_utils::NavigateToURLWithDisposition( browser(), embedded_test_server()->GetURL("/password/password_form.html"), WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); observer.Wait(); std::string find_logs = "var text = document.getElementById('log-entries').innerText;" "var logs_found = /PasswordAutofillAgent::/.test(text);" "window.domAutomationController.send(logs_found);"; bool logs_found = false; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractBool( internals_web_contents->GetMainFrame(), find_logs, &logs_found)); EXPECT_TRUE(logs_found); } // Check that the internals page contains logs from the browser. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, InternalsPage_Browser) { ui_test_utils::NavigateToURLWithDisposition( browser(), GURL("chrome://password-manager-internals"), WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); content::WebContents* internals_web_contents = WebContents(); ui_test_utils::NavigateToURLWithDisposition( browser(), embedded_test_server()->GetURL("/password/password_form.html"), WindowOpenDisposition::NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); std::string find_logs = "var text = document.getElementById('log-entries').innerText;" "var logs_found = /PasswordManager::/.test(text);" "window.domAutomationController.send(logs_found);"; bool logs_found = false; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractBool( internals_web_contents->GetMainFrame(), find_logs, &logs_found)); EXPECT_TRUE(logs_found); } // Tests that submitted credentials are saved on a password form without // username element when there are no stored credentials. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PasswordRetryFormSaveNoUsernameCredentials) { // Check that password save bubble is shown. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('retry_password_field').value = 'pw';" "document.getElementById('retry_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); prompt_observer.AcceptSavePrompt(); WaitForPasswordStore(); CheckThatCredentialsStored("", "pw"); } // Tests that no bubble shown when a password form without username submitted // and there is stored credentials with the same password. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PasswordRetryFormNoBubbleWhenPasswordTheSame) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.username_value = u"temp"; signin_form.password_value = u"pw"; password_store->AddLogin(signin_form); signin_form.username_value = u"temp1"; signin_form.password_value = u"pw1"; password_store->AddLogin(signin_form); // Check that no password bubble is shown when the submitted password is the // same in one of the stored credentials. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('retry_password_field').value = 'pw';" "document.getElementById('retry_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); EXPECT_FALSE(prompt_observer.IsUpdatePromptShownAutomatically()); } // Tests that the update bubble shown when a password form without username is // submitted and there are stored credentials but with different password. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PasswordRetryFormUpdateBubbleShown) { // At first let us save credentials to the PasswordManager. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.username_value = u"temp"; signin_form.password_value = u"pw"; password_store->AddLogin(signin_form); // Check that password update bubble is shown. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('retry_password_field').value = 'new_pw';" "document.getElementById('retry_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); // The new password "new_pw" is used, so update prompt is expected. EXPECT_TRUE(prompt_observer.IsUpdatePromptShownAutomatically()); prompt_observer.AcceptUpdatePrompt(); WaitForPasswordStore(); CheckThatCredentialsStored("temp", "new_pw"); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoCrashWhenNavigatingWithOpenAccountPicker) { // Save credentials with 'skip_zero_click'. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.password_value = u"password"; signin_form.username_value = u"user"; signin_form.url = embedded_test_server()->base_url(); signin_form.skip_zero_click = true; password_store->AddLogin(signin_form); NavigateToFile("/password/password_form.html"); // Call the API to trigger the notification to the client, which raises the // account picker dialog. ASSERT_TRUE(content::ExecuteScript( WebContents(), "navigator.credentials.get({password: true})")); // Navigate while the picker is open. NavigateToFile("/password/password_form.html"); // No crash! } // Tests that the prompt to save the password is still shown if the fields have // the "autocomplete" attribute set off. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForSubmitWithAutocompleteOff) { NavigateToFile("/password/password_autocomplete_off_test.html"); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit = "document.getElementById('username').value = 'temp';" "document.getElementById('password').value = 'random';" "document.getElementById('submit').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); } IN_PROC_BROWSER_TEST_F( PasswordManagerBrowserTest, SkipZeroClickNotToggledAfterSuccessfulSubmissionWithAPI) { // Save credentials with 'skip_zero_click' password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get()); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.password_value = u"password"; signin_form.username_value = u"user"; signin_form.url = embedded_test_server()->base_url(); signin_form.skip_zero_click = true; password_store->AddLogin(signin_form); NavigateToFile("/password/password_form.html"); // Call the API to trigger the notification to the client. ASSERT_TRUE(content::ExecuteScript( WebContents(), "navigator.credentials.get({password: true, unmediated: true })")); NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit_change_password = "document.getElementById('username_field').value = 'user';" "document.getElementById('password_field').value = 'password';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE( content::ExecuteScript(WebContents(), fill_and_submit_change_password)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); // Verify that the form's 'skip_zero_click' is not updated. auto& passwords_map = password_store->stored_passwords(); ASSERT_EQ(1u, passwords_map.size()); auto& passwords_vector = passwords_map.begin()->second; ASSERT_EQ(1u, passwords_vector.size()); const password_manager::PasswordForm& form = passwords_vector[0]; EXPECT_EQ(u"user", form.username_value); EXPECT_EQ(u"password", form.password_value); EXPECT_TRUE(form.skip_zero_click); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, SkipZeroClickNotToggledAfterSuccessfulAutofill) { // Save credentials with 'skip_zero_click' password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get()); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.password_value = u"password"; signin_form.username_value = u"user"; signin_form.url = embedded_test_server()->base_url(); signin_form.skip_zero_click = true; password_store->AddLogin(signin_form); NavigateToFile("/password/password_form.html"); // No API call. NavigationObserver observer(WebContents()); BubbleObserver prompt_observer(WebContents()); std::string fill_and_submit_change_password = "document.getElementById('username_field').value = 'user';" "document.getElementById('password_field').value = 'password';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE( content::ExecuteScript(WebContents(), fill_and_submit_change_password)); observer.Wait(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); // Verify that the form's 'skip_zero_click' is not updated. auto& passwords_map = password_store->stored_passwords(); ASSERT_EQ(1u, passwords_map.size()); auto& passwords_vector = passwords_map.begin()->second; ASSERT_EQ(1u, passwords_vector.size()); const password_manager::PasswordForm& form = passwords_vector[0]; EXPECT_EQ(u"user", form.username_value); EXPECT_EQ(u"password", form.password_value); EXPECT_TRUE(form.skip_zero_click); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ReattachWebContents) { auto detached_web_contents = content::WebContents::Create( content::WebContents::CreateParams(WebContents()->GetBrowserContext())); NavigationObserver observer(detached_web_contents.get()); detached_web_contents->GetController().LoadURL( embedded_test_server()->GetURL("/password/multi_frames.html"), content::Referrer(), ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); observer.Wait(); // Ensure that there is at least one more frame created than just the main // frame. EXPECT_LT(1u, CollectAllRenderFrameHosts(detached_web_contents->GetPrimaryPage()) .size()); auto* tab_strip_model = browser()->tab_strip_model(); // Check that the autofill and password manager driver factories are notified // about all frames, not just the main one. The factories should receive // messages for non-main frames, in particular // AutofillHostMsg_PasswordFormsParsed. If that were the first time the // factories hear about such frames, this would crash. tab_strip_model->AddWebContents(std::move(detached_web_contents), -1, ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL, TabStripModel::ADD_ACTIVE); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, FillWhenFormWithHiddenUsername) { // At first let us save a credential to the password store. password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.url = embedded_test_server()->base_url(); signin_form.username_value = u"current_username"; signin_form.password_value = u"current_username_password"; password_store->AddLogin(signin_form); signin_form.username_value = u"last_used_username"; signin_form.password_value = u"last_used_password"; signin_form.date_last_used = base::Time::Now(); password_store->AddLogin(signin_form); NavigateToFile("/password/hidden_username.html"); // Let the user interact with the page. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); // current_username is hardcoded in the invisible text on the page so // current_username_password should be filled rather than last_used_password. WaitForElementValue("password", "current_username_password"); } // Harness for showing dialogs as part of the DialogBrowserTest suite. // Test params: // - bool popup_views_enabled: whether feature AutofillExpandedPopupViews // is enabled for testing. class PasswordManagerDialogBrowserTest : public SupportsTestDialog<PasswordManagerBrowserTestBase> { public: PasswordManagerDialogBrowserTest() = default; PasswordManagerDialogBrowserTest(const PasswordManagerDialogBrowserTest&) = delete; PasswordManagerDialogBrowserTest& operator=( const PasswordManagerDialogBrowserTest&) = delete; void ShowUi(const std::string& name) override { // Note regarding flakiness: LocationBarBubbleDelegateView::ShowForReason() // uses ShowInactive() unless the bubble is invoked with reason == // USER_GESTURE. This means that, so long as these dialogs are not triggered // by gesture, the dialog does not attempt to take focus, and so should // never _lose_ focus in the test, which could cause flakes when tests are // run in parallel. LocationBarBubbles also dismiss on other events, but // only events in the WebContents. E.g. Rogue mouse clicks should not cause // the dialog to dismiss since they won't be sent via WebContents. // A user gesture is determined in browser_commands.cc by checking // ManagePasswordsUIController::IsAutomaticallyOpeningBubble(), but that's // set and cleared immediately while showing the bubble, so it can't be // checked here. NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); } }; IN_PROC_BROWSER_TEST_F(PasswordManagerDialogBrowserTest, InvokeUi_normal) { ShowAndVerifyUi(); } // Verify that password manager ignores passwords on forms injected into // about:blank frames. See https://crbug.com/756587. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, AboutBlankFramesAreIgnored) { // Start from a page without a password form. NavigateToFile("/password/other.html"); // Add a blank iframe and then inject a password form into it. BubbleObserver prompt_observer(WebContents()); GURL submit_url(embedded_test_server()->GetURL("/password/done.html")); InjectBlankFrameWithPasswordForm(WebContents(), submit_url); content::RenderFrameHost* frame = ChildFrameAt(WebContents()->GetMainFrame(), 0); EXPECT_EQ(GURL(url::kAboutBlankURL), frame->GetLastCommittedURL()); EXPECT_TRUE(frame->IsRenderFrameLive()); EXPECT_FALSE(prompt_observer.IsSavePromptAvailable()); // Fill in the password and submit the form. This shouldn't bring up a save // password prompt and shouldn't result in a renderer kill. SubmitInjectedPasswordForm(WebContents(), frame, submit_url); EXPECT_TRUE(frame->IsRenderFrameLive()); EXPECT_EQ(submit_url, frame->GetLastCommittedURL()); EXPECT_FALSE(prompt_observer.IsSavePromptAvailable()); } // Verify that password manager ignores passwords on forms injected into // about:blank popups. See https://crbug.com/756587. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, AboutBlankPopupsAreIgnored) { // Start from a page without a password form. NavigateToFile("/password/other.html"); // Open an about:blank popup and inject the password form into it. ui_test_utils::TabAddedWaiter tab_add(browser()); GURL submit_url(embedded_test_server()->GetURL("/password/done.html")); std::string form_html = GeneratePasswordFormForAction(submit_url); std::string open_blank_popup_with_password_form = "var w = window.open('about:blank');" "w.document.body.innerHTML = \"" + form_html + "\";"; ASSERT_TRUE(content::ExecuteScript(WebContents(), open_blank_popup_with_password_form)); tab_add.Wait(); ASSERT_EQ(2, browser()->tab_strip_model()->count()); content::WebContents* newtab = browser()->tab_strip_model()->GetActiveWebContents(); // Submit the password form and check that there was no renderer kill and no BubbleObserver prompt_observer(WebContents()); SubmitInjectedPasswordForm(newtab, newtab->GetMainFrame(), submit_url); EXPECT_FALSE(prompt_observer.IsSavePromptAvailable()); EXPECT_TRUE(newtab->GetMainFrame()->IsRenderFrameLive()); EXPECT_EQ(submit_url, newtab->GetMainFrame()->GetLastCommittedURL()); } // Verify that previously saved passwords for about:blank frames are not used // for autofill. See https://crbug.com/756587. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ExistingAboutBlankPasswordsAreNotUsed) { password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.url = GURL(url::kAboutBlankURL); signin_form.signon_realm = "about:"; GURL submit_url(embedded_test_server()->GetURL("/password/done.html")); signin_form.action = submit_url; signin_form.password_value = u"pa55w0rd"; password_store->AddLogin(signin_form); // Start from a page without a password form. NavigateToFile("/password/other.html"); // Inject an about:blank frame with password form. InjectBlankFrameWithPasswordForm(WebContents(), submit_url); content::RenderFrameHost* frame = ChildFrameAt(WebContents()->GetMainFrame(), 0); EXPECT_EQ(GURL(url::kAboutBlankURL), frame->GetLastCommittedURL()); // Simulate user interaction in the iframe which normally triggers // autofill. Click in the middle of the frame to avoid the border. content::SimulateMouseClickOrTapElementWithId(WebContents(), "iframe"); // Verify password is not autofilled. Blink has a timer for 0.3 seconds // before it updates the browser with the new dynamic form, so wait long // enough for this timer to fire before checking the password. Note that we // can't wait for any other events here, because when the test passes, there // should be no password manager IPCs sent from the renderer to browser. std::string empty_password; EXPECT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( frame, "setTimeout(function() {" " domAutomationController.send(" " document.getElementById('password_field').value);" "}, 1000);", &empty_password)); EXPECT_EQ("", empty_password); EXPECT_TRUE(frame->IsRenderFrameLive()); } // Verify that there is no renderer kill when filling out a password on a // subframe with a data: URL. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoRendererKillWithDataURLFrames) { // Start from a page without a password form. NavigateToFile("/password/other.html"); // Add a iframe with a data URL that has a password form. BubbleObserver prompt_observer(WebContents()); GURL submit_url(embedded_test_server()->GetURL("/password/done.html")); std::string form_html = GeneratePasswordFormForAction(submit_url); std::string inject_data_frame_with_password_form = "var frame = document.createElement('iframe');\n" "frame.src = \"data:text/html," + form_html + "\";\n" "document.body.appendChild(frame);\n"; ASSERT_TRUE(content::ExecuteScript(WebContents(), inject_data_frame_with_password_form)); EXPECT_TRUE(content::WaitForLoadStop(WebContents())); content::RenderFrameHost* frame = ChildFrameAt(WebContents()->GetMainFrame(), 0); EXPECT_TRUE(frame->GetLastCommittedURL().SchemeIs(url::kDataScheme)); EXPECT_TRUE(frame->IsRenderFrameLive()); EXPECT_FALSE(prompt_observer.IsSavePromptAvailable()); // Fill in the password and submit the form. This shouldn't bring up a save // password prompt and shouldn't result in a renderer kill. SubmitInjectedPasswordForm(WebContents(), frame, submit_url); // After navigation, the RenderFrameHost may change. frame = ChildFrameAt(WebContents()->GetMainFrame(), 0); EXPECT_TRUE(frame->IsRenderFrameLive()); EXPECT_EQ(submit_url, frame->GetLastCommittedURL()); EXPECT_FALSE(prompt_observer.IsSavePromptAvailable()); } // Verify that there is no renderer kill when filling out a password on a // blob: URL. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoRendererKillWithBlobURLFrames) { // Start from a page without a password form. NavigateToFile("/password/other.html"); GURL submit_url(embedded_test_server()->GetURL("/password/done.html")); std::string form_html = GeneratePasswordFormForAction(submit_url); std::string navigate_to_blob_url = "location.href = URL.createObjectURL(new Blob([\"" + form_html + "\"], { type: 'text/html' }));"; NavigationObserver observer(WebContents()); ASSERT_TRUE(content::ExecuteScript(WebContents(), navigate_to_blob_url)); observer.Wait(); // Fill in the password and submit the form. This shouldn't bring up a save // password prompt and shouldn't result in a renderer kill. std::string fill_and_submit = "document.getElementById('password_field').value = 'random';" "document.getElementById('testform').submit();"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); EXPECT_FALSE(BubbleObserver(WebContents()).IsSavePromptAvailable()); } // Test that for HTTP auth (i.e., credentials not put through web forms) the // password manager works even though it should be disabled on the previous // page. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, CorrectEntryForHttpAuth) { // The embedded_test_server() is already started at this point and adding // the request handler to it would not be thread safe. Therefore, use a new // server. net::EmbeddedTestServer http_test_server; // Teach the embedded server to handle requests by issuing the basic auth // challenge. http_test_server.RegisterRequestHandler( base::BindRepeating(&HandleTestAuthRequest)); ASSERT_TRUE(http_test_server.Start()); LoginPromptBrowserTestObserver login_observer; login_observer.Register(content::Source<content::NavigationController>( &WebContents()->GetController())); // Navigate to about:blank first. This is a page where password manager // should not work. ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("about:blank"))); content::NavigationController* nav_controller = &WebContents()->GetController(); WindowedAuthNeededObserver auth_needed_observer(nav_controller); // Navigate to a page requiring HTTP auth ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), http_test_server.GetURL("/basic_auth"))); auth_needed_observer.Wait(); NavigationObserver nav_observer(WebContents()); WindowedAuthSuppliedObserver auth_supplied_observer(nav_controller); // Offer valid credentials on the auth challenge. ASSERT_EQ(1u, login_observer.handlers().size()); LoginHandler* handler = *login_observer.handlers().begin(); ASSERT_TRUE(handler); // Any username/password will work. handler->SetAuth(u"user", u"pwd"); auth_supplied_observer.Wait(); // The password manager should be working correctly. nav_observer.Wait(); WaitForPasswordStore(); BubbleObserver bubble_observer(WebContents()); EXPECT_TRUE(bubble_observer.IsSavePromptShownAutomatically()); } // Test that if HTTP auth login (i.e., credentials not put through web forms) // succeeds, and there is a blocklisted entry with the HTML PasswordForm::Scheme // for that origin, then the bubble is shown. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, HTTPAuthRealmAfterHTMLBlocklistedIsNotBlocked) { // The embedded_test_server() is already started at this point and adding // the request handler to it would not be thread safe. Therefore, use a new // server. net::EmbeddedTestServer http_test_server; // Teach the embedded server to handle requests by issuing the basic auth // challenge. http_test_server.RegisterRequestHandler( base::BindRepeating(&HandleTestAuthRequest)); ASSERT_TRUE(http_test_server.Start()); LoginPromptBrowserTestObserver login_observer; login_observer.Register(content::Source<content::NavigationController>( &WebContents()->GetController())); password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm blocked_form; blocked_form.scheme = password_manager::PasswordForm::Scheme::kHtml; blocked_form.signon_realm = http_test_server.base_url().spec(); blocked_form.url = http_test_server.base_url(); blocked_form.blocked_by_user = true; password_store->AddLogin(blocked_form); content::NavigationController* nav_controller = &WebContents()->GetController(); WindowedAuthNeededObserver auth_needed_observer(nav_controller); // Navigate to a page requiring HTTP auth. ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), http_test_server.GetURL("/basic_auth"))); auth_needed_observer.Wait(); NavigationObserver nav_observer(WebContents()); WindowedAuthSuppliedObserver auth_supplied_observer(nav_controller); ASSERT_EQ(1u, login_observer.handlers().size()); LoginHandler* handler = *login_observer.handlers().begin(); ASSERT_TRUE(handler); // Any username/password will work. handler->SetAuth(u"user", u"pwd"); auth_supplied_observer.Wait(); nav_observer.Wait(); WaitForPasswordStore(); EXPECT_TRUE(BubbleObserver(WebContents()).IsSavePromptShownAutomatically()); } // Test that if HTML login succeeds, and there is a blocklisted entry // with the HTTP auth PasswordForm::Scheme (i.e., credentials not put // through web forms) for that origin, then the bubble is shown. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, HTMLLoginAfterHTTPAuthBlocklistedIsNotBlocked) { password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm blocked_form; blocked_form.scheme = password_manager::PasswordForm::Scheme::kBasic; blocked_form.signon_realm = embedded_test_server()->base_url().spec() + "test realm"; blocked_form.url = embedded_test_server()->base_url(); blocked_form.blocked_by_user = true; password_store->AddLogin(blocked_form); NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'pw';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); BubbleObserver bubble_observer(WebContents()); EXPECT_TRUE(bubble_observer.IsSavePromptShownAutomatically()); } // Tests that "blocklist site" feature works for the basic scenario. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, HTMLLoginAfterHTMLBlocklistedIsBlocklisted) { password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm blocked_form; blocked_form.scheme = password_manager::PasswordForm::Scheme::kHtml; blocked_form.signon_realm = embedded_test_server()->base_url().spec(); blocked_form.url = embedded_test_server()->base_url(); blocked_form.blocked_by_user = true; password_store->AddLogin(blocked_form); NavigateToFile("/password/password_form.html"); NavigationObserver observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'pw';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); BubbleObserver bubble_observer(WebContents()); EXPECT_FALSE(bubble_observer.IsSavePromptShownAutomatically()); EXPECT_TRUE(bubble_observer.IsSavePromptAvailable()); } // This test emulates what was observed in https://crbug.com/856543: Imagine the // user stores a single username/password pair on origin A, and later submits a // username-less password-reset form on origin B. In the bug, A and B were // PSL-matches (different, but with the same eTLD+1), and Chrome ended up // overwriting the old password with the new one. This test checks that update // bubble is shown instead of silent update. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoSilentOverwriteOnPSLMatch) { // Store a password at origin A. const GURL url_A = embedded_test_server()->GetURL("abc.foo.com", "/"); password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get()); password_manager::PasswordForm signin_form; signin_form.signon_realm = url_A.DeprecatedGetOriginAsURL().spec(); signin_form.url = url_A; signin_form.username_value = u"user"; signin_form.password_value = u"oldpassword"; password_store->AddLogin(signin_form); WaitForPasswordStore(); // Visit origin B with a form only containing new- and confirmation-password // fields. GURL url_B = embedded_test_server()->GetURL( "www.foo.com", "/password/new_password_form.html"); NavigationObserver observer_B(WebContents()); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url_B)); observer_B.Wait(); // Fill in the new password and submit. GURL url_done = embedded_test_server()->GetURL("www.foo.com", "/password/done.html"); NavigationObserver observer_done(WebContents()); observer_done.SetPathToWaitFor("/password/done.html"); ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture( RenderFrameHost(), "document.getElementById('new_p').value = 'new password';" "document.getElementById('conf_p').value = 'new password';" "document.getElementById('testform').submit();")); observer_done.Wait(); // Check that the password for origin A was not updated automatically and the // update bubble is shown instead. WaitForPasswordStore(); // Let the navigation take its effect on storing. ASSERT_THAT(password_store->stored_passwords(), ElementsAre(testing::Key(url_A.DeprecatedGetOriginAsURL()))); CheckThatCredentialsStored("user", "oldpassword"); BubbleObserver prompt_observer(WebContents()); EXPECT_TRUE(prompt_observer.IsUpdatePromptShownAutomatically()); // Check that the password is updated correctly if the user clicks Update. prompt_observer.AcceptUpdatePrompt(); WaitForPasswordStore(); // The stored credential has been updated with the new password. const auto& passwords_map = password_store->stored_passwords(); ASSERT_THAT(passwords_map, ElementsAre(testing::Key(url_A.DeprecatedGetOriginAsURL()))); for (const auto& credentials : passwords_map) { ASSERT_THAT(credentials.second, testing::SizeIs(1)); EXPECT_EQ(u"user", credentials.second[0].username_value); EXPECT_EQ(u"new password", credentials.second[0].password_value); } } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoFillGaiaReauthenticationForm) { password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get()); // Visit Gaia reath page. const GURL url = https_test_server().GetURL("accounts.google.com", "/password/gaia_reath_form.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); // Expects no requests to the password store. So no filling. EXPECT_EQ(0, password_store->fill_matching_logins_calls()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoFillGaiaWithSkipSavePasswordForm) { password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get()); // Visit Gaia form with ssp=1 as query (ssp stands for Skip Save Password). const GURL url = https_test_server().GetURL( "accounts.google.com", "/password/password_form.html?ssp=1"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); // Expects no requests to the password store. So no filling. EXPECT_EQ(0, password_store->fill_matching_logins_calls()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, DeleteCredentialsUpdateDropdown) { password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); // Start with two logins in the password store. password_manager::PasswordForm admin_form; admin_form.signon_realm = embedded_test_server()->base_url().spec(); admin_form.url = embedded_test_server()->base_url(); admin_form.username_value = u"admin"; admin_form.password_value = u"random_secret"; password_store->AddLogin(admin_form); password_manager::PasswordForm user_form = admin_form; user_form.username_value = u"user"; password_store->AddLogin(user_form); NavigateToFile("/password/password_form.html"); ContentPasswordManagerDriverFactory* factory = ContentPasswordManagerDriverFactory::FromWebContents(WebContents()); autofill::mojom::PasswordManagerDriver* driver = factory->GetDriverForFrame(WebContents()->GetMainFrame()); // Just fake a position of the <input> element within the content_area_bounds. // For this test it does not matter where the dropdown is rendered. gfx::Rect content_area_bounds = WebContents()->GetContainerBounds(); gfx::RectF element_bounds(content_area_bounds.x(), content_area_bounds.y(), content_area_bounds.width(), content_area_bounds.height() * 0.1); // Instruct Chrome to show the password dropdown. driver->ShowPasswordSuggestions(base::i18n::LEFT_TO_RIGHT, std::u16string(), 0, element_bounds); autofill::ChromeAutofillClient* autofill_client = autofill::ChromeAutofillClient::FromWebContents(WebContents()); autofill::AutofillPopupController* controller = autofill_client->popup_controller_for_testing().get(); ASSERT_TRUE(controller); // Two credentials and "Manage passwords" should be displayed. EXPECT_EQ(3, controller->GetLineCount()); // Trigger user gesture so that autofill happens. ASSERT_TRUE(content::ExecuteScript( WebContents(), "document.getElementById('username_field').click();")); WaitForElementValue("username_field", "admin"); // Delete one credential. It should not be in the dropdown. password_store->RemoveLogin(admin_form); WaitForPasswordStore(); // Wait for the refetch to finish. EXPECT_FALSE(autofill_client->popup_controller_for_testing()); WaitForPasswordStore(); // Reshow the dropdown. driver->ShowPasswordSuggestions(base::i18n::LEFT_TO_RIGHT, std::u16string(), 0, element_bounds); controller = autofill_client->popup_controller_for_testing().get(); ASSERT_TRUE(controller); EXPECT_EQ(2, controller->GetLineCount()); EXPECT_EQ(u"user", controller->GetSuggestionMainTextAt(0)); EXPECT_NE(u"admin", controller->GetSuggestionMainTextAt(1)); // The username_field should get re-filled with "user" instead of "admin". WaitForElementValue("username_field", "user"); // Delete all the credentials. password_store->RemoveLogin(user_form); WaitForPasswordStore(); // Wait for the refetch to finish. EXPECT_FALSE(autofill_client->popup_controller_for_testing()); WaitForPasswordStore(); // Reshow the dropdown won't work because there is nothing to suggest. driver->ShowPasswordSuggestions(base::i18n::LEFT_TO_RIGHT, std::u16string(), 0, element_bounds); EXPECT_FALSE(autofill_client->popup_controller_for_testing()); WaitForElementValue("username_field", ""); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, FormDynamicallyChanged) { password_manager::PasswordStoreInterface* password_store = PasswordStoreFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) .get(); password_manager::PasswordForm signin_form; signin_form.signon_realm = embedded_test_server()->base_url().spec(); signin_form.username_value = u"temp"; signin_form.password_value = u"pw"; password_store->AddLogin(signin_form); // Check that password update bubble is shown. NavigateToFile("/password/simple_password.html"); // Simulate that a script removes username/password elements and adds the // elements identical to them. ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture( RenderFrameHost(), "function replaceElement(id) {" " var elem = document.getElementById(id);" " var parent = elem.parentElement;" " var cloned_elem = elem.cloneNode();" " cloned_elem.value = '';" " parent.removeChild(elem);" " parent.appendChild(cloned_elem);" "}" "replaceElement('username_field');" "replaceElement('password_field');")); // Let the user interact with the page, so that DOM gets modification events, // needed for autofilling fields. content::SimulateMouseClickAt( WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1)); WaitForElementValue("username_field", "temp"); WaitForElementValue("password_field", "pw"); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ParserAnnotations) { base::CommandLine::ForCurrentProcess()->AppendSwitch( autofill::switches::kShowAutofillSignatures); NavigateToFile("/password/password_form.html"); const char kGetAnnotation[] = "window.domAutomationController.send(" " document.getElementById('%s').getAttribute('pm_parser_annotation'));"; std::string username_annotation; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), base::StringPrintf(kGetAnnotation, "username_field"), &username_annotation)); EXPECT_EQ("username_element", username_annotation); std::string password_annotation; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), base::StringPrintf(kGetAnnotation, "password_field"), &password_annotation)); EXPECT_EQ("password_element", password_annotation); std::string new_password_annotation; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), base::StringPrintf(kGetAnnotation, "chg_new_password_1"), &new_password_annotation)); EXPECT_EQ("new_password_element", new_password_annotation); std::string cofirmation_password_annotation; ASSERT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString( RenderFrameHost(), base::StringPrintf(kGetAnnotation, "chg_new_password_2"), &cofirmation_password_annotation)); EXPECT_EQ("confirmation_password_element", cofirmation_password_annotation); } // Test if |PasswordManager.FormVisited.PerProfileType| and // |PasswordManager.FormSubmission.PerProfileType| metrics are recorded as // expected. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ProfileTypeMetricSubmission) { base::HistogramTester histogram_tester; NavigateToFile("/password/simple_password.html"); // Test if visit is properly recorded and submission is not marked. histogram_tester.ExpectUniqueSample( "PasswordManager.FormVisited.PerProfileType", profile_metrics::BrowserProfileType::kRegular, 1); histogram_tester.ExpectTotalCount( "PasswordManager.FormSubmission.PerProfileType", 0); // Fill a form and submit through a <input type="submit"> button. Nothing // special. NavigationObserver observer(WebContents()); constexpr char kFillAndSubmit[] = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), kFillAndSubmit)); observer.Wait(); // Test if submission is properly recorded. histogram_tester.ExpectUniqueSample( "PasswordManager.FormSubmission.PerProfileType", profile_metrics::BrowserProfileType::kRegular, 1); } IN_PROC_BROWSER_TEST_F(PasswordManagerBackForwardCacheBrowserTest, SavePasswordOnRestoredPage) { // Navigate to a page with a password form. NavigateToFile("/password/password_form.html"); content::RenderFrameHostWrapper rfh(WebContents()->GetMainFrame()); // Navigate away so that the password form page is stored in the cache. EXPECT_TRUE(NavigateToURL( WebContents(), embedded_test_server()->GetURL("a.com", "/title1.html"))); EXPECT_EQ(rfh->GetLifecycleState(), content::RenderFrameHost::LifecycleState::kInBackForwardCache); // Restore the cached page. WebContents()->GetController().GoBack(); EXPECT_TRUE(WaitForLoadStop(WebContents())); EXPECT_EQ(rfh.get(), WebContents()->GetMainFrame()); // Fill out and submit the password form. NavigationObserver observer(WebContents()); std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); // Save the password and check the store. BubbleObserver bubble_observer(WebContents()); EXPECT_TRUE(bubble_observer.IsSavePromptShownAutomatically()); bubble_observer.AcceptSavePrompt(); WaitForPasswordStore(); CheckThatCredentialsStored("temp", "random"); } // Test that if the credentials API is used, it makes the page ineligible for // caching in the BackForwardCache. // // See where BackForwardCache::DisableForRenderFrameHost is called in // chrome_password_manager_client.cc for explanation. IN_PROC_BROWSER_TEST_F(PasswordManagerBackForwardCacheBrowserTest, NotCachedIfCredentialsAPIUsed) { // Navigate to a page with a password form. NavigateToFile("/password/password_form.html"); content::RenderFrameHost* rfh = WebContents()->GetMainFrame(); content::RenderFrameDeletedObserver rfh_deleted_observer(rfh); // Use the password manager API, this should make the page uncacheable. EXPECT_TRUE(IsGetCredentialsSuccessful()); // Navigate away. EXPECT_TRUE(NavigateToURL( WebContents(), embedded_test_server()->GetURL("a.com", "/title1.html"))); // The page should not have been cached. rfh_deleted_observer.WaitUntilDeleted(); } IN_PROC_BROWSER_TEST_F(PasswordManagerBackForwardCacheBrowserTest, CredentialsAPIOnlyCalledOnRestoredPage) { // Navigate to a page with a password form. NavigateToFile("/password/password_form.html"); content::RenderFrameHostWrapper rfh(WebContents()->GetMainFrame()); // Navigate away. EXPECT_TRUE(NavigateToURL( WebContents(), embedded_test_server()->GetURL("b.com", "/title1.html"))); EXPECT_EQ(rfh->GetLifecycleState(), content::RenderFrameHost::LifecycleState::kInBackForwardCache); // Restore the cached page. WebContents()->GetController().GoBack(); EXPECT_TRUE(WaitForLoadStop(WebContents())); EXPECT_EQ(rfh.get(), WebContents()->GetMainFrame()); // Make sure the password manager API works. Since it was never connected, it // shouldn't have been affected by the // ContentCredentialManager::DisconnectBinding call in // ChromePasswordManagerClient::DidFinishNavigation, (this GetCredentials call // will establish the mojo connection for the first time). EXPECT_TRUE(IsGetCredentialsSuccessful()); } IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, DetectFormSubmissionOnIframe) { // Start from a page without a password form. NavigateToFile("/password/other.html"); // Add a blank iframe and then inject a password form into it. BubbleObserver prompt_observer(WebContents()); GURL current_url(embedded_test_server()->GetURL("/password/other.html")); GURL submit_url(embedded_test_server()->GetURL("/password/done.html")); InjectFrameWithPasswordForm(WebContents(), submit_url); content::RenderFrameHost* frame = ChildFrameAt(WebContents()->GetMainFrame(), 0); EXPECT_EQ(GURL(url::kAboutBlankURL), frame->GetLastCommittedURL()); EXPECT_EQ(submit_url.DeprecatedGetOriginAsURL(), frame->GetLastCommittedOrigin().GetURL()); EXPECT_TRUE(frame->IsRenderFrameLive()); EXPECT_FALSE(prompt_observer.IsSavePromptAvailable()); // Fill in the password and submit the form. This should bring up a save // password prompt and shouldn't result in a renderer kill. SubmitInjectedPasswordForm(WebContents(), frame, submit_url); EXPECT_TRUE(frame->IsRenderFrameLive()); EXPECT_TRUE(prompt_observer.IsSavePromptAvailable()); } #if BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) // This test suite only applies to Gaia signin page, and checks that the // signin interception bubble and the password bubbles never conflict. class PasswordManagerBrowserTestWithSigninInterception : public PasswordManagerBrowserTest { public: PasswordManagerBrowserTestWithSigninInterception() : helper_(&https_test_server()) {} void SetUpCommandLine(base::CommandLine* command_line) override { PasswordManagerBrowserTest::SetUpCommandLine(command_line); helper_.SetUpCommandLine(command_line); } void SetUpOnMainThread() override { helper_.SetUpOnMainThread(); PasswordManagerBrowserTest::SetUpOnMainThread(); } void FillAndSubmitGaiaPassword() { NavigationObserver observer(WebContents()); std::string fill_and_submit = base::StringPrintf( "document.getElementById('username_field').value = '%s';" "document.getElementById('password_field').value = 'new_pw';" "document.getElementById('input_submit_button').click()", helper_.gaia_username().c_str()); ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); } // Gaia passwords can only be saved if they are a secondary account. Add // another dummy account in Chrome that acts as the primary. void SetupAccountsForSavingGaiaPassword() { CoreAccountId dummy_account = helper_.AddGaiaAccountToProfile( browser()->profile(), "dummy_email@example.com", "dummy_gaia_id"); IdentityManagerFactory::GetForProfile(browser()->profile()) ->GetPrimaryAccountMutator() ->SetPrimaryAccount(dummy_account, signin::ConsentLevel::kSignin); } protected: PasswordManagerSigninInterceptTestHelper helper_; }; // Checks that password update suppresses signin interception. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestWithSigninInterception, InterceptionBubbleSuppressedByPasswordUpdate) { Profile* profile = browser()->profile(); helper_.SetupProfilesForInterception(profile); // Prepopulate Gaia credentials to trigger an update bubble. scoped_refptr<password_manager::TestPasswordStore> password_store = static_cast<password_manager::TestPasswordStore*>( PasswordStoreFactory::GetForProfile( profile, ServiceAccessType::IMPLICIT_ACCESS) .get()); helper_.StoreGaiaCredentials(password_store); helper_.NavigateToGaiaSigninPage(WebContents()); // The stored password "pw" was overridden with "new_pw", so update prompt is // expected. Use the retry form, to avoid autofill. BubbleObserver prompt_observer(WebContents()); NavigationObserver observer(WebContents()); std::string fill_and_submit = "document.getElementById('retry_password_field').value = 'new_pw';" "document.getElementById('retry_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); EXPECT_TRUE(prompt_observer.IsUpdatePromptShownAutomatically()); // Complete the Gaia signin. CoreAccountId account_id = helper_.AddGaiaAccountToProfile( profile, helper_.gaia_email(), helper_.gaia_id()); // Check that interception does not happen. base::HistogramTester histogram_tester; DiceWebSigninInterceptor* signin_interceptor = helper_.GetSigninInterceptor(profile); signin_interceptor->MaybeInterceptWebSignin(WebContents(), account_id, /*is_new_account=*/true, /*is_sync_signin=*/false); EXPECT_FALSE(signin_interceptor->is_interception_in_progress()); histogram_tester.ExpectUniqueSample( "Signin.Intercept.HeuristicOutcome", SigninInterceptionHeuristicOutcome::kAbortPasswordUpdate, 1); } // Checks that Gaia password can be saved when there is no interception. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestWithSigninInterception, SaveGaiaPassword) { SetupAccountsForSavingGaiaPassword(); helper_.NavigateToGaiaSigninPage(WebContents()); // Add the new password: triggers the save bubble. BubbleObserver prompt_observer(WebContents()); FillAndSubmitGaiaPassword(); EXPECT_TRUE(prompt_observer.IsSavePromptShownAutomatically()); // Complete the Gaia signin. Profile* profile = browser()->profile(); CoreAccountId account_id = helper_.AddGaiaAccountToProfile( profile, helper_.gaia_email(), helper_.gaia_id()); // Check that interception does not happen. base::HistogramTester histogram_tester; DiceWebSigninInterceptor* signin_interceptor = helper_.GetSigninInterceptor(profile); signin_interceptor->MaybeInterceptWebSignin(WebContents(), account_id, /*is_new_account=*/true, /*is_sync_signin=*/false); EXPECT_FALSE(signin_interceptor->is_interception_in_progress()); histogram_tester.ExpectUniqueSample( "Signin.Intercept.HeuristicOutcome", SigninInterceptionHeuristicOutcome::kAbortProfileCreationDisallowed, 1); } // Checks that signin interception suppresses password save, if the form is // processed before the signin completes. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestWithSigninInterception, SavePasswordSuppressedBeforeSignin) { Profile* profile = browser()->profile(); helper_.SetupProfilesForInterception(profile); SetupAccountsForSavingGaiaPassword(); helper_.NavigateToGaiaSigninPage(WebContents()); // Add the new password, password bubble not triggered. BubbleObserver prompt_observer(WebContents()); FillAndSubmitGaiaPassword(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); // Complete the Gaia signin. CoreAccountId account_id = helper_.AddGaiaAccountToProfile( profile, helper_.gaia_email(), helper_.gaia_id()); // Check that interception happens. base::HistogramTester histogram_tester; DiceWebSigninInterceptor* signin_interceptor = helper_.GetSigninInterceptor(profile); signin_interceptor->MaybeInterceptWebSignin(WebContents(), account_id, /*is_new_account=*/true, /*is_sync_signin=*/false); EXPECT_TRUE(signin_interceptor->is_interception_in_progress()); } // Checks that signin interception suppresses password save, if the form is // processed after the signin completes. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestWithSigninInterception, SavePasswordSuppressedAfterSignin) { Profile* profile = browser()->profile(); helper_.SetupProfilesForInterception(profile); SetupAccountsForSavingGaiaPassword(); helper_.NavigateToGaiaSigninPage(WebContents()); // Complete the Gaia signin. CoreAccountId account_id = helper_.AddGaiaAccountToProfile( profile, helper_.gaia_email(), helper_.gaia_id()); // Check that interception happens. base::HistogramTester histogram_tester; DiceWebSigninInterceptor* signin_interceptor = helper_.GetSigninInterceptor(profile); signin_interceptor->MaybeInterceptWebSignin(WebContents(), account_id, /*is_new_account=*/true, /*is_sync_signin=*/false); EXPECT_TRUE(signin_interceptor->is_interception_in_progress()); // Add the new password, password bubble not triggered. BubbleObserver prompt_observer(WebContents()); FillAndSubmitGaiaPassword(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } #endif // ENABLE_DICE_SUPPORT && !BUILDFLAG(IS_CHROMEOS_LACROS) class TestPasswordManagerClient : public ChromePasswordManagerClient { public: static void CreateForWebContentsWithAutofillClient( content::WebContents* contents, autofill::AutofillClient* autofill_client) { if (FromWebContents(contents)) return; contents->SetUserData( UserDataKey(), std::make_unique<TestPasswordManagerClient>(contents, autofill_client)); } TestPasswordManagerClient(content::WebContents* web_contents, autofill::AutofillClient* autofill_client) : ChromePasswordManagerClient(web_contents, autofill_client) {} ~TestPasswordManagerClient() override = default; MOCK_METHOD(void, OnInputEvent, (const blink::WebInputEvent&), (override)); }; MATCHER_P(IsKeyEvent, type, std::string()) { return arg.GetType() == type; } // This is for checking that we don't make unexpected calls to the password // manager driver prior to activation and to permit checking that expected calls // do happen after activation. class MockPrerenderPasswordManagerDriver : public autofill::mojom::PasswordManagerDriverInterceptorForTesting { public: explicit MockPrerenderPasswordManagerDriver( password_manager::ContentPasswordManagerDriver* driver) : impl_(driver->ReceiverForTesting().SwapImplForTesting(this)) { DelegateToImpl(); } MockPrerenderPasswordManagerDriver( const MockPrerenderPasswordManagerDriver&) = delete; MockPrerenderPasswordManagerDriver& operator=( const MockPrerenderPasswordManagerDriver&) = delete; ~MockPrerenderPasswordManagerDriver() override = default; autofill::mojom::PasswordManagerDriver* GetForwardingInterface() override { return impl_; } // autofill::mojom::PasswordManagerDriver MOCK_METHOD(void, PasswordFormsParsed, (const std::vector<autofill::FormData>& form_data), (override)); MOCK_METHOD(void, PasswordFormsRendered, (const std::vector<autofill::FormData>& visible_form_data, bool load_completed), (override)); MOCK_METHOD(void, PasswordFormSubmitted, (const autofill::FormData& form_data), (override)); MOCK_METHOD(void, InformAboutUserInput, (const autofill::FormData& form_data), (override)); MOCK_METHOD( void, DynamicFormSubmission, (autofill::mojom::SubmissionIndicatorEvent submission_indication_event), (override)); MOCK_METHOD(void, PasswordFormCleared, (const autofill::FormData& form_Data), (override)); MOCK_METHOD(void, RecordSavePasswordProgress, (const std::string& log), (override)); MOCK_METHOD(void, UserModifiedPasswordField, (), (override)); MOCK_METHOD(void, UserModifiedNonPasswordField, (autofill::FieldRendererId renderer_id, const std::u16string& field_name, const std::u16string& value), (override)); MOCK_METHOD(void, ShowPasswordSuggestions, (base::i18n::TextDirection text_direction, const std::u16string& typed_username, int options, const gfx::RectF& bounds), (override)); MOCK_METHOD(void, ShowTouchToFill, (), (override)); MOCK_METHOD(void, CheckSafeBrowsingReputation, (const GURL& form_action, const GURL& frame_url), (override)); MOCK_METHOD(void, FocusedInputChanged, (autofill::FieldRendererId focused_field_id, autofill::mojom::FocusedFieldType focused_field_type), (override)); MOCK_METHOD(void, LogFirstFillingResult, (autofill::FormRendererId form_renderer_id, int32_t result), (override)); void DelegateToImpl() { ON_CALL(*this, PasswordFormsParsed) .WillByDefault( [this](const std::vector<autofill::FormData>& form_data) { impl_->PasswordFormsParsed(form_data); RemoveWaitType(WAIT_FOR_PASSWORD_FORMS::WAIT_FOR_PARSED); }); ON_CALL(*this, PasswordFormsRendered) .WillByDefault( [this](const std::vector<autofill::FormData>& visible_form_data, bool load_completed) { impl_->PasswordFormsRendered(visible_form_data, load_completed); RemoveWaitType(WAIT_FOR_PASSWORD_FORMS::WAIT_FOR_RENDERED); }); ON_CALL(*this, PasswordFormSubmitted) .WillByDefault([this](const autofill::FormData& form_data) { impl_->PasswordFormSubmitted(form_data); }); ON_CALL(*this, InformAboutUserInput) .WillByDefault([this](const autofill::FormData& form_data) { impl_->InformAboutUserInput(form_data); }); ON_CALL(*this, DynamicFormSubmission) .WillByDefault([this](autofill::mojom::SubmissionIndicatorEvent submission_indication_event) { impl_->DynamicFormSubmission(submission_indication_event); }); ON_CALL(*this, PasswordFormCleared) .WillByDefault([this](const autofill::FormData& form_Data) { impl_->PasswordFormCleared(form_Data); }); ON_CALL(*this, RecordSavePasswordProgress) .WillByDefault([this](const std::string& log) { impl_->RecordSavePasswordProgress(log); }); ON_CALL(*this, UserModifiedPasswordField).WillByDefault([this]() { impl_->UserModifiedPasswordField(); }); ON_CALL(*this, UserModifiedNonPasswordField) .WillByDefault([this](autofill::FieldRendererId renderer_id, const std::u16string& field_name, const std::u16string& value) { impl_->UserModifiedNonPasswordField(renderer_id, field_name, value); }); ON_CALL(*this, ShowPasswordSuggestions) .WillByDefault([this](base::i18n::TextDirection text_direction, const std::u16string& typed_username, int options, const gfx::RectF& bounds) { impl_->ShowPasswordSuggestions(text_direction, typed_username, options, bounds); }); ON_CALL(*this, ShowTouchToFill).WillByDefault([this]() { impl_->ShowTouchToFill(); }); ON_CALL(*this, CheckSafeBrowsingReputation) .WillByDefault([this](const GURL& form_action, const GURL& frame_url) { impl_->CheckSafeBrowsingReputation(form_action, frame_url); }); ON_CALL(*this, FocusedInputChanged) .WillByDefault( [this](autofill::FieldRendererId focused_field_id, autofill::mojom::FocusedFieldType focused_field_type) { impl_->FocusedInputChanged(focused_field_id, focused_field_type); }); ON_CALL(*this, LogFirstFillingResult) .WillByDefault( [this](autofill::FormRendererId form_renderer_id, int32_t result) { impl_->LogFirstFillingResult(form_renderer_id, result); }); } void WaitForPasswordFormParsedAndRendered() { base::RunLoop run_loop; quit_closure_ = run_loop.QuitClosure(); wait_type_ = WAIT_FOR_PASSWORD_FORMS::WAIT_FOR_PARSED | WAIT_FOR_PASSWORD_FORMS::WAIT_FOR_RENDERED; run_loop.Run(); } private: enum WAIT_FOR_PASSWORD_FORMS { WAIT_FOR_NOTHING = 0, WAIT_FOR_PARSED = 1 << 0, // Waits for PasswordFormsParsed(). WAIT_FOR_RENDERED = 1 << 1, // Waits for PasswordFormsRendered(). }; void RemoveWaitType(uint32_t arrived) { wait_type_ &= ~arrived; if (wait_type_ == WAIT_FOR_NOTHING && quit_closure_) std::move(quit_closure_).Run(); } base::OnceClosure quit_closure_; uint32_t wait_type_ = WAIT_FOR_NOTHING; autofill::mojom::PasswordManagerDriver* impl_ = nullptr; }; class MockPrerenderPasswordManagerDriverInjector : public content::WebContentsObserver { public: explicit MockPrerenderPasswordManagerDriverInjector( content::WebContents* web_contents) : WebContentsObserver(web_contents) {} ~MockPrerenderPasswordManagerDriverInjector() override = default; MockPrerenderPasswordManagerDriver* GetMockForFrame( content::RenderFrameHost* rfh) { return static_cast<MockPrerenderPasswordManagerDriver*>( GetDriverForFrame(rfh)->ReceiverForTesting().impl()); } private: password_manager::ContentPasswordManagerDriver* GetDriverForFrame( content::RenderFrameHost* rfh) { password_manager::ContentPasswordManagerDriverFactory* driver_factory = password_manager::ContentPasswordManagerDriverFactory::FromWebContents( web_contents()); return driver_factory->GetDriverForFrame(rfh); } // content::WebContentsObserver: void ReadyToCommitNavigation( content::NavigationHandle* navigation_handle) override { auto* rfh = navigation_handle->GetRenderFrameHost(); if (navigation_handle->IsPrerenderedPageActivation() || navigation_handle->IsSameDocument() || rfh->GetLifecycleState() != content::RenderFrameHost::LifecycleState::kPrerendering) { return; } mocks_.push_back(std::make_unique< testing::StrictMock<MockPrerenderPasswordManagerDriver>>( GetDriverForFrame(navigation_handle->GetRenderFrameHost()))); } std::vector< std::unique_ptr<testing::StrictMock<MockPrerenderPasswordManagerDriver>>> mocks_; }; class PasswordManagerPrerenderBrowserTest : public PasswordManagerBrowserTest { public: PasswordManagerPrerenderBrowserTest() : prerender_helper_(base::BindRepeating( &PasswordManagerPrerenderBrowserTest::web_contents, base::Unretained(this))) {} ~PasswordManagerPrerenderBrowserTest() override = default; void SetUp() override { prerender_helper_.SetUp(embedded_test_server()); PasswordManagerBrowserTest::SetUp(); } void SetUpOnMainThread() override { // Register requests handler before the server is started. embedded_test_server()->RegisterRequestHandler( base::BindRepeating(&HandleTestAuthRequest)); PasswordManagerBrowserTest::SetUpOnMainThread(); } content::test::PrerenderTestHelper* prerender_helper() { return &prerender_helper_; } void SendKey(::ui::KeyboardCode key, content::RenderFrameHost* render_frame_host) { blink::WebKeyboardEvent web_event( blink::WebKeyboardEvent::Type::kRawKeyDown, blink::WebInputEvent::kNoModifiers, blink::WebInputEvent::GetStaticTimeStampForTests()); content::NativeWebKeyboardEvent event(web_event, gfx::NativeView()); event.windows_key_code = key; render_frame_host->GetRenderWidgetHost()->ForwardKeyboardEvent(event); } // Adds a tab with TestPasswordManagerClient which is a customized // ChromePasswordManagerClient. // Note that it doesn't use CustomManagePasswordsUIController and it's not // useful to test UI. After calling this, // PasswordManagerBrowserTest::WebContents() is not available. void GetNewTabWithTestPasswordManagerClient() { content::WebContents* preexisting_tab = browser()->tab_strip_model()->GetActiveWebContents(); std::unique_ptr<content::WebContents> owned_web_contents = content::WebContents::Create( content::WebContents::CreateParams(browser()->profile())); ASSERT_TRUE(owned_web_contents.get()); // ManagePasswordsUIController needs ChromePasswordManagerClient for // logging. autofill::ChromeAutofillClient::CreateForWebContents( owned_web_contents.get()); TestPasswordManagerClient::CreateForWebContentsWithAutofillClient( owned_web_contents.get(), autofill::ChromeAutofillClient::FromWebContents( owned_web_contents.get())); ASSERT_TRUE( ChromePasswordManagerClient::FromWebContents(owned_web_contents.get())); ManagePasswordsUIController::CreateForWebContents(owned_web_contents.get()); ASSERT_TRUE( ManagePasswordsUIController::FromWebContents(owned_web_contents.get())); ASSERT_FALSE(owned_web_contents.get()->IsLoading()); browser()->tab_strip_model()->AppendWebContents( std::move(owned_web_contents), true); if (preexisting_tab) { browser()->tab_strip_model()->CloseWebContentsAt( 0, TabStripModel::CLOSE_NONE); } } content::WebContents* web_contents() { return browser()->tab_strip_model()->GetActiveWebContents(); } private: content::test::PrerenderTestHelper prerender_helper_; }; // Tests that the prerender doesn't proceed HTTP auth login and once the page // is loaded as the primary page the prompt is shown. As the page is // not loaded from the prerender, it also checks if it's not activated from the // prerender. IN_PROC_BROWSER_TEST_F(PasswordManagerPrerenderBrowserTest, ChromePasswordManagerClientInPrerender) { content::NavigationController* nav_controller = &WebContents()->GetController(); LoginPromptBrowserTestObserver login_observer; login_observer.Register( content::Source<content::NavigationController>(nav_controller)); MockPrerenderPasswordManagerDriverInjector injector(WebContents()); GURL url = embedded_test_server()->GetURL("/empty.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::test::PrerenderHostRegistryObserver registry_observer( *WebContents()); auto prerender_url = embedded_test_server()->GetURL("/basic_auth"); // Loads a page requiring HTTP auth in the prerender. prerender_helper()->AddPrerenderAsync(prerender_url); // Ensure that the prerender has started. registry_observer.WaitForTrigger(prerender_url); auto prerender_id = prerender_helper()->GetHostForUrl(prerender_url); EXPECT_NE(content::RenderFrameHost::kNoFrameTreeNodeId, prerender_id); content::test::PrerenderHostObserver host_observer(*WebContents(), prerender_id); // PrerenderHost is destroyed by net::INVALID_AUTH_CREDENTIALS and it stops // prerendering. host_observer.WaitForDestroyed(); BubbleObserver bubble_observer(WebContents()); EXPECT_FALSE(bubble_observer.IsSavePromptShownAutomatically()); WindowedAuthNeededObserver auth_needed_observer(nav_controller); // Navigates the primary page to the URL. prerender_helper()->NavigatePrimaryPage(prerender_url); auth_needed_observer.Wait(); NavigationObserver nav_observer(WebContents()); WindowedAuthSuppliedObserver auth_supplied_observer(nav_controller); // Offer valid credentials on the auth challenge. EXPECT_EQ(1u, login_observer.handlers().size()); LoginHandler* handler = *login_observer.handlers().begin(); EXPECT_TRUE(handler); // Any username/password will work. handler->SetAuth(u"user", u"pwd"); auth_supplied_observer.Wait(); // The password manager should be working correctly. nav_observer.Wait(); WaitForPasswordStore(); EXPECT_TRUE(bubble_observer.IsSavePromptShownAutomatically()); // Make sure that the prerender was not activated. EXPECT_FALSE(host_observer.was_activated()); } // Tests that saving password doesn't work in the prerendering. IN_PROC_BROWSER_TEST_F(PasswordManagerPrerenderBrowserTest, SavePasswordInPrerender) { MockPrerenderPasswordManagerDriverInjector injector(WebContents()); GURL url = embedded_test_server()->GetURL("/empty.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); auto prerender_url = embedded_test_server()->GetURL("/password/password_form.html"); // Loads a page in the prerender. int host_id = prerender_helper()->AddPrerender(prerender_url); content::test::PrerenderHostObserver host_observer(*WebContents(), host_id); content::RenderFrameHost* render_frame_host = prerender_helper()->GetPrerenderedMainFrameHost(host_id); // Fills a form and submits through a <input type="submit"> button. std::string fill_and_submit = "document.getElementById('username_field').value = 'temp';" "document.getElementById('password_field').value = 'random';" "document.getElementById('input_submit_button').click()"; ASSERT_TRUE(content::ExecuteScript(render_frame_host, fill_and_submit)); // Since navigation from a prerendering page is disallowed, prerendering is // canceled. This also means that we should never make any calls to the mocked // driver. Since we've already set an expectation of no calls, this will be // checked implicitly when the injector (and consequently, the mock) is // destroyed. host_observer.WaitForDestroyed(); BubbleObserver bubble_observer(WebContents()); EXPECT_FALSE(bubble_observer.IsSavePromptShownAutomatically()); // Navigates the primary page to the URL. prerender_helper()->NavigatePrimaryPage(prerender_url); // Makes sure that the page is not from the prerendering. EXPECT_FALSE(host_observer.was_activated()); // After loading the primary page, try to submit the password. NavigationObserver observer(WebContents()); ASSERT_TRUE(content::ExecuteScript(WebContents(), fill_and_submit)); observer.Wait(); // Saves the password and checks the store. EXPECT_TRUE(bubble_observer.IsSavePromptShownAutomatically()); bubble_observer.AcceptSavePrompt(); WaitForPasswordStore(); CheckThatCredentialsStored("temp", "random"); } // Tests that it defers to bind mojom::CredentialManager in the prerendering. IN_PROC_BROWSER_TEST_F(PasswordManagerPrerenderBrowserTest, BindCredentialManagerInPrerender) { MockPrerenderPasswordManagerDriverInjector injector(WebContents()); GURL url = embedded_test_server()->GetURL("/empty.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); auto prerender_url = embedded_test_server()->GetURL("/password/credentials.html"); // Loads a page in the prerender. int host_id = prerender_helper()->AddPrerender(prerender_url); content::test::PrerenderHostObserver host_observer(*WebContents(), host_id); // It should not have binding mojom::CredentialManager. EXPECT_FALSE(ChromePasswordManagerClient::FromWebContents(WebContents()) ->has_binding_for_credential_manager()); // Navigates the primary page to the URL. prerender_helper()->NavigatePrimaryPage(prerender_url); // Waits until credentials.get() is handled. base::RunLoop().RunUntilIdle(); // Make sure that the prerender was activated. EXPECT_TRUE(host_observer.was_activated()); // After the page is activated, it gets binding mojom::CredentialManager. EXPECT_TRUE(ChromePasswordManagerClient::FromWebContents(WebContents()) ->has_binding_for_credential_manager()); } // Tests that RenderWidgetHost::InputEventObserver is updated with the // RenderFrameHost that NavigationHandle has when the RenderFrameHost is // activated from the prerendering. IN_PROC_BROWSER_TEST_F(PasswordManagerPrerenderBrowserTest, InputWorksAfterPrerenderActivation) { GetNewTabWithTestPasswordManagerClient(); GURL url = embedded_test_server()->GetURL("/empty.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); auto prerender_url = embedded_test_server()->GetURL("/password/password_form.html"); // Loads a page in the prerender. int host_id = prerender_helper()->AddPrerender(prerender_url); content::test::PrerenderHostObserver host_observer(*web_contents(), host_id); content::RenderFrameHost* render_frame_host = prerender_helper()->GetPrerenderedMainFrameHost(host_id); // Navigates the primary page to the URL. prerender_helper()->NavigatePrimaryPage(prerender_url); // Makes sure that the page is activated from the prerendering. EXPECT_TRUE(host_observer.was_activated()); base::RunLoop().RunUntilIdle(); // Sets to ignore mouse events. Otherwise, OnInputEvent() could be called // multiple times if the mouse cursor is over on the test window during // testing. web_contents()->GetMainFrame()->GetRenderWidgetHost()->AddMouseEventCallback( base::BindRepeating( [](const blink::WebMouseEvent& event) { return true; })); EXPECT_CALL( *static_cast<TestPasswordManagerClient*>( ChromePasswordManagerClient::FromWebContents(web_contents())), OnInputEvent(IsKeyEvent(blink::WebInputEvent::Type::kRawKeyDown))); // Sends a key event. SendKey(::ui::VKEY_DOWN, render_frame_host); } // Tests that Mojo messages in prerendering are deferred from the render to // the PasswordManagerDriver until activation. IN_PROC_BROWSER_TEST_F(PasswordManagerPrerenderBrowserTest, MojoDeferringInPrerender) { GetNewTabWithTestPasswordManagerClient(); MockPrerenderPasswordManagerDriverInjector injector(web_contents()); GURL url = embedded_test_server()->GetURL("/empty.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); auto prerender_url = embedded_test_server()->GetURL("/password/password_form.html"); // Loads a page in the prerender. int host_id = prerender_helper()->AddPrerender(prerender_url); content::test::PrerenderHostObserver host_observer(*web_contents(), host_id); content::RenderFrameHost* render_frame_host = prerender_helper()->GetPrerenderedMainFrameHost(host_id); auto* mock = injector.GetMockForFrame(render_frame_host); testing::Mock::VerifyAndClearExpectations(mock); // We expect that messages will be sent to the driver, post-activation. EXPECT_CALL(*mock, PasswordFormsParsed).Times(1); EXPECT_CALL(*mock, PasswordFormsRendered).Times(1); // Navigates the primary page to the URL. prerender_helper()->NavigatePrimaryPage(prerender_url); // Makes sure that the page is activated from the prerendering. EXPECT_TRUE(host_observer.was_activated()); mock->WaitForPasswordFormParsedAndRendered(); } } // namespace } // namespace password_manager
# Please consider the following: # 1. This script needs to be changed in order to satisfy your html # please modify the @step(u'And I scroll (\d+) times to ensure data is loaded') # 2. This script is build to acomodate a page with multiple scrolling # elements and with eventually ajax loading # 3. In order to work, the opened browser page should be keep maximized # 4. The script is using a mouse over selenium method to perform scrolling # This method I have found it to give results closer to reality, as # ussualy people tend to scroll with the mouse weel, which eventually # has also a mouse over event (and also mouse out) from lettuce import before, world, step from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains import time import logging import numpy from perf_util import predefined from selenium.webdriver.chrome.options import Options @before.all def setup_(): logging.basicConfig(filename='perf.log',level=logging.INFO) @step(u'I have initial setup: ([^"]*)') def parse_params_of_argv(step, browser): #add here any other setup you want if (browser.lower() == "chrome"): logging.info("Start new test with Chrome") chromedriver = predefined['chromedriver'] options = webdriver.ChromeOptions() options.add_argument('--start-maximized') # next line it can be used together with setting the javascript # value of useHighAnimation to true, for debug purpose only # options.add_argument("--show-fps-counter=true") world.driver = webdriver.Chrome(executable_path = chromedriver, \ chrome_options = options) elif (browser.lower() == "firefox"): world.driver = webdriver.Firefox() world.driver.maximize_window() logging.info("Start new test with Firefox") else: logging.info("Unsupported browser: %s" % (browser)) raise Exception("Unsupported browser: %s" % (browser)) @step(u'I go to login page') def given_i_go_to_loginpage(step): world.driver.get(predefined['login_url']) @step(u'I fill in the credentials fields "([^"]*)" "([^"]*)"') def input_user(step, id1,id2): world.driver.execute_script('console.timeline()') el = world.driver.find_element_by_id(id1) el.send_keys(predefined[id1]) el = world.driver.find_element_by_id(id2) el.send_keys(predefined[id2]) @step(u'I submit') def submit_pass(step): button = world.driver.find_element_by_class_name("btn-red") button.click() world.driver.execute_script('window.focus();') # wait for the magic login cookie time.sleep(10) @step(u'I go to the check page') def submit_pass(step): world.driver.get(predefined['check_url']) world.driver.execute_script('window.focus();') # wait for all to load time.sleep(10) @step(u'I insert the fps javascript') def javascript_insert_pass(step): # insert the magic javascript with open(predefined['local_javascript_url']) as f: content = f.readlines() js = "".join(content) javascript = "\ var doc = window.document;\ var script = doc.createElement(\"script\");\ script.innerHTML=\"%s\";\ doc.body.appendChild(script);" % (js.strip()\ .replace('\t','').replace("\n", "").replace('"','\\"')) #logging.info("javascript = "+javascript) world.driver.execute_script(javascript) @step(u'I scroll (\d+) times to ensure data is loaded') def scroll(step, times): #perform initial scrolling for x in range(0, int(times)): for div in range (0,predefined['number_of_widgets']): world.driver.execute_script('document.getElementsByClassName\ ("mention-container-wrapper")[%d].getElementsByClassName("mentions")\ [0].getElementsByTagName("ul")[0].scrollTop = %d ' % (div,x * predefined['scroll_step'])) logging.info("scrolling widget: %d for %d time" % (div,x)) elems = [] #insert id on each element for easy retrieval for div in range (0,predefined['number_of_widgets']): elems.append(world.driver.execute_script('return document.\ getElementsByClassName("mention-container-wrapper")[%d].\ getElementsByClassName("mentions")[0].getElementsByTagName("ul")[0].\ children.length' % (div))) world.driver.execute_script('document.getElementsByClassName\ ("mention-container-wrapper")[%d].getElementsByClassName("mentions")\ [0].getElementsByTagName("ul")[0].id = "ul_scroll_%d"' % (div,div)) for li in range(0, elems[div]): world.driver.execute_script('document.getElementsByClassName\ ("mention-container-wrapper")[%d].getElementsByClassName("mentions")\ [0].getElementsByTagName("ul")[0].children[%d].id = "ul_scroll_%d_%d"' % (div,li,div,li)) logging.info("number of elements in widget[%d]: %d" % (div,elems[div])) #extract the elements we need to hover over li_hover = [] for div in range (0,predefined['number_of_widgets']): element_to_hover_over = world.driver.find_element_by_id("ul_scroll_%d" % (div)) li_hover.append([]) for li in range(0, elems[div]): element_to_hover_over = world.driver.find_element_by_id("ul_scroll_%d_%d" % (div,li)) li_hover[div].append(element_to_hover_over) world.elems = elems world.li_hover = li_hover @step(u'I scroll again to extract the fps values') def fps_values(step): elems = world.elems li_hover = world.li_hover sleep = 0 #start logging the fps values world.driver.execute_script('insertIntoFpsArr = true'); for div in range (0,predefined['number_of_widgets']): for li in range(0, elems[div]-1): ActionChains(world.driver).move_to_element(li_hover[div][li]).perform() # add a minimum sleep give time to perform # here is a trial mimic of a normal user which actualy has # a small pause between scrols sleep += 1 if sleep % 3 == 1: time.sleep(0.3) world.driver.execute_script('document.getElementsByClassName\ ("mention-container-wrapper")[%d].getElementsByClassName("mentions")\ [0].getElementsByTagName("ul")[0].scrollTop = document.getElementsByClassName\ ("mention-container-wrapper")[%d].getElementsByClassName("mentions")\ [0].getElementsByTagName("ul")[0].scrollTop + 20 ' % (div, div)) #read the fps values world.fps_values = world.driver.execute_script("return fps_arr") @step(u'the avarage fps valus should be over (\d+)') def avarage_lookup(step,avg): mean = numpy.mean(world.fps_values) std = numpy.std(world.fps_values) # std could be check to ensure we don't have a large spread data # but Firefox has a much larger value the Chrome for std logging.info("numpy mean: %s ,std: %s" % (mean,std)) logging.info("values are: %s " % (world.fps_values)) world.driver.close() assert mean > int(avg)
/* * This file is part of the Solid TX project. * * Copyright (c) 2015. sha1(OWNER) = df334a7237f10846a0ca302bd323e35ee1463931 * --> See LICENSE.txt for more information. * * @author BinaryBabel OSS (http://code.binbab.org) */ package net.minepass.api.gameserver.embed.solidtx.core.object; import java.util.HashMap; import java.util.Map; /** * Used by ObjectManager to cache initialized entities for reuse. * Entities are stored according to their class, and separated by * a provided entity id. */ public class ObjectCache { protected Map<Class,Map<String,Object>> cache; /** * Should only be created by ObjectManager. * @see ObjectManager */ protected ObjectCache() { cache = new HashMap<Class,Map<String,Object>>(); } /** * Add an entity to the cache. * * @param object the entity * @param id the entity id */ public void addObject(Object object, Comparable id) { Class klass = object.getClass(); cacheClassMap(klass).put(String.valueOf(id), object); } /** * Get an entity from the cache, based on class and id. * * Returns null on cache miss. * * @param objectClass the entity class * @param id the entity id * @return the entity or null */ public Object getObject(Class objectClass, Comparable id) { return cacheClassMap(objectClass).get(String.valueOf(id)); } /** * Remove an entity from the cache. * * @param object the entity * @param id the entity id */ public void removeObject(Object object, Comparable id) { Class klass = object.getClass(); removeObject(klass, id); } /** * Remove an entity from the class, based on class and id. * * @param objectClass the entity class * @param id the entity id */ public void removeObject(Class objectClass, Comparable id) { cacheClassMap(objectClass).remove(String.valueOf(id)); } /** * Check if cache contains matching entity. * * @param object the entity * @param id the entity id * @return true when entity in cache */ public boolean containsObject(Object object, Comparable id) { if (object != null && getObject(object.getClass(), id) == object) { return true; } else { return false; } } protected Map<String,Object> cacheClassMap(Class objectClass) { //TODO consistent map naming Map<String,Object> map; if ( ! cache.containsKey(objectClass)) { map = new HashMap<String, Object>(); cache.put(objectClass, map); } else { map = cache.get(objectClass); } return map; } }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.gearpump.experiments.storm.util import java.util.{List => JList} import scala.util.Random import backtype.storm.generated.GlobalStreamId import backtype.storm.grouping.CustomStreamGrouping import backtype.storm.task.TopologyContext import backtype.storm.tuple.Fields /** * Grouper is identical to that in storm but return gearpump partitions for storm tuple values */ sealed trait Grouper { /** * @param taskId storm task id of source task * @param values storm tuple values * @return a list of gearpump partitions */ def getPartitions(taskId: Int, values: JList[AnyRef]): Array[Int] } /** * GlobalGrouper always returns partition 0 */ class GlobalGrouper extends Grouper { override def getPartitions(taskId: Int, values: JList[AnyRef]): Array[Int] = Array(0) } /** * NoneGrouper randomly returns partition * * @param numTasks number of target tasks */ class NoneGrouper(numTasks: Int) extends Grouper { private val random = new Random override def getPartitions(taskId: Int, values: JList[AnyRef]): Array[Int] = { val partition = StormUtil.mod(random.nextInt, numTasks) Array(partition) } } /** * ShuffleGrouper shuffles partitions and returns them sequentially, and then shuffles again * * @param numTasks number of target tasks */ class ShuffleGrouper(numTasks: Int) extends Grouper { private val random = new Random private var index = -1 private var partitions = List.empty[Int] override def getPartitions(taskId: Int, values: JList[AnyRef]): Array[Int] = { index += 1 if (partitions.isEmpty) { partitions = 0.until(numTasks).toList partitions = random.shuffle(partitions) } else if (index >= numTasks) { index = 0 partitions = random.shuffle(partitions) } Array(partitions(index)) } } /** * FieldsGrouper returns partition based on value of groupFields * * @param outFields declared output fields of source task * @param groupFields grouping fields of target tasks * @param numTasks number of target tasks */ class FieldsGrouper(outFields: Fields, groupFields: Fields, numTasks: Int) extends Grouper { override def getPartitions(taskId: Int, values: JList[AnyRef]): Array[Int] = { val hash = outFields.select(groupFields, values).hashCode() val partition = StormUtil.mod(hash, numTasks) Array(partition) } } /** * AllGrouper returns all partitions * * @param numTasks number of target tasks */ class AllGrouper(numTasks: Int) extends Grouper { val partitions = (0 until numTasks).toArray override def getPartitions(taskId: Int, values: JList[AnyRef]): Array[Int] = { partitions } } /** * CustomGrouper allows users to specify grouping strategy * * @param grouping see [[backtype.storm.grouping.CustomStreamGrouping]] */ class CustomGrouper(grouping: CustomStreamGrouping) extends Grouper { def prepare( topologyContext: TopologyContext, globalStreamId: GlobalStreamId, targetTasks: JList[Integer]) : Unit = { grouping.prepare(topologyContext, globalStreamId, targetTasks) } override def getPartitions(taskId: Int, values: JList[AnyRef]): Array[Int] = { val tasks = grouping.chooseTasks(taskId, values) val result = new Array[Int](tasks.size()) val iter = tasks.iterator() var index = 0 while (iter.hasNext()) { val value = iter.next() result(index) = StormUtil.stormTaskIdToGearpump(value).index index += 1 } result } }
# frozen_string_literal: true RSpec.describe Surrealist::ExceptionRaiser do describe '.raise_invalid_key!' do let(:backtrace) { %w[a b c] } it 'preserves exception backtrace and displays correct message' do raise NoMethodError, 'my error message', backtrace rescue NoMethodError => e begin described_class.raise_invalid_key!(e) rescue Surrealist::UndefinedMethodError => e expect(e.message).to eq( "my error message. " \ "You have probably defined a key " \ "in the schema that doesn't have a corresponding method.", ) expect(e.backtrace).to eq(backtrace) end end end end
<?php use Stillat\Common\Collections\ExtendedCollection as Collection; class CollectionTest extends PHPUnit_Framework_TestCase { protected $testCollectionArray = array('1st' => 'Element', '2nd' => 'Element', '3rd' => 'Element'); protected $testCollectionNewValue = array('new' => 'value'); public function testAddAfter() { $collection = new Collection($this->testCollectionArray); $collection->addAfter('2nd', $this->testCollectionNewValue); $this->assertCount(4, $collection); $value = array_slice($collection->toArray(), 2, 1, true); $this->assertEquals(true, ($value === $this->testCollectionNewValue)); } public function testAddBefore() { $collection = new Collection($this->testCollectionArray); $collection->addBefore('2nd', $this->testCollectionNewValue); $this->assertCount(4, $collection); $value = array_slice($collection->toArray(), 1, 1, true); $this->assertEquals(true, ($value === $this->testCollectionNewValue)); } /** * @expectedException \Stillat\Common\Exceptions\Argument\InvalidArgumentException */ public function testInsertAfterThrowsExceptionWhenKeyDoesntExist() { $collection = new Collection($this->testCollectionArray); $collection->addAfter('nonexistent', $this->testCollectionNewValue); } /** * @expectedException \Stillat\Common\Exceptions\Argument\InvalidArgumentException */ public function testInsertBeforeThrowsExceptionWhenKeyDoesntExist() { $collection = new Collection($this->testCollectionArray); $collection->addBefore('nonexistent', $this->testCollectionNewValue); } }
<?php namespace GarageManager; use GarageManager\Vehicle\Car; use GarageManager\Vehicle\Bike; abstract class Helper { // Create garage public static function createGarage() { return new Garage(); } // Get interface type private static function getSapiType() { $sapiType = php_sapi_name(); switch ($sapiType) { case 'cli': case 'cli-server': return 'cli'; break; case 'apache': case 'apache2filter': case 'apache2handler': case 'fpm-fcgi': return 'browser'; break; default: return null; } } // Get name of file private static function getFileName() { switch (Helper::getSapiType()) { case 'cli': if ($GLOBALS['_SERVER']['argc'] == 2) { return trim($GLOBALS['_SERVER']['argv'][1]); } break; case 'browser': if (isset($_GET['file'])) { return trim($_GET['file']); } break; } return null; } // Creates Vehicles. Primary source: XML, Secondary: JSON public static function createVehicles() { $file = explode('.', Helper::getFileName()); $extension = strtolower($file[1]); switch ($extension) { case 'xml': return Helper::createVehiclesXML(Helper::getFileName()); break; case 'json': return Helper::createVehiclesJSON(Helper::getFileName()); break; default: return null; } } // Create array of Vehicles from XML file private static function createVehiclesXML($file) { $vehicleArray =[]; $xml = simplexml_load_file($file); $temp = json_decode(json_encode($xml), true); foreach ($temp['vehicle'] as &$vehicle) { // Casting values foreach ($vehicle['status']['tires']['tire'] as &$tire) { $tire = (float) $tire; } foreach ($vehicle['status']['engine'] as &$engine) { $engine = (int) $engine; } foreach ($vehicle['status']['break']['discs']['disc'] as &$breakDisc) { $breakDisc = (int) $breakDisc; } $vehicle['status']['break']['oil'] = (int) $vehicle['status']['break']['oil']; $vehicle['status']['steering'] = (int) $vehicle['status']['steering']; $vehicle['status']['exhaust'] = (int) $vehicle['status']['exhaust']; // Removing extra levels array_splice($vehicle['status']['tires'], 0, 1, $vehicle['status']['tires']['tire']); array_splice($vehicle['status']['break']['discs'], 0, 1, $vehicle['status']['break']['discs']['disc']); } $temp = $temp['vehicle']; //var_dump($temp); foreach ($temp as $v) { if ($v['type'] == 'car') { $vehicleArray[] = new Car($v); } elseif ($v['type'] == 'bike') { $vehicleArray[] = new Bike($v); } } return $vehicleArray; } // Create array of Vehicles from JSON file private static function createVehiclesJSON($file) { $vehicleArray = []; $json = file_get_contents($file); $json = json_decode($json, true); foreach ($json as $v) { if ($v['type'] == 'car') { $vehicleArray[] = new Car($v); } elseif ($v['type'] == 'bike') { $vehicleArray[] = new Bike($v); } } return $vehicleArray; } /* * DEPRECATED : Create array of Vehicles from XML file * * private static function createVehiclesXML ($file) { $vehicleArray = []; $temp = simplexml_load_string(file_get_contents($file), 'SimpleXMLElement', LIBXML_NOCDATA); $xml = json_decode(json_encode($temp), TRUE); $xml = $xml['vehicle']; foreach ($xml as $v) { if ($v['type'] == 'car') { $vehicleArray[] = new Car($v); } elseif($v['type'] == 'bike') { $vehicleArray[] = new Bike($v); } } return $vehicleArray; }*/ }
/* * Copyright 2006-2011 The Kuali Foundation * Licensed under the Educational Community License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.opensource.org/licenses/ecl2.php * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kuali.rice.core.api.util; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.builder.HashCodeBuilder; import java.lang.reflect.Field; import java.util.Calendar; /** * Class of static utility methods used to aid in the generation of hashcode values and equals comparisons of objects * for corner cases that EqualsBuilder and HashCodeBuilder of commons-lang cannot cover. */ public final class EqualsAndHashCodeUtils { private EqualsAndHashCodeUtils(){ throw new UnsupportedOperationException("do not call"); } /** * This method provides an equals comparison of two objects by evaluating the results of compareTo across specified * internal fields of the class of the two objects being compared. * <p/> * This method should be used where evaluating equality on fields of two instances of type T using .equals() yields * false, but for the purposes of determining equality of the two instances of type T, should be true. An example * is where a class has internal fields of type Calendar that need equality determined using only its time value * and not other internal fields of Calendar. * * @param o1 The first object used in an equality operation using compareTo * @param o2 The second object used in an equality operation using compareTo * @param fieldNames All field names within type T that should be determined equal or not using compareTo * @param <T> Type of both o1 and o2 parameters. Guarantees both o1 and o2 are the same reference type. * @return true if (o1.field.compareTo(o2.field) == 0) is true for all passed in fieldNames. Otherwise false * is returned. False is also returned if any fields specified in fieldNames are not of type Comparable or if one * (but not both) of the passed in objects are null references. */ public static <T> boolean equalsUsingCompareToOnFields(T o1, T o2, String... fieldNames) { if (o1 == o2) { return true; } if (o1 == null || o2 == null) { return false; } boolean isEqual = true; Class<?> targetClass = o1.getClass(); try { for (String fieldName : fieldNames) { Field field = targetClass.getDeclaredField(fieldName); field.setAccessible(true); Class<?> fieldClass = field.getType(); if (ArrayUtils.contains(fieldClass.getInterfaces(), Comparable.class)) { @SuppressWarnings("unchecked") Comparable<Object> c1 = (Comparable<Object>) field.get(o1); @SuppressWarnings("unchecked") Comparable<Object> c2 = (Comparable<Object>) field.get(o2); if (c1 == c2) { continue; } if (c1 == null || c2 == null) { isEqual = false; } else { isEqual = (c1.compareTo(c2) == 0); } } else { isEqual = false; } if (!isEqual) { break; } } return isEqual; } catch (Exception e) { throw new RuntimeException(e); } } /** * Generates an int hashcode from all calendars passed in. This is a convenience method for hashcode methods * to call if they have to generate hashcodes from fields of type Calendar when those Calendar fields * have equality evaluated using compareTo and not equals within the equals method of the container class. * * @param calendars * @return int hashcode value generated by using the long value returned from each Calendar.getTimeInMillis() */ public static int hashCodeForCalendars(Calendar... calendars) { HashCodeBuilder hcb = new HashCodeBuilder(); for (Calendar calendar : calendars) { if (calendar != null) { hcb.append(calendar.getTimeInMillis()); } } return hcb.toHashCode(); } }
/* # Licensed Materials - Property of IBM # Copyright IBM Corp. 2015 */ package com.ibm.streamsx.topology.internal.streams; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.logging.Logger; import com.google.gson.JsonObject; import com.ibm.streamsx.topology.context.ContextProperties; import com.ibm.streamsx.topology.internal.process.ProcessOutputToLogger; public class InvokeSc { static final Logger trace = Util.STREAMS_LOGGER; private Set<File> toolkits = new HashSet<>(); private final boolean standalone; private final String namespace; private final String mainComposite; private final File applicationDir; private final String installDir; public InvokeSc(JsonObject deploy, boolean standalone, String namespace, String mainComposite, File applicationDir) throws URISyntaxException, IOException { super(); this.namespace = namespace; this.mainComposite = mainComposite; this.applicationDir = applicationDir; installDir = Util.getStreamsInstall(deploy, ContextProperties.COMPILE_INSTALL_DIR); // Version 4.2 onwards deprecates standalone compiler option // so don't use it to avoid warnings. if (Util.getStreamsInstall().equals(installDir)) { if (Util.versionAtLeast(4, 2, 0)) standalone = false; } else { // TODO: get version of compile install to be used } this.standalone = standalone; addFunctionalToolkit(); } public void addToolkit(File toolkitDir) throws IOException { toolkits.add(toolkitDir.getCanonicalFile()); } private void addFunctionalToolkit() throws URISyntaxException, IOException { URL location = getClass().getProtectionDomain().getCodeSource() .getLocation(); // Assumption it is at lib in the toolkit. // Allow overriding to support test debug in eclipse, // where the tkroot location relationship to this code isn't as // isn't as expected during normal execution. String tkRootPath = System.getProperty( "com.ibm.streamsx.topology.invokeSc.functionalTkRoot"); if (tkRootPath!=null) { File tkRoot = new File(tkRootPath); addToolkit(tkRoot); return; } Path functionaljar = Paths.get(location.toURI()); File tkRoot = functionaljar.getParent().getParent().toFile(); addToolkit(tkRoot); } public void invoke() throws Exception, InterruptedException { File sc = new File(installDir, "bin/sc"); List<String> commands = new ArrayList<>(); String mainCompositeName = namespace + "::" + mainComposite; commands.add(sc.getAbsolutePath()); commands.add("--rebuild-toolkits"); commands.add("--optimized-code-generation"); commands.add("--num-make-threads=4"); if (standalone) commands.add("--standalone"); commands.add("-M"); commands.add(mainCompositeName); commands.add("-t"); commands.add(getToolkitPath()); trace.info("Invoking SPL compiler (sc) for main composite: " + mainCompositeName); trace.info(Util.concatenate(commands)); ProcessBuilder pb = new ProcessBuilder(commands); // Force the SPL application to use the Java provided by // Streams to ensure the bundle is not dependent on the // local JVM install path. pb.environment().remove("JAVA_HOME"); // Set STREAMS_INSTALL in case it was overriden for compilation pb.environment().put("STREAMS_INSTALL", installDir); // Ensure than only the toolkit path set by -t is used. pb.environment().remove("STREAMS_SPLPATH"); pb.directory(applicationDir); Process scProcess = pb.start(); ProcessOutputToLogger.log(trace, scProcess); scProcess.getOutputStream().close(); int rc = scProcess.waitFor(); trace.info("SPL compiler complete: return code=" + rc); if (rc != 0) throw new Exception("SPL compilation failed!"); } private String getToolkitPath() { StringBuilder sb = new StringBuilder(); boolean first = true; for (File tk : toolkits) { if (!first) sb.append(":"); else first = false; sb.append(tk.getAbsolutePath()); } String splPath = System.getenv("STREAMS_SPLPATH"); if (splPath != null) { sb.append(":"); sb.append(splPath); } String streamsInstallToolkits = installDir + "/toolkits"; if (sb.indexOf(streamsInstallToolkits) == -1) { sb.append(":"); sb.append(streamsInstallToolkits); } trace.info("ToolkitPath:" + sb.toString()); return sb.toString(); } }
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.simpleemail.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.Request; import com.amazonaws.DefaultRequest; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.simpleemail.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.util.StringUtils; /** * UpdateReceiptRuleRequest Marshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class UpdateReceiptRuleRequestMarshaller implements Marshaller<Request<UpdateReceiptRuleRequest>, UpdateReceiptRuleRequest> { public Request<UpdateReceiptRuleRequest> marshall(UpdateReceiptRuleRequest updateReceiptRuleRequest) { if (updateReceiptRuleRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<UpdateReceiptRuleRequest> request = new DefaultRequest<UpdateReceiptRuleRequest>(updateReceiptRuleRequest, "AmazonSimpleEmailService"); request.addParameter("Action", "UpdateReceiptRule"); request.addParameter("Version", "2010-12-01"); request.setHttpMethod(HttpMethodName.POST); if (updateReceiptRuleRequest.getRuleSetName() != null) { request.addParameter("RuleSetName", StringUtils.fromString(updateReceiptRuleRequest.getRuleSetName())); } { ReceiptRule rule = updateReceiptRuleRequest.getRule(); if (rule != null) { if (rule.getName() != null) { request.addParameter("Rule.Name", StringUtils.fromString(rule.getName())); } if (rule.getEnabled() != null) { request.addParameter("Rule.Enabled", StringUtils.fromBoolean(rule.getEnabled())); } if (rule.getTlsPolicy() != null) { request.addParameter("Rule.TlsPolicy", StringUtils.fromString(rule.getTlsPolicy())); } if (!rule.getRecipients().isEmpty() || !((com.amazonaws.internal.SdkInternalList<String>) rule.getRecipients()).isAutoConstruct()) { com.amazonaws.internal.SdkInternalList<String> recipientsList = (com.amazonaws.internal.SdkInternalList<String>) rule.getRecipients(); int recipientsListIndex = 1; for (String recipientsListValue : recipientsList) { if (recipientsListValue != null) { request.addParameter("Rule.Recipients.member." + recipientsListIndex, StringUtils.fromString(recipientsListValue)); } recipientsListIndex++; } } if (!rule.getActions().isEmpty() || !((com.amazonaws.internal.SdkInternalList<ReceiptAction>) rule.getActions()).isAutoConstruct()) { com.amazonaws.internal.SdkInternalList<ReceiptAction> actionsList = (com.amazonaws.internal.SdkInternalList<ReceiptAction>) rule .getActions(); int actionsListIndex = 1; for (ReceiptAction actionsListValue : actionsList) { if (actionsListValue != null) { { S3Action s3Action = actionsListValue.getS3Action(); if (s3Action != null) { if (s3Action.getTopicArn() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".S3Action.TopicArn", StringUtils.fromString(s3Action.getTopicArn())); } if (s3Action.getBucketName() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".S3Action.BucketName", StringUtils.fromString(s3Action.getBucketName())); } if (s3Action.getObjectKeyPrefix() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".S3Action.ObjectKeyPrefix", StringUtils.fromString(s3Action.getObjectKeyPrefix())); } if (s3Action.getKmsKeyArn() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".S3Action.KmsKeyArn", StringUtils.fromString(s3Action.getKmsKeyArn())); } } } { BounceAction bounceAction = actionsListValue.getBounceAction(); if (bounceAction != null) { if (bounceAction.getTopicArn() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".BounceAction.TopicArn", StringUtils.fromString(bounceAction.getTopicArn())); } if (bounceAction.getSmtpReplyCode() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".BounceAction.SmtpReplyCode", StringUtils.fromString(bounceAction.getSmtpReplyCode())); } if (bounceAction.getStatusCode() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".BounceAction.StatusCode", StringUtils.fromString(bounceAction.getStatusCode())); } if (bounceAction.getMessage() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".BounceAction.Message", StringUtils.fromString(bounceAction.getMessage())); } if (bounceAction.getSender() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".BounceAction.Sender", StringUtils.fromString(bounceAction.getSender())); } } } { WorkmailAction workmailAction = actionsListValue.getWorkmailAction(); if (workmailAction != null) { if (workmailAction.getTopicArn() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".WorkmailAction.TopicArn", StringUtils.fromString(workmailAction.getTopicArn())); } if (workmailAction.getOrganizationArn() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".WorkmailAction.OrganizationArn", StringUtils.fromString(workmailAction.getOrganizationArn())); } } } { LambdaAction lambdaAction = actionsListValue.getLambdaAction(); if (lambdaAction != null) { if (lambdaAction.getTopicArn() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".LambdaAction.TopicArn", StringUtils.fromString(lambdaAction.getTopicArn())); } if (lambdaAction.getFunctionArn() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".LambdaAction.FunctionArn", StringUtils.fromString(lambdaAction.getFunctionArn())); } if (lambdaAction.getInvocationType() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".LambdaAction.InvocationType", StringUtils.fromString(lambdaAction.getInvocationType())); } } } { StopAction stopAction = actionsListValue.getStopAction(); if (stopAction != null) { if (stopAction.getScope() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".StopAction.Scope", StringUtils.fromString(stopAction.getScope())); } if (stopAction.getTopicArn() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".StopAction.TopicArn", StringUtils.fromString(stopAction.getTopicArn())); } } } { AddHeaderAction addHeaderAction = actionsListValue.getAddHeaderAction(); if (addHeaderAction != null) { if (addHeaderAction.getHeaderName() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".AddHeaderAction.HeaderName", StringUtils.fromString(addHeaderAction.getHeaderName())); } if (addHeaderAction.getHeaderValue() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".AddHeaderAction.HeaderValue", StringUtils.fromString(addHeaderAction.getHeaderValue())); } } } { SNSAction sNSAction = actionsListValue.getSNSAction(); if (sNSAction != null) { if (sNSAction.getTopicArn() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".SNSAction.TopicArn", StringUtils.fromString(sNSAction.getTopicArn())); } if (sNSAction.getEncoding() != null) { request.addParameter("Rule.Actions.member." + actionsListIndex + ".SNSAction.Encoding", StringUtils.fromString(sNSAction.getEncoding())); } } } } actionsListIndex++; } } if (rule.getScanEnabled() != null) { request.addParameter("Rule.ScanEnabled", StringUtils.fromBoolean(rule.getScanEnabled())); } } } return request; } }
import java.util.Comparator; /** * * @author Gui_jaci@yahoo.com.br <gui_jaci@yahoo.com.br> */ public class JogadorComparator implements Comparator<Jogador> { private final boolean psqAlf, psqCres; public JogadorComparator(){ psqAlf = false; psqCres = true; } public JogadorComparator(boolean psqAlf, boolean psqCres){ this.psqAlf = psqAlf; this.psqCres = psqCres; } @Override public int compare(Jogador o1, Jogador o2) { if(psqAlf) return (psqCres?1:-1)*compareNome(o1,o2); return (psqCres?1:-1)*compareNum(o1,o2); } public int compareNum(Jogador o1, Jogador o2){ if(o1.getNumber() == o2.getNumber()) { String nome1 = o1.getName(); String nome2 = o2.getName(); int length = nome1.length(); if(length > nome2.length()) length = nome2.length(); for(int i = 0; i < length; i++){ if(nome1.charAt(i) > nome2.charAt(i)) return 1; if(nome1.charAt(i) < nome2.charAt(i)) return -1; } if(nome1.length() < nome2.length()) return 1; if(nome1.length() > nome2.length()) return -1; return 0; } return o1.getNumber()-o2.getNumber(); } public int compareNome(Jogador o1, Jogador o2) { String nome1 = o1.getName(); String nome2 = o2.getName(); int length = nome1.length(); if(length > nome2.length()) length = nome2.length(); for(int i = 0; i < length; i++){ if(nome1.charAt(i) > nome2.charAt(i)) return 1; if(nome1.charAt(i) < nome2.charAt(i)) return -1; } if(nome1.length() < nome2.length()) return 1; if(nome1.length() > nome2.length()) return -1; if(o1.getNumber() != o2.getNumber()) return o1.getNumber()-o2.getNumber(); return 0; } }
Terraform Syntax Highlighting And Snippets ========================================== Basic support for Terraform's [custom .tf file type](http://www.terraform.io/docs/configuration/syntax.html), along with snippets for each of the basic Terraform resource types. ![screenshot](screenshot.png) Installation ------------ ### Using Package Control 1. Having [Package Control](https://packagecontrol.io/installation) installed 2. Open the palette by pressing `Ctrl+Shift+P` (Win, Linux) or `Cmd+Shift+P` (OS X). 3. Select _"Package Control: Install package"_ 4. Select _"Terraform"_ ### Manually 1. Open the Sublime Text Packages folder - OS X: `~/Library/Application Support/Sublime Text 3/Packages/` - Windows: `%APPDATA%/Sublime Text 3/Packages/` - Linux (Ubuntu/Debian): `~/.config/sublime-text-3/Packages/` 2. Clone this repo
<? /**[N]** * JIBAS Education Community * Jaringan Informasi Bersama Antar Sekolah * * @version: 3.8 (January 25, 2016) * @notes: JIBAS Education Community will be managed by Yayasan Indonesia Membaca (http://www.indonesiamembaca.net) * * Copyright (C) 2009 Yayasan Indonesia Membaca (http://www.indonesiamembaca.net) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License **[N]**/ ?> <? require_once('../include/sessionchecker.php'); require_once("../include/config.php"); require_once("../include/db_functions.php"); require_once("../include/common.php"); require_once("../include/compatibility.php"); require_once("../library/datearith.php"); if (!isset($_REQUEST['nip'])) { echo "DUP"; exit(); } $nip = $_REQUEST['nip']; $tahun = $_REQUEST['tahun']; $bulan = $_REQUEST['bulan']; $tanggal = $_REQUEST['tanggal']; OpenDb(); try { $sql = "SELECT COUNT(replid) FROM sklsdm.presensi WHERE nip = '$nip' AND tanggal = '$tahun-$bulan-$tanggal'"; $n = FetchSingleEx($sql); CloseDb(); if ($n == 0) echo "OK"; else echo "DUP"; http_response_code(200); } catch(DbException $dbe) { CloseDb(); http_response_code(500); echo $dbe->getMessage(); } catch(Exception $e) { CloseDb(); http_response_code(500); echo $e->getMessage(); } ?>
/* * Pixel Dungeon * Copyright (C) 2012-2014 Oleg Dolya * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> */ package com.ripped.pixeldungeon.actors.blobs; import com.ripped.pixeldungeon.Dungeon; import com.ripped.pixeldungeon.Journal; import com.ripped.pixeldungeon.Journal.Feature; import com.ripped.pixeldungeon.actors.hero.Hero; import com.ripped.pixeldungeon.items.Heap; import com.ripped.pixeldungeon.items.Item; import com.ripped.pixeldungeon.levels.Level; import com.ripped.pixeldungeon.levels.Terrain; import com.ripped.pixeldungeon.scenes.GameScene; import com.watabou.utils.Bundle; import com.watabou.utils.Random; public class WellWater extends Blob { protected int pos; @Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); for (int i=0; i < LENGTH; i++) { if (cur[i] > 0) { pos = i; break; } } } @Override protected void evolve() { volume = off[pos] = cur[pos]; if (Dungeon.visible[pos]) { if (this instanceof WaterOfAwareness) { Journal.add( Feature.WELL_OF_AWARENESS ); } else if (this instanceof WaterOfHealth) { Journal.add( Feature.WELL_OF_HEALTH ); } else if (this instanceof WaterOfTransmutation) { Journal.add( Feature.WELL_OF_TRANSMUTATION ); } } } protected boolean affect() { Heap heap; if (pos == Dungeon.hero.pos && affectHero( Dungeon.hero )) { volume = off[pos] = cur[pos] = 0; return true; } else if ((heap = Dungeon.level.heaps.get( pos )) != null) { Item oldItem = heap.peek(); Item newItem = affectItem( oldItem ); if (newItem != null) { if (newItem == oldItem) { } else if (oldItem.quantity() > 1) { oldItem.quantity( oldItem.quantity() - 1 ); heap.drop( newItem ); } else { heap.replace( oldItem, newItem ); } heap.sprite.link(); volume = off[pos] = cur[pos] = 0; return true; } else { int newPlace; do { newPlace = pos + Level.NEIGHBOURS8[Random.Int( 8 )]; } while (!Level.passable[newPlace] && !Level.avoid[newPlace]); Dungeon.level.drop( heap.pickUp(), newPlace ).sprite.drop( pos ); return false; } } else { return false; } } protected boolean affectHero( Hero hero ) { return false; } protected Item affectItem( Item item ) { return null; } @Override public void seed( int cell, int amount ) { cur[pos] = 0; pos = cell; volume = cur[pos] = amount; } public static void affectCell( int cell ) { Class<?>[] waters = {WaterOfHealth.class, WaterOfAwareness.class, WaterOfTransmutation.class}; for (Class<?>waterClass : waters) { WellWater water = (WellWater)Dungeon.level.blobs.get( waterClass ); if (water != null && water.volume > 0 && water.pos == cell && water.affect()) { Level.set( cell, Terrain.EMPTY_WELL ); GameScene.updateMap( cell ); return; } } } }
Webmaker Metrics =================================================== ## Introduction Crunching some Webmaker numbers and reporting on them. * Referral Dashboard for Engagement team to understand impact of marketing campaigns * Webmaker KPI dashboard for product team to understand impact of changes to the product ## Structure * `crunch.js` does the crunching of the raw data to produce the aggregates * `app.js` provides front-end routes to the aggregate data ## Data This app stores aggregate snapshots of data in a local database. The structure for this local data is automatically generated by sequelize. The models for this data are found in `lib/models.js`. This data is used for the front-end reporting. This app also analyzes data from a seperate `mofointegration` database. This database contains a nightly snapshot of the Webmaker databases from across the multiple webmaker apps and sites. This app has readonly access to a selection of Views on the mofointegration DB which expose the necessary data but not PII (email addresses are obfuscated). Modifying these views requires admin rights to the mofointegration database. ## About Webmaker Retention Metrics Webmaker stores an account creation date, and a last updated date. A user who is innactive one day, may then be `retained` the following day if they log back in. This means regularly daily snapshots of retention rate will report differently from a backdated analysis of the data, where periods of inactivity are hidden by the most recent activity. For daily tracking of 7 day retention rate, we are reporting on the % of users who joined 7-14 days prior to the snapshot date who were active (updatedAt) more than 7 days after their account creation. The same applies to 30 day retention, but we look at the users who signed up 30-37 days prior to the snapshot date. This model is consistent assuming daily snapshots. ## Initial setup * copy sample.env to .env * you will need a bunch of credentials - ask Adam / JP or others for these * Generate the local HTTPS key and cert as noted below * `npm install` * `bower install` ## Development ``` $ foreman run node crunch.js $ foreman run node crunch.js productKPIs #to run a particular function $ foreman run nodemon app.js ``` ## Notes ``` $ heroku config:set NODE_ENV=production ``` ## Utils * `/util/crunch7daysProduct` ## Google Analytics Auth * Visit this path `https://localhost:8888/ga/auth` (or the production equivilent) * Login using the LOCAL_AUTH_USERNAME and LOCAL_AUTH_PASSWORD set in the env * Authenticate with a Google Account that has access to the Webmaker GA profile * This app will store a token so it can continue to talk to GA using your GA account after you finish your session ### GA API settings * Configured here: https://code.google.com/apis/console * App URLs have to be configured in the Google Developer Console. For local development, this is setup to work with `https://localhost:8888/ga/oauth2callback`, this will fall over if you use another port, or don't use HTTPS. ### * The Google Analytics API explorer is useful for testing queries: https://ga-dev-tools.appspot.com/explorer/ ## Localhost HTTPS You will need to generate a self-signed certificate for local development over HTTPS. See http://docs.nodejitsu.com/articles/HTTP/servers/how-to-create-a-HTTPS-server Save the key and the cert here: ``` /config/key.pem /config/cert.pem ``` ## Public URLs for Geckoboard ### UV to New User * https://metrics.webmaker.org/api/public/geckoboard/product-uvtonewuser/number * https://metrics.webmaker.org/api/public/geckoboard/product-uvtonewuser/line ### Retention 7 Day * https://metrics.webmaker.org/api/public/geckoboard/product-retention-7day/number * https://metrics.webmaker.org/api/public/geckoboard/product-retention-7day/line ### Retention 30 Day * https://metrics.webmaker.org/api/public/geckoboard/product-retention-30day/number * https://metrics.webmaker.org/api/public/geckoboard/product-retention-30day/line
/* */ (function(process) { 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Deferred = require('./Deferred'); var invariant = require('./invariant'); var PromiseMap = function() { function PromiseMap() { _classCallCheck(this, PromiseMap); this._deferred = {}; } PromiseMap.prototype.get = function get(key) { return getDeferred(this._deferred, key).getPromise(); }; PromiseMap.prototype.resolveKey = function resolveKey(key, value) { var entry = getDeferred(this._deferred, key); !!entry.isSettled() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'PromiseMap: Already settled `%s`.', key) : invariant(false) : void 0; entry.resolve(value); }; PromiseMap.prototype.rejectKey = function rejectKey(key, reason) { var entry = getDeferred(this._deferred, key); !!entry.isSettled() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'PromiseMap: Already settled `%s`.', key) : invariant(false) : void 0; entry.reject(reason); }; return PromiseMap; }(); function getDeferred(entries, key) { if (!entries.hasOwnProperty(key)) { entries[key] = new Deferred(); } return entries[key]; } module.exports = PromiseMap; })(require('process'));
# Micropeltella merrillii Syd. & P. Syd. SPECIES #### Status ACCEPTED #### According to Index Fungorum #### Published in null #### Original name Micropeltella merrillii Syd. & P. Syd. ### Remarks null
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>math-classes: Not compatible</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.7.2 / math-classes - 1.0.4</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> math-classes <small> 1.0.4 <span class="label label-info">Not compatible</span> </small> </h1> <p><em><script>document.write(moment("2020-02-28 21:06:31 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-02-28 21:06:31 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base camlp5 7.11 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-m4 1 Virtual package relying on m4 coq 8.7.2 Formal proof management system. num 1.3 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.09.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.09.0 Official release 4.09.0 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.8.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;b.a.w.spitters@gmail.com&quot; homepage: &quot;https://github.com/math-classes/&quot; doc: &quot;https://github.com/math-classes/&quot; authors: [ &quot;Eelis van der Weegen&quot; &quot;Bas Spitters&quot; &quot;Robbert Krebbers&quot; ] license: &quot;Public Domain&quot; build: [ [ &quot;./configure.sh&quot; ] [ make &quot;-j%{jobs}%&quot; ] ] install: [ make &quot;install&quot; ] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.5&quot; &amp; &lt; &quot;8.6~&quot;} ] tags: [ &quot;logpath:MathClasses&quot; ] synopsis: &quot;A library of abstract interfaces for mathematical structures in Coq&quot; url { src: &quot;https://github.com/math-classes/math-classes/archive/9853988446ab19ee0618181f8da1d7dbdebcc45f.zip&quot; checksum: &quot;md5=b2293d8e429ab1174160f68c1cba12d2&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-math-classes.1.0.4 coq.8.7.2</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.7.2). The following dependencies couldn&#39;t be met: - coq-math-classes -&gt; coq &lt; 8.6~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-math-classes.1.0.4</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
""" The Plaid API The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501 Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 from plaid.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) class AssetReportFilterRequest(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { } additional_properties_type = None _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'asset_report_token': (str,), # noqa: E501 'account_ids_to_exclude': ([str],), # noqa: E501 'client_id': (str,), # noqa: E501 'secret': (str,), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'asset_report_token': 'asset_report_token', # noqa: E501 'account_ids_to_exclude': 'account_ids_to_exclude', # noqa: E501 'client_id': 'client_id', # noqa: E501 'secret': 'secret', # noqa: E501 } _composed_schemas = {} required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, asset_report_token, account_ids_to_exclude, *args, **kwargs): # noqa: E501 """AssetReportFilterRequest - a model defined in OpenAPI Args: asset_report_token (str): A token that can be provided to endpoints such as `/asset_report/get` or `/asset_report/pdf/get` to fetch or update an Asset Report. account_ids_to_exclude ([str]): The accounts to exclude from the Asset Report, identified by `account_id`. Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) client_id (str): Your Plaid API `client_id`. The `client_id` is required and may be provided either in the `PLAID-CLIENT-ID` header or as part of a request body.. [optional] # noqa: E501 secret (str): Your Plaid API `secret`. The `secret` is required and may be provided either in the `PLAID-SECRET` header or as part of a request body.. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.asset_report_token = asset_report_token self.account_ids_to_exclude = account_ids_to_exclude for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value)
#!/usr/bin/env python3 import re import os import sys import subprocess from urllib.request import urlopen from urllib.error import HTTPError from argparse import ArgumentParser from html.parser import HTMLParser from collections import namedtuple from distutils.version import LooseVersion from configparser import ConfigParser SYSTEMD_PATH = '/etc/systemd/system' SUDOER_PATH = '/etc/sudoers.d' def main(): vargs = init_args_parse() fc = FactorioCommands(vargs) if vargs.latest_version: fc.get_latest_version() elif vargs.update: fc.update_server() elif vargs.installed_version: fc.get_local_version() elif vargs.create_service: fc.create_service() def init_args_parse(): parser = ArgumentParser(description='Commands to manage linux factorio server...') group = parser.add_mutually_exclusive_group(required=True) group.add_argument('-c', '--create-service', help='Configure Factorio as a systemd service (need root permissions)', action='store_true') group.add_argument('-u', '--update', help='Update factorio if needed', action='store_true') group.add_argument('-i', '--installed-version', help='Get the version of factorio installed on this server', action='store_true') group.add_argument('-l', '--latest-version', help='Get the latest version of factorio', action='store_true') parser.add_argument('-x', '--experimental', help='Force using the experimental version', action='store_true') parser.add_argument('-C', '--config-file', help='Config file path', default='/etc/faas/config.ini') parser.add_argument('-v', '--verbose', help='Verbose', action='store_true') return parser.parse_args() class ConfigData: def __init__(self, config, command_args): self.config = config self.command_args = command_args self._verbose = None self._baseurl = None self._experimental = None self._factorio_path = None self._experimental_url = None self._stable_url = None self._factorio_binary = None self._factorio_service = None self._factorio_service_path = None self._save_path = None self._user = None def vprint(self, *args, **kwargs): if self.verbose: print(*args, **kwargs) @property def verbose(self): if self._verbose is None: self._verbose = self.command_args.verbose self.vprint("** Verbose mode enabled **") return self._verbose @property def experimental(self): if self._experimental is None: self._experimental = self.config.getboolean('DEFAULT', 'experimental', fallback=False) self._experimental = self._experimental or self.command_args.experimental if self.experimental: self.vprint("Looking for Experimental version") else: self.vprint("Looking for stable version") return self._experimental @property def baseurl(self): if self._baseurl is None: self._baseurl = self.config.get('WEBSITE', 'baseurl', fallback='https://www.factorio.com') return self._baseurl @property def experimental_url(self): if self._experimental_url is None: page = self.config.get('WEBSITE', 'experimentalpage', fallback='/download-headless/experimental') self._experimental_url = '{0}{1}'.format(self.baseurl, page) self.vprint('Downloading page:', self._experimental_url) return self._experimental_url @property def stable_url(self): if self._stable_url is None: page = self.config.get('WEBSITE', 'stablepage', fallback='/download-headless') self._stable_url = '{0}{1}'.format(self.baseurl, page) self.vprint('Downloading page:', self._stable_url) return self._stable_url @property def factorio_path(self): if self._factorio_path is None: path = self.config.get('DEFAULT', 'factorio-path', fallback='/factorio') self._factorio_path = get_abs_path(path) return self._factorio_path @property def factorio_binary(self): if self._factorio_binary is None: self._factorio_binary = os.path.join(self.factorio_path, self.config.get('DEFAULT', 'bin-path', fallback='bin/x64/factorio')) self.vprint('Checking factorio binary at', self._factorio_binary) return self._factorio_binary @property def factorio_service(self): if self._factorio_service is None: self._factorio_service = self.config.get('SERVICE', 'service-name', fallback='factorio.service') self.vprint("Service name found:", self._factorio_service) if not str(self._factorio_service).endswith('.service'): print('Your service name must end with: ".service"', file=sys.stderr) sys.exit(-100) return self._factorio_service @property def factorio_service_path(self): return os.path.join(SYSTEMD_PATH, self.factorio_service) @property def factorio_service_rule_path(self): if self._factorio_service_path is None: filename = re.sub(r'\W', '_', self.factorio_service) filename = '99_{0}'.format(filename) self._factorio_service_path = os.path.join(SUDOER_PATH, filename) self.vprint("Writing permission at", self._factorio_service_path) return self._factorio_service_path @property def save_path(self): if self._save_path is None: self._save_path = get_abs_path(self.config.get('DEFAULT', 'save-path', fallback='../factorio/save/fsave.zip')) self.vprint('Save path configured at', self._save_path) return self._save_path @property def user(self): if self._user is None: self._user = self.config.get('DEFAULT', 'user', fallback='root') return self._user class FactorioCommands: def __init__(self, vargs): self.vargs = vargs config = ConfigParser() config_path = get_abs_path(self.vargs.config_file) if not os.path.isfile(config_path) and config_path.lower() != './config.ini': config_path = get_abs_path('./config.ini') if not os.path.isfile(config_path): print('Unable to find the config file at: ', file=sys.stderr) print('\t"{0}" or'.format(get_abs_path(self.vargs.config_file)), file=sys.stderr) print('\t"{0}"'.format(get_abs_path('./config.ini')), file=sys.stderr) sys.exit(-30) if vargs.verbose: print('Reading config from "{0}"'.format(config_path)) config.read(config_path) self.config = ConfigData(config, self.vargs) self.latest_version_data = None def vprint(self, *args, **kwargs): self.config.vprint(*args, **kwargs) def check_factorio_path(self, create_dir=True): path = self.config.factorio_path if os.path.exists(path): if os.path.isdir(path): return True else: self.vprint("{0} is not a directory".format(path)) return False elif create_dir is True: try: os.makedirs(self.config.factorio_path) return True except: print('Unable to create directory', self.config.factorio_path, file=sys.stderr) sys.exit(-1) else: self.vprint('Directory "{0}" does not exist'.format(path)) return False def check_factorio_bin_path(self): path = self.config.factorio_binary if not os.path.isfile(path): self.vprint("{0} does not exist or is not a file".format(path)) return False if not os.access(path, os.X_OK): self.vprint("Current user does not have execution permission on file", path) return False return True def _get_latest_version(self): success = False parser = None if self.config.experimental: parser, success = self._download_and_parse_page(self.config.experimental_url) if not success: if self.config.experimental: self.vprint('Unable to find any experimental version, fallback to stable branch') parser, success = self._download_and_parse_page(self.config.stable_url) if not success: print("Unable to find any factorio version a their website !", file=sys.stderr) sys.exit(-5) self.latest_version_data = parser.latest_version return parser def _download_and_parse_page(self, url): parser = FactorioVersionPageParser() try: with urlopen(url) as fs: parser.feed(fs.read().decode()) if parser.version_found: return parser, True else: self.vprint("No version found on this page !") except HTTPError as httperr: self.vprint('Unable to open "{0}":'.format(url)) self.vprint('Code {0}: {1}'.format(httperr.code, httperr.msg)) except Exception as err: self.vprint("Error:", str(err)) return None, False def get_latest_version(self): ret = self._get_latest_version() if self.config.verbose: print(str(ret)) else: print(ret.latest_version.number) def _get_local_version(self): if not self.check_factorio_path(False): print('Unable to find factorio directory at', self.config.factorio_path, file=sys.stderr) sys.exit(-10) if not self.check_factorio_bin_path(): print('Unable to execute factorio at', self.config.factorio_binary, file=sys.stderr) sys.exit(-11) try: return str_to_version(subprocess.check_output([self.config.factorio_binary, '--version'], universal_newlines=True)) except subprocess.CalledProcessError: self.vprint('Unable to find local version') return None def get_local_version(self): version = self._get_local_version() print('Version of', self.config.factorio_binary, ':', version.vstring) def update_server(self): if not self.check_factorio_path(True): print("Unable to create directory at:", self.config.factorio_path, file=sys.stderr) sys.exit(-8) if self.is_download_needed(): self.stop_server() self.download_extract_archive() self.start_server() print('Server updated successfully!') else: print('No update required') def is_download_needed(self): latest = self._get_latest_version().latest_version if not self.check_factorio_bin_path(): self.vprint('No binary found, update required') return True local_version = self._get_local_version() if local_version is None: return True self.vprint('Latest version:', latest.number.vstring) self.vprint('Local version:', local_version.vstring) if latest.number > local_version: self.vprint('Updating required') return True self.vprint('Local version is up-to-date') return False def download_extract_archive(self): url = '{0}{1}'.format(self.config.baseurl, self.latest_version_data.path) self.vprint('Downloading file:', url) path = '/tmp/factorio_headless.tar.xz' with urlopen(url) as fs: with open(path, 'wb') as f: self.vprint('Creation of the archive at:', path) f.write(fs.read()) tar = ['tar', '-xf', path, '-C', self.config.factorio_path, '--strip-components=1'] self.vprint("Extracting data to", self.config.factorio_path) sub = subprocess.Popen(tar, stderr=subprocess.PIPE, stdout=subprocess.PIPE) stdout, stderr = sub.communicate() if sub.returncode == 0: self.vprint('Extraction succeeded') os.remove(path) self.vprint("Archive deleted") else: print('Error during archive extraction:', stderr, file=sys.stderr) sys.exit(-2) def stop_server(self): if not self._service_file_exists(): self.vprint('Service is not configured yet (unable to start it)') return else: self.vprint('Stoping service...') command = ['sudo', '/bin/systemctl', 'stop', self.config.factorio_service] sub = subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE) _, _ = sub.communicate() def start_server(self): if not self._service_file_exists(): self.vprint('Service is not configured yet (unable to start it)') return else: self.vprint('Starting service...') command = ['sudo', '/bin/systemctl', 'start', self.config.factorio_service] sub = subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE) _, _ = sub.communicate() def create_service(self): check_root_permission() self.vprint('You have root permissions') check_systemd_dir() check_sudoer_dir() if not self.check_factorio_path(create_dir=False) or not self.check_factorio_bin_path(): print("Unable to create service, file {0} does not exist or is not executable" .format(self.config.factorio_binary, file=sys.stderr)) sys.exit(-9) self.stop_server() self._write_service() self._manage_service_permissions() self._reload_daemon_service() print('Service successfully created') self.start_server() def _manage_service_permissions(self): rules = ['ALL ALL=(ALL) NOPASSWD: /bin/systemctl start {0}'.format(self.config.factorio_service), 'ALL ALL=(ALL) NOPASSWD: /bin/systemctl status {0}'.format(self.config.factorio_service), 'ALL ALL=(ALL) NOPASSWD: /bin/systemctl stop {0}'.format(self.config.factorio_service)] rule_path = self.config.factorio_service_rule_path with open(rule_path, 'w') as f: self.vprint('Adding rules in sudoers to allow all users to use service at:', rule_path) f.write('\n'.join(rules)) f.write('\n') self.vprint('Changing rule file permission') os.chmod(rule_path, 0o440) def _reload_daemon_service(self): sub = subprocess.Popen(['systemctl', 'daemon-reload'], stderr=subprocess.PIPE, stdout=subprocess.PIPE) stdout, stderr = sub.communicate() if sub.returncode == 0: self.vprint('Systemctl daemon reloaded') else: self.vprint(stderr) print('Unable to restart systemctl daemon, continuing anyway ...', file=sys.stderr) print("Please consider running 'systemctl daemon-reload' to reload units", file=sys.stderr) def _service_file_exists(self): service = self.config.factorio_service_path return os.path.isfile(service) def _write_service(self): path = self.config.factorio_service_path user = self.config.user check_user_exists(user) if not os.path.isfile(self.config.save_path): print("Save file at '{0}' does not exist or is not a file".format(self.config.save_path), file=sys.stderr) sys.exit(-21) self.vprint("Save file located at", self.config.save_path) settings_path = self.get_server_settings_path() settings_command = '' if settings_path: settings_command = ' --server-settings {0}'.format(settings_path) service = ''' [Unit] Description=Factorio Server After=network.target [Service] Type=simple User={0} WorkingDirectory={1} ExecStart={2} --start-server {3}{4} '''.format(user, self.config.factorio_path, self.config.factorio_binary, self.config.save_path, settings_command) with open(path, 'w') as f: self.vprint('Creating service file at:', path) f.write(service) def get_server_settings_path(self): if not self.config.config.getboolean('DEFAULT', 'custom-settings-path', fallback=False): self.vprint('No settings file specified') return None path = get_abs_path(self.config.config.get('DEFAULT', 'settings-path', fallback='')) if not os.path.isfile(path): print('Unable to find settings file at:', path, file=sys.stderr) sys.exit(-16) return path def str_to_version(version): version = str(version or '').strip() res = re.search(r'\d+(\.\d+)+', version) if not res: return None return LooseVersion(res.group()) def get_abs_path(path): path = str(path or '').strip() if path.startswith('~'): path = os.path.expanduser(path) if os.path.isabs(path): return path return os.path.abspath(os.path.join(os.path.dirname(__file__), path)) def check_root_permission(required=True): if os.getuid() == 0: return if not required: print("It seems you don't have root permissions, it could be problematic !") return print('Root permissions are required !', file=sys.stderr) sys.exit(13) def check_systemd_dir(): if not os.path.isdir(SYSTEMD_PATH): print("Your system seems not compatible with systemd. Impossible to create service", file=sys.stderr) sys.exit(19) def check_sudoer_dir(): if not os.path.isdir(SUDOER_PATH): print("Your system does not support sudo. Impossible to create service", file=sys.stderr) sys.exit(18) def check_user_exists(username): from pwd import getpwnam username = str(username or '') if username: try: _ = getpwnam(username) return except KeyError: pass print('User "{0}" does not exist'.format(username), file=sys.stderr) sys.exit(-10) class FactorioVersionPageParser(HTMLParser): def __init__(self): self.Version = namedtuple('Version', 'number path') self.available_version = [] self.current_version = None self._in_h3 = False super().__init__() def handle_starttag(self, tag, attrs): if tag == 'h3': self._in_h3 = True elif tag == 'a' and self.current_version is not None: self.get_download_link(attrs) def handle_endtag(self, tag): self._in_h3 = False def handle_data(self, data): if self._in_h3: self.parse_version(data) def parse_version(self, data): version = str_to_version(data) if version: self.current_version = version def get_download_link(self, attrs): for attr in attrs: if attr[0] == 'href': self.available_version.append(self.Version(number=self.current_version, path=attr[1])) self.available_version = sorted(self.available_version, key=lambda x: x.number, reverse=True) self.current_version = None break def error(self, message): pass def __str__(self): if not self.available_version: return 'No available version found :(' ls = ['Latest version:', '{0} [{1}]'.format(self.available_version[0].number.vstring, self.available_version[0].path)] if len(self.available_version) > 1: ls.append('-- Other versions --') for v in self.available_version[1:]: ls.append('{0} [{1}]'.format(v.number.vstring, v.path)) return '\n'.join(ls) @property def latest_version(self): if not self.available_version: return None return self.available_version[0] @property def version_found(self): return len(self.available_version) > 0 if __name__ == "__main__": main()
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>18 --> 19</title> <link href="./../../assets/style.css" rel="stylesheet"> </head> <body> <h2>You have to be fast</h2> <a href="./56ec8630dc9f7cedf11cf1148d18bc03153af2d5e5edcc1d74ce9cb680a72680.html">Teleport</a> <hr> <a href="./../../about.md">About</a> (Spoilers! ) <script src="./../../assets/md5.js"></script> <script> window.currentLevel = 7; </script> <script src="./../../assets/script.js"></script> </body> </html>
# Coffee GB [![Build Status](https://travis-ci.org/trekawek/coffee-gb.svg?branch=master)](https://travis-ci.org/trekawek/coffee-gb) Coffee GB is a Gameboy Color emulator written in Java 8. It's meant to be a development exercise. More info can be found in the blog post [Why did I spend 1.5 months creating a Gameboy emulator?](http://blog.rekawek.eu/2017/02/09/coffee-gb/) ![Coffee GB running game](doc/tetris.gif) ## Building The emulator can be build with [Maven](https://maven.apache.org/): mvn clean package The jar file will be available in the `./target` directory. ## Usage Usage: java -jar coffee-gb.jar [OPTIONS] ROM_FILE Available options: -d --force-dmg Emulate classic GB (DMG) for universal ROMs -c --force-cgb Emulate color GB (CGB) for all ROMs -b --use-bootstrap Start with the GB bootstrap -db --disable-battery-saves Disable battery saves --debug Enable debug console --headless Start in the headless mode Play with <kbd>&larr;</kbd>, <kbd>&uarr;</kbd>, <kbd>&darr;</kbd>, <kbd>&rarr;</kbd>, <kbd>Z</kbd>, <kbd>X</kbd>, <kbd>Enter</kbd>, <kbd>Backspace</kbd>. ## Features * Cycle-exact Gameboy CPU emulation. Each opcode is split into a few micro-operations (load value from memory, store it to register, etc.) and each micro-operation is run in a separate CPU cycle. * Quite compatible (all the Blargg's tests are passed, although some game still doesn't work) * GPU * Joypad * Timer * Sound * MBC1-5 support * Battery saves * Support for zipped ROMs * ROM-based compatibility tests run from Maven ## Running Blargg's tests The [Blargg's test ROMs](http://gbdev.gg8.se/wiki/articles/Test_ROMs) are used for testing the compatibility. Tests can be launched from Maven using appropriate profile: mvn clean test -Ptest-blargg mvn clean test -Ptest-blargg-individual # for running "single" tests providing more diagnostic info They are also part of the [Travis-based CI](https://travis-ci.org/trekawek/coffee-gb). The tests output (normally displayed on the Gameboy screen) is redirected to the stdout: ``` cpu_instrs 01:ok 02:ok 03:ok 04:ok 05:ok 06:ok 07:ok 08:ok 09:ok 10:ok 11:ok Passed all tests ``` Coffee GB passes all the tests: * cgb_sound * cpu_instrs * dmg_sound-2 * halt_bug * instr_timing * interrupt_time * mem_timing-2 * oam_bug-2 ## Mooneye tests The [Mooneye GB](https://github.com/Gekkio/mooneye-gb) emulator comes with a great set of test ROMs. They can be used to test the Coffee GB as well. Use -Ptest-mooneye profile: mvn clean test -Ptest-mooneye ## Screenshots ![Coffee GB running game](doc/screenshot1.png) ![Coffee GB running game](doc/screenshot2.png) ![Coffee GB running game](doc/screenshot3.png) ![Coffee GB running game](doc/screenshot4.png) ![Coffee GB running game](doc/screenshot5.png) ![Coffee GB running game](doc/screenshot6.png) ![Coffee GB running game](doc/screenshot7.png) ![Coffee GB running game](doc/screenshot8.png) ![Coffee GB running game](doc/screenshot9.png) ![Coffee GB running game](doc/screenshot10.png) ## Key bindings The default key bindings can be changed with the `~/.coffeegb.properties` file. The file has following format: ``` btn_up=VK_UP btn_down=VK_DOWN btn_left=VK_LEFT btn_right=VK_RIGHT btn_a=VK_Z btn_b=VK_X btn_start=VK_ENTER btn_select=VK_BACK_SPACE ``` The key list can be found in the [KeyEvent JavaDoc](https://docs.oracle.com/javase/10/docs/api/java/awt/event/KeyEvent.html#field.summary). ## Resources * [GameBoy CPU manual](http://marc.rawer.de/Gameboy/Docs/GBCPUman.pdf) * [The Ultimate GameBoy talk](https://www.youtube.com/watch?v=HyzD8pNlpwI) * [Gameboy opcodes](http://pastraiser.com/cpu/gameboy/gameboy_opcodes.html) * [Nitty Gritty Gameboy cycle timing](http://blog.kevtris.org/blogfiles/Nitty%20Gritty%20Gameboy%20VRAM%20Timing.txt) * [Video Timing](https://github.com/jdeblese/gbcpu/wiki/Video-Timing) * [BGB emulator](http://bgb.bircd.org/) --- good for testing / debugging, works fine with Wine * [The Cycle-Accurate Game Boy Docs](https://github.com/AntonioND/giibiiadvance/tree/master/docs) * [Test ROMs](http://slack.net/~ant/old/gb-tests/) - included in the [src/test/resources/roms](src/test/resources/roms) * [Pandocs](http://bgb.bircd.org/pandocs.htm) * [Mooneye GB](https://github.com/Gekkio/mooneye-gb) - an accurate emulator written in Rust, contains great ROM-based acceptance tests
/* * File : label.c * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes * 2009-10-16 Bernard first version */ #include <rtgui/dc.h> #include <rtgui/widgets/label.h> #include <rtgui/rtgui_system.h> #include <rtgui/rtgui_theme.h> static void _rtgui_label_constructor(rtgui_label_t *label) { /* init widget and set event handler */ rtgui_widget_set_event_handler(RTGUI_WIDGET(label), rtgui_label_event_handler); /* set field */ label->text = RT_NULL; } static void _rtgui_label_destructor(rtgui_label_t *label) { /* release text memory */ rt_free(label->text); label->text = RT_NULL; } rtgui_type_t *rtgui_label_type_get(void) { static rtgui_type_t *label_type = RT_NULL; if (!label_type) { label_type = rtgui_type_create("label", RTGUI_WIDGET_TYPE, sizeof(rtgui_label_t), RTGUI_CONSTRUCTOR(_rtgui_label_constructor), RTGUI_DESTRUCTOR(_rtgui_label_destructor)); } return label_type; } rt_bool_t rtgui_label_event_handler(struct rtgui_widget* widget, struct rtgui_event* event) { struct rtgui_label* label; RT_ASSERT(widget != RT_NULL); label = (struct rtgui_label*) widget; switch (event->type) { case RTGUI_EVENT_PAINT: rtgui_theme_draw_label(label); break; } return RT_FALSE; } rtgui_label_t* rtgui_label_create(const char* text) { struct rtgui_label* label; label = (struct rtgui_label*) rtgui_widget_create(RTGUI_LABEL_TYPE); if (label != RT_NULL) { rtgui_rect_t rect; /* set default rect */ rtgui_font_get_metrics(rtgui_font_default(), text, &rect); rect.x2 += (RTGUI_BORDER_DEFAULT_WIDTH << 1); rect.y2 += (RTGUI_BORDER_DEFAULT_WIDTH << 1); rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); /* set text */ label->text = (char*)rt_strdup((const char*)text); } return label; } void rtgui_label_destroy(rtgui_label_t* label) { rtgui_widget_destroy(RTGUI_WIDGET(label)); } char* rtgui_label_get_text(rtgui_label_t* label) { RT_ASSERT(label != RT_NULL); return label->text; } void rtgui_label_set_text(rtgui_label_t* label, const char* text) { RT_ASSERT(label != RT_NULL); if (label->text != RT_NULL) { /* release old text memory */ rt_free(label->text); } if (text != RT_NULL) label->text = (char*)rt_strdup((const char*)text); else label->text = RT_NULL; /* update widget */ rtgui_theme_draw_label(label); }
package com.bmob.im.demo.ui; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ListView; import cn.bmob.im.bean.BmobInvitation; import cn.bmob.im.db.BmobDB; import com.bmob.im.demo.R; import com.bmob.im.demo.adapter.NewFriendAdapter; import com.bmob.im.demo.view.dialog.DialogTips; /** ÐÂÅóÓÑ * @ClassName: NewFriendActivity * @Description: TODO * @author smile * @date 2014-6-6 ÏÂÎç4:28:09 */ public class NewFriendActivity extends ActivityBase implements OnItemLongClickListener{ ListView listview; NewFriendAdapter adapter; String from=""; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_friend); from = getIntent().getStringExtra("from"); initView(); } private void initView(){ initTopBarForLeft("ÐÂÅóÓÑ"); listview = (ListView)findViewById(R.id.list_newfriend); listview.setOnItemLongClickListener(this); adapter = new NewFriendAdapter(this,BmobDB.create(this).queryBmobInviteList()); listview.setAdapter(adapter); if(from==null){//ÈôÀ´×Ô֪ͨÀ¸µÄµã»÷£¬Ôò¶¨Î»µ½×îºóÒ»Ìõ listview.setSelection(adapter.getCount()); } } @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int position, long arg3) { // TODO Auto-generated method stub BmobInvitation invite = (BmobInvitation) adapter.getItem(position); showDeleteDialog(position,invite); return true; } public void showDeleteDialog(final int position,final BmobInvitation invite) { DialogTips dialog = new DialogTips(this,invite.getFromname(),"ɾ³ýºÃÓÑÇëÇó", "È·¶¨",true,true); // ÉèÖóɹ¦Ê¼þ dialog.SetOnSuccessListener(new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int userId) { deleteInvite(position,invite); } }); // ÏÔʾȷÈ϶Ի°¿ò dialog.show(); dialog = null; } /** * ɾ³ýÇëÇó * deleteRecent * @param @param recent * @return void * @throws */ private void deleteInvite(int position, BmobInvitation invite){ adapter.remove(position); BmobDB.create(this).deleteInviteMsg(invite.getFromid(), Long.toString(invite.getTime())); } @Override protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); if(from==null){ startAnimActivity(MainActivity.class); } } }
module Github # Determines the links in the current response link header to be used # to find the links to other pages of request responses. These will # only be present if the result set size exceeds the per page limit. class PageLinks include Github::Constants DELIM_LINKS = ",".freeze # :nodoc: # Hold the extracted values for URI from the Link header # for the first, last, next and previous page. attr_accessor :first, :last, :next, :prev # Parses links from executed request # def initialize(response_headers) link_header = response_headers[HEADER_LINK] if link_header return unless link_header =~ /(next|first|last|prev)/ link_header.split(DELIM_LINKS).each do |link| if link.strip =~ /<([^>]+)>; rel=\"([^\"]+)\"/ url_part, meta_part = $1, $2 next if !url_part || !meta_part case meta_part when META_FIRST self.first = url_part when META_LAST self.last = url_part when META_NEXT self.next = url_part when META_PREV self.prev = url_part end end end else # When on the first page self.next = response_headers[HEADER_NEXT] self.last = response_headers[HEADER_LAST] end end end # PageLinks end # Github
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\VarDumper\Tests\Caster; use Symfony\Component\VarDumper\Caster\ExceptionCaster; use Symfony\Component\VarDumper\Caster\FrameStub; use Symfony\Component\VarDumper\Cloner\VarCloner; use Symfony\Component\VarDumper\Dumper\HtmlDumper; use Symfony\Component\VarDumper\Test\VarDumperTestTrait; class ExceptionCasterTest extends \PHPUnit_Framework_TestCase { use VarDumperTestTrait; private function getTestException($msg, &$ref = null) { return new \Exception(''.$msg); } protected function tearDown() { ExceptionCaster::$srcContext = 1; ExceptionCaster::$traceArgs = true; } public function testDefaultSettings() { $ref = array('foo'); $e = $this->getTestException('foo', $ref); $expectedDump = <<<'EODUMP' Exception { #message: "foo" #code: 0 #file: "%sExceptionCasterTest.php" #line: 26 -trace: { %sExceptionCasterTest.php:26: { : { : return new \Exception(''.$msg); : } } %sExceptionCasterTest.php:%d: { : $ref = array('foo'); : $e = $this->getTestException('foo', $ref); : arguments: { $msg: "foo" &$ref: array:1 [ …1] } } %A EODUMP; $this->assertDumpMatchesFormat($expectedDump, $e); $this->assertSame(array('foo'), $ref); } public function testSeek() { $e = $this->getTestException(2); $expectedDump = <<<'EODUMP' { %sExceptionCasterTest.php:26: { : { : return new \Exception(''.$msg); : } } %sExceptionCasterTest.php:%d: { : { : $e = $this->getTestException(2); : arguments: { $msg: 2 } } %A EODUMP; $this->assertStringMatchesFormat($expectedDump, $this->getDump($e, 'trace')); } public function testNoArgs() { $e = $this->getTestException(1); ExceptionCaster::$traceArgs = false; $expectedDump = <<<'EODUMP' Exception { #message: "1" #code: 0 #file: "%sExceptionCasterTest.php" #line: 26 -trace: { %sExceptionCasterTest.php:26: { : { : return new \Exception(''.$msg); : } } %sExceptionCasterTest.php:%d: { : { : $e = $this->getTestException(1); : ExceptionCaster::$traceArgs = false; } %A EODUMP; $this->assertDumpMatchesFormat($expectedDump, $e); } public function testNoSrcContext() { $e = $this->getTestException(1); ExceptionCaster::$srcContext = -1; $expectedDump = <<<'EODUMP' Exception { #message: "1" #code: 0 #file: "%sExceptionCasterTest.php" #line: 26 -trace: { %sExceptionCasterTest.php: 26 %sExceptionCasterTest.php: %d %A EODUMP; $this->assertDumpMatchesFormat($expectedDump, $e); } public function testHtmlDump() { $e = $this->getTestException(1); ExceptionCaster::$srcContext = -1; $cloner = new VarCloner(); $cloner->setMaxItems(1); $dumper = new HtmlDumper(); $dumper->setDumpHeader('<foo></foo>'); $dumper->setDumpBoundaries('<bar>', '</bar>'); $dump = $dumper->dump($cloner->cloneVar($e)->withRefHandles(false), true); $expectedDump = <<<'EODUMP' <foo></foo><bar><span class=sf-dump-note>Exception</span> {<samp> #<span class=sf-dump-protected title="Protected property">message</span>: "<span class=sf-dump-str>1</span>" #<span class=sf-dump-protected title="Protected property">code</span>: <span class=sf-dump-num>0</span> #<span class=sf-dump-protected title="Protected property">file</span>: "<span class=sf-dump-str title="%sExceptionCasterTest.php %d characters"><span class=sf-dump-ellipsis>%sTests</span>%eCaster%eExceptionCasterTest.php</span>" #<span class=sf-dump-protected title="Protected property">line</span>: <span class=sf-dump-num>26</span> -<span class=sf-dump-private title="Private property defined in class:&#10;`Exception`">trace</span>: {<samp> <span class=sf-dump-meta title="%sExceptionCasterTest.php Stack level %d."><span class=sf-dump-ellipsis>%sVarDumper%eTests</span>%eCaster%eExceptionCasterTest.php</span>: <span class=sf-dump-num>26</span> &hellip;%d </samp>} </samp>} </bar> EODUMP; $this->assertStringMatchesFormat($expectedDump, $dump); } /** * @requires function Twig_Template::getSourceContext */ public function testFrameWithTwig() { require_once dirname(__DIR__).'/Fixtures/Twig.php'; $f = array( new FrameStub(array( 'file' => dirname(__DIR__).'/Fixtures/Twig.php', 'line' => 20, 'class' => '__TwigTemplate_VarDumperFixture_u75a09', )), new FrameStub(array( 'file' => dirname(__DIR__).'/Fixtures/Twig.php', 'line' => 21, 'class' => '__TwigTemplate_VarDumperFixture_u75a09', 'object' => new \__TwigTemplate_VarDumperFixture_u75a09(null, __FILE__), )), ); $expectedDump = <<<'EODUMP' array:2 [ 0 => { class: "__TwigTemplate_VarDumperFixture_u75a09" src: { %sTwig.php:1: { : : foo bar : twig source } } } 1 => { class: "__TwigTemplate_VarDumperFixture_u75a09" object: __TwigTemplate_VarDumperFixture_u75a09 { %A } src: { %sExceptionCasterTest.php:2: { : foo bar : twig source : } } } ] EODUMP; $this->assertDumpMatchesFormat($expectedDump, $f); } }
<?php /** * Description of class-fscf-import * Import class to import settings from pre 4.0 versions of the plugin * Functions are called statically, so no need to instantiate the class * @authors Mike Challis and Ken Carlson */ class FSCF_Import { static $global_defaults, $form_defaults, $field_defaults; static $global_options, $form_options; static $old_global_options, $old_form_options; static $select_type_fields = array( 'checkbox', 'checkbox-multiple', 'select', 'select-multiple', 'radio' ); static function import_old_version( $force = '' ) { // global $fscf_special_slugs; // List of reserve slug names // ***** Import global options ***** // upgrade import only back to version 2.5.6, because before that, there was no 'si_contact_form_gb' setting self::$old_global_options = get_option( 'si_contact_form_gb' ); if ( empty( self::$old_global_options ) ) { return; } //print_r(self::$old_global_options)."<br>\n"; self::$global_options = FSCF_Util::get_global_options(); // import a few global options $copy_fields = array( 'donated', 'vcita_dismiss' ); foreach ( $copy_fields as $field ) { if ( ! empty( self::$old_global_options[$field] ) ) self::$global_options[$field] = self::$old_global_options[$field]; } // import this global option // Highest form ID (used to assign ID to new form) // When forms are deleted, the remaining forms are NOT renumberd, so max_form_num might be greater than // the number of existing forms if ( ! empty( self::$old_global_options['max_forms'] ) ) self::$global_options['max_form_num'] = self::$old_global_options['max_forms']; //print 'max_form_num:'.self::$global_options['max_form_num']."<br>\n"; // ***** Import form options ***** $max_fields_shim = 8; if($force == 'force') { // force is when they pressed the button import from 3.xx, they are warned this replaces the 4.xx forms self::$global_options['form_list'] = array(); // delete current form list // delete current 4.xx forms delete_option('fs_contact_global'); // delete up to 100 forms (a unique configuration for each contact form) for ($i = 1; $i <= 100; $i++) { delete_option("fs_contact_form$i"); } } for ($frm=1; $frm<=self::$global_options['max_form_num']; $frm++) { //print 'importing form:'.$frm."<br>\n"; $old_opt_name = 'si_contact_form'; $old_opt_name .= ($frm==1) ? '': $frm; self::$old_form_options = get_option($old_opt_name); if ( ! self::$old_form_options ) continue; if($force == 'force') { } else { // Make sure that the options for this form doesn't already exist self::$form_options = FSCF_Util::get_form_options($frm, $use_defaults=false); if ( self::$form_options ) continue; } // if max fields is missing it will be 8, or the value of the last one in the loop. if (isset(self::$old_form_options['max_fields']) && self::$old_form_options['max_fields'] > 0) $max_fields_shim = self::$old_form_options['max_fields']; else self::$old_form_options['max_fields'] = $max_fields_shim; $new_form_options = self::convert_form_options(self::$old_form_options, self::$old_form_options['max_fields']); //print_r($new_form_options)."<br>\n"; // Save the imported form $form_option_name = 'fs_contact_form' . $frm; // Add form name to the form list... if ($new_form_options['form_name'] == '') $new_form_options['form_name'] = __( 'imported', 'si-contact-form' ); self::$global_options['form_list'][$frm] = $new_form_options['form_name']; update_option ( $form_option_name, $new_form_options ); } // end for loop (forms) self::$global_options['import_success'] = true; self::$global_options['import_msg'] = true; // recalibrate max_form_num to the highest form number (not count) ksort( self::$global_options['form_list'] ); self::$global_options['max_form_num'] = max(array_keys(self::$global_options['form_list'])); //print_r(self::$global_options)."<br>\n"; update_option( 'fs_contact_global', self::$global_options ); // Display a notice on the admin page FSCF_Util::add_admin_notice(__( 'Fast Secure Contact Form has imported settings from the old version.', 'si-contact-form' ), 'updated'); // Force reload of global and form options FSCF_Options::unload_options(); } // end function import_old_version static function convert_form_options( $old_options, $max_fields ) { // Converts form options from version 3.x to 4.x // Returns converted options array global $fscf_special_slugs; // List of reserve slug names //print_r($old_options); exit; // Start with the current version form defaults $new_options = FSCF_Util::get_form_defaults(); foreach ( $new_options as $key => $val ) { //if ( ! empty($old_options[$key]) ) // caused empty Welcome introduction to appear filled in if ( isset($old_options[$key]) ) $new_options[$key] = stripslashes($old_options[$key]); } // ***** Import fields ***** // Keep a list of slugs so we can be sure they are unique $slug_list = $fscf_special_slugs; // Standard fields should already have been added by defaults // Import standard field settings $std_fields = array( 'name', 'email', 'subject', 'message' ); // This assumes that the standard fields in the form defaults are in the same order as // the names in the above array foreach ( $std_fields as $key => $val ) { if ( 'subject' == $val ) { // was there an optional subject select list? if (!empty($old_options['email_subject_list'])) { $new_options['fields'][$key]['options'] = $old_options['email_subject_list']; $new_options['fields'][$key]['type'] = 'select'; } } // Make sure this goes to the correct field! $test = ( 'name' == $val ) ? 'full_name' : $val; $slug_list[] = $test; if ( $new_options['fields'][$key]['slug'] == $test ) { // name_type, etc. could be 'required', 'not_required', or 'not_available' if ( 'not_required' == $old_options[$val . '_type'] ) { // Standard fields are required by default, so change this $new_options['fields'][$key]['req'] = 'false'; } else if ( 'not_available' == $old_options[$val . '_type'] ) { $new_options['fields'][$key]['disable'] = 'true'; } } else { // Error: this is the wrong field! // This could happen if the standard fields in the default form are in a different // order than in $std_fields } } // end foreach $std_fields //print_r($new_options); // Import the old "extra fields" // This will ignore any field properties no longer used for ($fld=1; $fld<= $max_fields; $fld++){ $old_type = $old_options['ex_field' . $fld . '_type']; if ( ! empty($old_options['ex_field'.$fld.'_label']) || 'fieldset' == $old_type || 'fieldset-close' == $old_type ) { // Add a new field with the default properties $new_field = FSCF_Util::get_field_defaults(); foreach ( $new_field as $key => $val ) { $old_prop = 'ex_field' . $fld . '_' . $key; // Need special treatment for: default option / default_text // Need to parse and reformat select options lists, checkboxres, etc. switch ( $key ) { case "default": // The old version has both default_text and default_option if ( in_array($old_type, self::$select_type_fields) && $old_options['ex_field' . $fld . '_default'] > 0 ) { $new_field['default'] = $old_options['ex_field' . $fld . '_default']; } else if ( ! empty($old_options['ex_field' . $fld . '_default_text']) ) { $new_field['default'] = stripslashes($old_options['ex_field' . $fld . '_default_text']); } break; case "label": if ( empty($old_options['ex_field'.$fld.'_label']) && ( 'fieldset' == $old_type || 'fieldset-close' == $old_type ) ) $old_options['ex_field'.$fld.'_label'] = sprintf( __( 'Field %s', 'si-contact-form' ), $fld ); // Check for options added to the label (e.g. Color:,Red;Green;Blue ), etc. $new_field[$key] = $old_options[$old_prop]; if ( in_array($old_type, self::$select_type_fields) && 'checkbox' != $old_type ) $new_field = self::parse_label($new_field); if ( 'checkbox' == $old_type ) { // label might have \, (not needed in 4.x version, remove it) $new_field['label'] = str_replace( '\,', ',', $new_field['label'] ); // "\," changes to "," $new_field['label'] = stripslashes( $new_field['label'] ); } break; default: if ( ! empty($old_options[$old_prop]) ) $new_field[$key] = stripslashes($old_options[$old_prop]); } // End switch } // end foreach $new_field // Create the slug for the field from the field label // the sanitize title function encodes UTF-8 characters, so we need to undo that // this line croaked on some chinese characters //$new_field['slug'] = substr( urldecode(sanitize_title_with_dashes(remove_accents($new_field['label']))), 0, FSCF_MAX_SLUG_LEN ); //echo 'slug before:'.$new_field['label']."<br>\n"; $new_field['slug'] = remove_accents($new_field['label']); $new_field['slug'] = preg_replace('~([^a-zA-Z\d_ .-])~', '', $new_field['slug']); $new_field['slug'] = substr( urldecode(sanitize_title_with_dashes($new_field['slug'])), 0, FSCF_MAX_SLUG_LEN ); if ($new_field['slug'] == '') $new_field['slug'] = 'na'; if ( '-' == substr( $new_field['slug'], strlen($new_field['slug'])-1, 1) ) $new_field['slug'] = substr( $new_field['slug'], 0, strlen($new_field['slug'])-1); // Make sure the slug is unique $new_field['slug'] = FSCF_Options::check_slug($new_field['slug'], $slug_list); //echo 'slug jafter:'.$new_field['slug']."<br>\n"; $slug_list[] = $new_field['slug']; $new_options['fields'][] = $new_field; } // end if old field label not empty } // for loop through fields return($new_options); } // end function convert_form_options static function parse_label( $field ) { // Parse label from old verson to remove options, etc. // Returns the modified field // find the label and the options inside $field['label'] $exf_opts_array = array( ); $exf_opts_label = ''; $exf_array_test = trim( $field['label'] ); if ( preg_match( '#(?<!\\\)\,#', $exf_array_test ) ) { list($exf_opts_label, $value) = preg_split( '#(?<!\\\)\,#', $exf_array_test ); //string will be split by "," but "\," will be ignored $exf_opts_label = trim( str_replace( '\,', ',', $exf_opts_label ) ); // "\," changes to "," $value = trim( str_replace( '\,', ',', $value ) ); // "\," changes to "," if ( $exf_opts_label != '' && $value != '' ) { if ( preg_match( "/;/", $value ) ) { // multiple options $exf_opts_array = explode( ";", $value ); } } } foreach ( $exf_opts_array as $key => $opt ) { $opt = trim($opt); if ( 0 == $key ) $field['options'] = stripslashes($opt); else $field['options'] .= "\n" . stripslashes($opt); } // Check for inline indicator if ( preg_match( '/^{inline}/', $exf_opts_label ) ) { $exf_opts_label = str_replace( '{inline}', '', $exf_opts_label ); $field['inline'] = 'true'; } $field['label'] = stripslashes($exf_opts_label); //print_r($field); return($field); } // end function parse_label() } // end class FSCF_Import // end of file
<!--**************************************--> <!--* Generated from MathBook XML source *--> <!--* on 2016-11-27T20:57:30-05:00 *--> <!--* *--> <!--* http://mathbook.pugetsound.edu *--> <!--* *--> <!--**************************************--> <article class="list"><h5 class="heading"> <span class="type">Item</span><span class="codenumber"></span> </h5> <p id="p-467">\(\frac{\text{real number}}{\text{non-zero real number}}\). Example: \(\lim\limits_{x\to3}\frac{2x+16}{5x-4}\) (the form is \(\frac{22}{11}\))</p> <p id="p-468">The value of the limit is the number to which the limit form simplifies; for example, \(\lim\limits_{x\to3}\frac{2x+16}{5x-4}=2\). You can immediately begin applying limit laws if you are “proving” the limit value. </p></article><span class="incontext"><a href="clm.html#li-31">in-context</a></span>
'use strict'; import EmailClient from './email-client'; import configuration from './configuration'; let gmailConfig = configuration.load('gmail'); import google from 'googleapis'; import open from 'open'; import http from 'http'; import url from 'url'; import chalk from 'chalk'; class EmailConfigPlugin { cli(program, config) { this.config = config; program.command('email-config') .description('configures integration with gmail API') .action(() => { this.configure(); }); program.command('email-test') .description('tests email configuration (logs first message in inbox)') .action(() => { this.test(); }); } configure() { let OAuth2Client = google.auth.OAuth2; // var plus = google.plus('v1'); let gmail = google.gmail('v1'); let gmailConfig = configuration.load('gmail'); if (!(gmailConfig.gmail && gmailConfig.gmail.oauth && gmailConfig.gmail.oauth.clientId)) { console.log('missing gmail.oauth.clientId'); console.log('to get client id & secret visit: https://console.developers.google.com'); process.exit(1); } if (!gmailConfig.gmail.oauth.clientSecret) { console.log('missing gmail.oauth.clientSecret'); console.log('to get client id & secret visit: https://console.developers.google.com'); process.exit(1); } let redirectPort = 51575; let redirectUrl = 'http://localhost:' + redirectPort; let oauth2Client = new OAuth2Client( gmailConfig.gmail.oauth.clientId, gmailConfig.gmail.oauth.clientSecret, redirectUrl); function getAccessToken(oauth2Client, callback) { // generate consent page url let url = oauth2Client.generateAuthUrl({ 'access_type': 'offline', // will return a refresh token scope: [ 'https://mail.google.com/', 'https://www.googleapis.com/auth/plus.me' ] }); waitForUrlRedirect(function(code) { // request access token oauth2Client.getToken(code, function(err, tokens) { if (err) { throw err; } // set tokens to the client oauth2Client.setCredentials(tokens); callback(tokens); }); }); console.log('opening browser for oauth authorization'); open(url); } function waitForUrlRedirect(callback) { let server = http.createServer(function(req, res) { res.writeHead(200, { 'Content-Type': 'text/plain' }); let reqUrl = url.parse(req.url, true); let code = reqUrl.query.code; if (code) { res.end('Thanks!,\nYou can close this window'); callback(code); setTimeout(function() { server.close(); }, 1000); return; } res.end('Authorization code not found'); }).listen(redirectPort); } // retrieve an access token getAccessToken(oauth2Client, function(tokens) { gmail.users.getProfile({ userId: 'me', auth: oauth2Client }, function(err, profile) { if (err) { console.log(chalk.red('An error occured getting gmail profile'), err); return; } let users = configuration.load('users').users; if (users.default.email.replace(/\+[^@]*@/g, '@') !== profile.emailAddress) { console.log(chalk.red('users.yml default email address doesn\'t match: ' + profile.emailAddress)); process.exit(1); } let oauth = gmailConfig.gmail.oauth; /* jshint camelcase: false */ oauth.accessToken = tokens.access_token; oauth.refreshToken = tokens.refresh_token; /* jshint camelcase: true */ configuration.save('gmail', gmailConfig); console.log(chalk.green('new tokens saved for user ' + profile.emailAddress)); console.log(' (test it running: ./run-plugin email-test )'); /* plus.people.get({ userId: 'me', auth: oauth2Client }, function(err, profile) { if (err) { console.log(chalk.red('An error occured getting google plus profile'), err); return; } console.log(profile); }); */ process.exit(); }); }); } test() { let user = this.config.users.default; let client = new EmailClient({ email: user.email, password: gmailConfig.gmail.password, oauth: gmailConfig.gmail.oauth }); function onFailure(err) { client.close(); process.nextTick(function() { throw err; }); } client.findRecentMessage().then(function(message) { console.log(message); return message.getBody().then(function(body) { console.log('*********************************************'); console.log(body.text); console.log('*********************************************'); client.close(); }); }, onFailure); } } export default new EmailConfigPlugin();
<!DOCTYPE HTML> <html> <head> <title>pixi.js example 1</title> <style> body { margin: 0; padding: 0; background-color: #000000; } </style> <script src="pixi.js"></script> </head> <body> <script> // create a new loader var imagesToLoad = [ "img/stretched_hyper_tile.jpg"]; loader = new PIXI.AssetLoader(imagesToLoad); loader.onComplete = onAssetsLoaded loader.load(); function onAssetsLoaded() { // create an new instance of a pixi stage var stage = new PIXI.Stage(0x66FF99); // create a renderer instance. var renderer = PIXI.autoDetectRenderer(400, 300); // add the renderer view element to the DOM document.body.appendChild(renderer.view); requestAnimFrame( animate ); // create a new Sprite using an image path.. var bunny = PIXI.Sprite.fromImage("bunny.png"); // center the sprites anchor point bunny.anchor.x = 0.5; bunny.anchor.y = 0.5; // move the sprite t the center of the screen bunny.position.x = 200; bunny.position.y = 150; stage.addChild(bunny); } function animate() { requestAnimFrame( animate ); // just for fun, lets rotate mr rabbit a little bunny.rotation += 0.1; // render the stage renderer.render(stage); } </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta name="generator" content="HTML Tidy for Windows (vers 14 February 2006), see www.w3.org"> <title> SimpleUndoClose Credits </title> <link href="options.css" rel="stylesheet" type="text/css" /> <link href="scrollbar.css" rel="stylesheet" type="text/css" /> <script src="il8n.js"></script> </head> <body> <center> <div class="header"> <center><div class="header-inner"><img class="headIco" src="icon-128.png"><font class="headerText">SimpleUndoClose</font> <font class="headerText2"><a class="headerLink" href="options.html"><img id="topbtn1" class="headOpIco" src="settings.png" title="Settings"></a><img id="topbtn2" class="headOpIco" src="log.png" title="Credits and Changelog"><a class="headerLink" href="about.html"><img id="topbtn3" class="headOpIco" src="about.png" title="Information"></a></font></div></center> </div> <div class="boxx"> <div class="optionGrpTitle" i18n="cred_title"> Credits </div> <div class="option"> <ul style="margin-top: -6px;"> <li i18n="cred_line1">Credits to <a href="https://chrome.google.com/webstore/detail/bcennaiejdjpomgmmohhpgnjlmpcjmbg">Sexy Undo Close Tab</a> as SimpleUndoClose is a fork of it.</li> <li i18n="cred_line2">Also thanks to Undo Close tab plugin, which Sexy Undo Close Tab came from.</li> <li i18n="cred_line3">Finally also thanks to all other extensions the Undo Close tab plugin may have forked from :)</li> <li i18n="cred_line4">Additional credits to <a href="https://developer.android.com/design/index.html">Android Design</a> for the 3 icons located top right.</li> </ul> </div> <div class="optionGrpTitle" i18n="cLog_title"> Changelog </div> <div class="option"> <font class="ultitle">v1.3.4.1 (8/12/2014)</font> <ul class="changelog"> <li>Minor bug fix</li> </ul> <font class="ultitle">v1.3.4 (7/12/2014)</font> <ul class="changelog"> <li>Added option to adjust width of popup</li> <li>Added option to move time to the right end</li> <li>Minor cosmetic tweaks</li> </ul> <font class="ultitle">v1.3.3.5 (24/9/2014)</font> <ul class="changelog"> <li>Minor fix for manually deleting full list not showing no tab message</li> </ul> <font class="ultitle">v1.3.3.4 (24/9/2014)</font> <ul class="changelog"> <li>Revert to standard method of displaying closed time for tabs recorded on browser close</li> <li>Minor cosmetic changes</li> <li>Misc code tweaks</li> </ul> <font class="ultitle">v1.3.3.3 (7/7/2014)</font> <ul class="changelog"> <li>Minor cosmetic changes</li> </ul> <font class="ultitle">v1.3.3.2 (1/7/2014)</font> <ul class="changelog"> <li>Added Hungarian translation by Róbert Tóth</li> </ul> <font class="ultitle">v1.3.3.1 (26/6/2014)</font> <ul class="changelog"> <li>Quick fix for 1.3.3</li> </ul> <font class="ultitle">v1.3.3 (25/6/2014)</font> <ul class="changelog"> <li>A series of internal changes mostly on tab management</li> <li>Improve on double (triple for Opera) click undo reliability</li> <li>Code changes for custom undo hotkey function</li> <li>Russian translation update by Sergey Zagursky</li> <li>Other misc code tweaks</li> </ul> <font class="ultitle">v1.3.2.3 (15/6/2014)</font> <ul class="changelog"> <li>[ ! ] One-time force reset data, clearing of existing closed tabs</li> <li>Fixed popup displaying more closed tabs than limited to</li> <li>Fixed saved closed tab limit not working</li> </ul> <font class="ultitle">v1.3.2.2 (14/6/2014)</font> <ul class="changelog"> <li>Improve reliability on recording existing tabs on fresh install or re-enable</li> <li>Ensure existing tabs are recorded after clicking Clear button</li> <li>Various code tweaks and tidying</li> </ul> <font class="ultitle">v1.3.2.1 (11/6/2014)</font> <ul class="changelog"> <li>Fixed extension not working after clicking Clear button</li> <li>Fixed extension (potentially) not working on clean install</li> <li>Removed use of deprecated API property</li> </ul> <font class="ultitle">v1.3.2 (3/6/2014)</font> <ul class="changelog"> <li>Added recording of tabs still open on browser close</li> <li>Minor UI tweak</li> </ul> <font class="ultitle">v1.3.1.2 (13/5/2014)</font> <ul class="changelog"> <li>Minor changes to add feedback link for Opera users</li> </ul> <font class="ultitle">v1.3.1.1 (10/5/2014)</font> <ul class="changelog"> <li>Change to a sharper icon</li> <li>Minor tweak to hotkey code</li> </ul> <font class="ultitle">v1.3.1 (25/3/2014)</font> <ul class="changelog"> <li>Fixed problem where extra tabs restored when tooltips are set to display URL (credits to <a href="http://blandlifedev.blogspot.sg/2014/03/updates-x3.html?showComment=1395598796049#c4993082665894759569">Emm</a>)</li> <li>Minor code changes</li> </ul> <font class="ultitle">v1.3 (22/3/2014)</font> <ul class="changelog"> <li>Added ⌘ key option for custom undo hotkey for Mac users</li> <li>Added individual delete button in popup</li> <li>Fixed existing tabs before install/reenable not registering</li> <li>Fixed enter key not working for keyboard navigation</li> <li>Fixed (hopefully) icon for retina displays</li> <li>Fixed double click for last tab</li> <li>Removed changelog from translations</li> <li>Some tweaks to the hotkey detection</li> <li>Minor cosmetic changes</li> </ul> <font class="ultitle">v1.2.1.2 (26/12/2013)</font> <ul class="changelog"> <li>Russian translation update by Sergey Zagursky</li> <li>Minor cosmetic change</li> </ul> <font class="ultitle">v1.2.1.1 (17/12/2013)</font> <ul class="changelog"> <li>Added internationalization<br>- Chinese Traditional by km zeng<br>- Russian by Sergey Zagursky</li> </ul> <font class="ultitle">v1.2.1 (14/6/2013)</font> <ul class="changelog"> <li>Minor code changes</li> <li>Minor cosmetic changes</li> </ul> <font class="ultitle">v1.2 (2/6/2013)</font> <ul class="changelog"> <li>Added custom undo hotkey function</li> <li>Slight change to translations</li> </ul> <font class="ultitle">v1.1.3 (19/5/2013)</font> <ul class="changelog"> <li>Slight changes to Japanese translation referenced from SimpleExtManager's translation by Ryota</li> </ul> <font class="ultitle">v1.1.2 (18/5/2013)</font> <ul class="changelog"> <li>Nicer fonts for translations</li> <li>Some tiny optimization in some loops</li> </ul> <font class="ultitle">v1.1.1 (13/5/2013)</font> <ul class="changelog"> <li>Added forgotten translations for the popup</li> </ul> <font class="ultitle">v1.1 (12/5/2013)</font> <ul class="changelog"> <li>Added internationalization<br>- Chinese Simplified (from <a href="http://bbs.kafan.cn/thread-1563545-1-1.html">here</a> with some changes)<br>- Japanese (from <a href="http://www.gigafree.net/internet/googlechrome/SimpleUndoClose.html">here</a> with some changes)</li> <li>Added feedback link</li> <li>Removed append tab option, recovered tab is placed according to Chrome's default positioning</li> </ul> <font class="ultitle">v1.0.1 (5/5/2013)</font> <ul class="changelog"> <li>Added alternate button option</li> </ul> <font class="ultitle">v1.0 (18/12/2012)</font> <ul class="changelog"> <li>Added link to blogsite in options pages</li> </ul> <font class="ultitle">v0.90.1 (7/12/2012 - RC)</font> <ul class="changelog"> <li>Fixed problem blocking badge from showing on start</li> </ul> <font class="ultitle">v0.90 (1/10/2012 - Event page test)</font> <ul class="changelog"> <li>Switched to event page</li> </ul> <font class="ultitle">v0.83.2 (3/10/2012 - Test version 4.2)</font> <ul class="changelog"> <li>Minor edit to fix detailed search option resetting on start</li> </ul> <font class="ultitle">v0.83.1 (1/10/2012 - Test version 4.1)</font> <ul class="changelog"> <li>Fixed issue with options and popup not loading properly after 0.83 update</li> </ul> <font class="ultitle">v0.83 (28/9/2012 - Test version 4)</font> <ul class="changelog"> <li>Text edits in information page</li> <li>Added detailed search options</li> <li>Minor cosmetic tweaks</li> </ul> <font class="ultitle">v0.82 (23/9/2012 - Test version 3)</font> <ul class="changelog"> <li>Added keyboard navigation in the popup</li> <li>Fixed problem where some option changes are only detected on extension reload</li> <li>Added cleanup of some leftover tab data on startup</li> <li>Added information page</li> <li>Some cosmetic changes</li> </ul> <font class="ultitle">v0.81 (9/9/2012 - Test version 2)</font> <ul class="changelog"> <li>Various edits in preparation to switch to event page</li> </ul> <font class="ultitle">v0.80 (3/9/2012 - Test version)</font> <ul class="changelog"> <li>Started with code forked from Sexy Undo Close Tab on 22 Aug 2012</li> <li>Updated manifest to version 2</li> <li>Reworked UI and parts of code</li> <li>Some fixes and additions (Initialization of closed tabs to save slider, url or title in tooltip etc.)</li> <li>Removed ads</li> </ul> </div> <div class="footer"></div> </div> </center> <a class="headerLink bld" href="http://blandlifedev.blogspot.sg"><img id="blogbtn" src="bldLogo.png" title="Visit blogsite"></a> </body> </html>
# Lomatocarpa steineri (Podlech) Pimenov SPECIES #### Status ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name Ligusticum steineri Podlech ### Remarks null
package alec_wam.CrystalMod.tiles.fusion; import alec_wam.CrystalMod.tiles.machine.IFacingTile; import alec_wam.CrystalMod.util.BlockUtil; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ItemBlockPedistal extends ItemBlock { public ItemBlockPedistal(Block b) { super(b); } @Override public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) { if(!super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState)) { return false; } TileEntity te = world.getTileEntity(pos); if(te instanceof IFacingTile) { IFacingTile tile = (IFacingTile) te; EnumFacing face = player.isSneaking() ? EnumFacing.getDirectionFromEntityLiving(pos, player) : side; tile.setFacing(face.getIndex()); BlockUtil.markBlockForUpdate(world, pos); } return true; } }
/* * * * Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com) * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * For more information: http://www.orientechnologies.com * */ package com.orientechnologies.orient.etl; import com.orientechnologies.orient.core.command.OCommandContext; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.etl.extractor.OAbstractExtractor; import java.io.Reader; import java.util.Random; /** * ETL stub OAbstractExtractor to check the result in tests. * * @author Luca Garulli on 27/11/14. */ public class OETLStubRandomExtractor extends OAbstractExtractor { private int fields; private long items; private int delay = 0; @Override public void configure(OETLProcessor iProcessor, ODocument iConfiguration, OCommandContext iContext) { super.configure(iProcessor, iConfiguration, iContext); if (iConfiguration.containsField("items")) items = ((Number) iConfiguration.field("items")).longValue(); if (iConfiguration.containsField("fields")) fields = iConfiguration.field("fields"); if (iConfiguration.containsField("delay")) delay = iConfiguration.field("delay"); } @Override public void extract(final Reader iReader) { } @Override public String getUnit() { return "row"; } @Override public boolean hasNext() { return current < items; } @Override public OExtractedItem next() { final ODocument doc = new ODocument(); for (int i = 0; i < fields; ++i) { doc.field("field" + i, "value_" + new Random().nextInt(30)); } if (delay > 0) // SIMULATE A SLOW DOWN try { Thread.sleep(delay); } catch (InterruptedException e) { } return new OExtractedItem(current++, doc); } @Override public String getName() { return "random"; } }
<?php namespace Mopsis\Components\Domain\Concerns; use Exception; use Mopsis\Security\Token; trait CanCreate { protected $filter; protected $payload; protected $repository; public function create($formId, array $data = null) { try { $instance = $this->repository->newInstance(); if ($data === null) { return $this->payload->accepted([ '#instance' => $instance, 'formId' => $formId ]); } if (!$this->filter->forInsert($formId, $data)) { return $this->payload->notValid([ '#instance' => $instance, 'formId' => $formId, 'errors' => $this->filter->getMessages(), 'requestData' => $data ]); } if (!$this->repository->create($instance, $this->filter->getResult())) { return $this->payload->notCreated([ '#instance' => $instance, 'formId' => $formId ]); } return $this->payload->created(['#instance' => $instance]); } catch (Exception $e) { return $this->payload->error([ 'exception' => $e, 'formId' => $formId, 'data' => $data ]); } } public function createChild($ancestorToken, $formId, array $data = null) { try { $ancestor = Token::extract($ancestorToken); if (!$ancestor) { return $this->payload->gone(['token' => $ancestorToken]); } $instance = $this->repository->newInstance(); $relations = $instance->findRelations($ancestor); if (count($relations) !== 1) { throw new Exception('expected 1 relation, found ' . count($relations)); } if ($data === null) { return $this->payload->accepted([ '#instance' => $instance, 'formId' => $formId, 'ancestorToken' => $ancestorToken ]); } if (!$this->filter->forInsert($formId, $data)) { return $this->payload->notValid([ '#instance' => $instance, 'formId' => $formId, 'ancestorToken' => $ancestorToken, 'errors' => $this->filter->getMessages(), 'requestData' => $data ]); } $relation = array_pop($relations); $instance->$relation()->associate($ancestor); if (!$this->repository->create($instance, $this->filter->getResult())) { return $this->payload->notCreated([ '#instance' => $instance, 'formId' => $formId, 'ancestorToken' => $ancestorToken ]); } return $this->payload->created(['#instance' => $instance]); } catch (Exception $e) { return $this->payload->error([ 'exception' => $e, 'formId' => $formId, 'ancestorToken' => $ancestorToken, 'data' => $data ]); } } }
namespace UCWA.NET.Core { public class Credentials { public string GrantType { get; set; } public string Username { get; set; } public string Password { get; set; } public string Domain { get; set; } } }
/* * This file is part of Cockpit. * * Copyright (C) 2015 Red Hat, Inc. * * Cockpit is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * Cockpit is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see <http://www.gnu.org/licenses/>. */ /* globals d3 */ (function() { "use strict"; angular.module('kubernetes.graph', [ 'kubeClient', 'kubeClient.cockpit', 'kubeUtils', ]) .factory('CAdvisorSeries', [ "KubeRequest", "CockpitMetrics", "$exceptionHandler", "$timeout", function (KubeRequest, CockpitMetrics, $exceptionHandler, $timeout) { function CAdvisor(node) { var self = this; /* called when containers changed */ var callbacks = []; /* cAdvisor has second intervals */ var interval = 1000; var last = { }; var unique = 0; var requests = { }; /* Holds the container specs */ self.specs = { }; function feed(containers) { var x, y, ylen, i, len; var item, offset, timestamp, container, stat; /* * The cAdvisor data doesn't seem to have inherent guarantees of * continuity or regularity. In theory each stats object can have * it's own arbitrary timestamp ... although in practice they do * generally follow the interval to within a few milliseconds. * * So we first look for the lowest timestamp, treat that as our * base index, and then batch the data based on that. */ var first = null; for (x in containers) { container = containers[x]; if (container.stats) { len = container.stats.length; for (i = 0; i < len; i++) { timestamp = container.stats[i].timestamp; if (timestamp) { if (first === null || timestamp < first) first = timestamp; } } } } if (first === null) return; var base = Math.floor(new Date(first).getTime() / interval); var items = []; var name, mapping = { }; var new_ids = []; var id; var names = { }; for (x in containers) { container = containers[x]; /* * This builds the correct type of object graph for the * paths seen in grid.add() to operate on */ name = container.name; if (!name) continue; names[name] = name; mapping[name] = { "": name }; id = name; if (container.aliases) { ylen = container.aliases.length; for (y = 0; y < ylen; y++) { mapping[container.aliases[y]] = { "": name }; /* Try to use the real docker container id as our id */ if (container.aliases[y].length === 64) id = container.aliases[y]; } } if (id && container.spec) { if (!self.specs[id]) { self.specs[id] = container.spec; new_ids.push(id); } } if (container.stats) { len = container.stats.length; for (i = 0; i < len; i++) { stat = container.stats[i]; if (!stat.timestamp) continue; /* Convert the timestamp into an index */ offset = Math.floor(new Date(stat.timestamp).getTime() / interval); item = items[offset - base]; if (!item) item = items[offset - base] = { }; item[name] = stat; } } } if (new_ids.length > 0) invokeCallbacks(new_ids); /* Make sure each offset has something */ len = items.length; for (i = 0; i < len; i++) { if (items[i] === undefined) items[i] = { }; } /* Now for each offset, if it's a duplicate, put in a copy */ for(name in names) { len = items.length; for (i = 0; i < len; i++) { if (items[i][name] === undefined) items[i][name] = last[name]; else last[name] = items[i][name]; } } self.series.input(base, items, mapping); } function request(query) { var body = JSON.stringify(query); /* Only one request active at a time for any given body */ if (body in requests) return; var path = "/api/v1/proxy/nodes/" + encodeURIComponent(node) + ":4194/api/v1.2/docker"; var req = KubeRequest("POST", path, query); requests[body] = req; req.then(function(data) { delete requests[body]; feed(data.data); }) .catch(function(ex) { delete requests[body]; if (ex.status != 503) console.warn(ex); }); } function invokeCallbacks(/* ... */) { var i, len, func; for (i = 0, len = callbacks.length; i < len; i++) { func = callbacks[i]; try { if (func) func.apply(self, arguments); } catch (e) { $exceptionHandler(e); } } } self.fetch = function fetch(beg, end) { var query; if (!beg || !end) { query = { num_stats: 60 }; } else { query = { start: new Date((beg - 1) * interval).toISOString(), end: new Date(end * interval).toISOString() }; } request(query); }; self.close = function close() { var req, body; for (body in requests) { req = requests[body]; if (req && req.cancel) req.cancel(); } }; self.watch = function watch(callback) { var ids; var timeout; callbacks.push(callback); if (self.specs) { ids = Object.keys(self.specs); if (ids.length > 0) { timeout = $timeout(function() { timeout = null; callback.call(self, ids); }, 0); } } return { cancel: function() { var i, len; $timeout.cancel(timeout); timeout = null; for (i = 0, len = callbacks.length; i < len; i++) { if (callbacks[i] === callback) callbacks[i] = null; } } }; }; var cache = "cadv1-" + (node || null); self.series = CockpitMetrics.series(interval, cache, self.fetch); } return { new_cadvisor: function(node) { return new CAdvisor(node); }, }; } ]) .factory('ServiceGrid', [ "CAdvisorSeries", "CockpitMetrics", "kubeSelect", "kubeLoader", function ServiceGrid(CAdvisorSeries, CockpitMetrics, select, loader) { function CockpitServiceGrid() { var self = CockpitMetrics.grid(1000, 0, 0); /* All the cadvisors that have been opened, one per host */ var cadvisors = { }; /* Service uids */ var services = { }; /* The various rows being shown, override */ self.rows = [ ]; self.events = [ ]; var change_queued = false; var current_metric = null; var rows = { cpu: { }, memory: { }, network: { } }; var container_cpu = { }; var container_mem = { }; var container_rx = { }; var container_tx = { }; /* Track Pods and Services */ var c = loader.listen(function() { var changed = false; var seen_services = {}; var seen_hosts = {}; /* Lookup all the services */ angular.forEach(select().kind("Service"), function(service) { var spec = service.spec; var meta = service.metadata; var name = meta.name; if (!spec || !spec.selector || name === "kubernetes" || name === "kubernetes-ro") return; var uid = meta.uid; var pods = select().kind("Pod") .namespace(meta.namespace || "") .label(spec.selector || {}); seen_services[uid] = true; if (!services[uid]) add_service(uid); /* Lookup all the pods for each service */ angular.forEach(pods, function(pod) { var status = pod.status || { }; var spec = pod.spec || { }; var host = spec.nodeName; var container_ids = {}; var containers = status.containerStatuses || []; var i; var mapped = services[uid]; seen_hosts[host] = true; if (host && !cadvisors[host]) { add_cadvisor(host); } /* Note all the containers for that pod */ for (i = 0; i < containers.length; i++) { var container = containers[i]; var id = container.containerID; if (id && id.indexOf("docker://") === 0) { container_ids[id] = id; id = id.substring(9); container_ids[id] = id; if (!mapped || !mapped[id]) changed = true; } } services[uid] = container_ids; }); }); var k; for (k in services) { if (!seen_services[k]) { remove_service(k); changed = true; } } for (k in cadvisors) { if (!seen_hosts[k]) { remove_host(k); changed = true; } } /* Notify for all rows */ if (changed) self.sync(); }); loader.watch("Pod"); loader.watch("Service"); function add_container(cadvisor, id) { var cpu = self.add(cadvisor, [ id, "cpu", "usage", "total" ]); container_cpu[id] = self.add(function(row, x, n) { row_delta(cpu, row, x, n); }, true); container_mem[id] = self.add(cadvisor, [ id, "memory", "usage" ]); var rx = self.add(cadvisor, [ id, "network", "rx_bytes" ]); container_rx[id] = self.add(function(row, x, n) { row_delta(rx, row, x, n); }, true); var tx = self.add(cadvisor, [ id, "network", "tx_bytes" ]); container_tx[id] = self.add(function(row, x, n) { row_delta(tx, row, x, n); }, true); self.sync(); } function add_cadvisor(host) { var cadvisor = CAdvisorSeries.new_cadvisor(host); cadvisor.watch(function (ids) { var i; for (i = 0; i < ids.length; i++) add_container(cadvisor, ids[i]); }); /* A dummy row to force fetching data from the cadvisor */ self.add(cadvisor, [ "unused-dummy" ]); /* TODO: Handle cadvisor failure somehow */ cadvisors[host] = cadvisor; } function remove_host(host) { var cadvisor = cadvisors[host]; if (cadvisor) { delete cadvisors[host]; cadvisor.close(); cadvisor = null; change_queued = true; } } function add_service(uid) { /* CPU needs summing of containers, and then delta between them */ rows.cpu[uid] = self.add(function(row, x, n) { containers_sum(uid, container_cpu, row, x, n); }); /* Memory row is pretty simple, just sum containers */ rows.memory[uid] = self.add(function(row, x, n) { containers_sum(uid, container_mem, row, x, n); }); /* Network sums containers, then sum tx and rx, and then delta */ var tx = self.add(function(row, x, n) { containers_sum(uid, container_tx, row, x, n); }); var rx = self.add(function(row, x, n) { containers_sum(uid, container_rx, row, x, n); }); rows.network[uid] = self.add(function(row, x, n) { rows_sum([tx, rx], row, x, n); }); change_queued = true; } function remove_service(uid) { delete services[uid]; delete rows.network[uid]; delete rows.cpu[uid]; delete rows.memory[uid]; change_queued = true; } function rows_sum(input, row, x, n) { var max = row.maximum || 0; var value, i, v, j, len = input.length; /* Calculate the sum of the rows */ for (i = 0; i < n; i++) { value = undefined; for (j = 0; j < len; j++) { v = input[j][x + i]; if (v !== undefined) { if (value === undefined) value = v; else value += v; } } if (value !== undefined && value > max) { row.maximum = max = value; change_queued = true; } row[x + i] = value; } } function row_delta(input, row, x, n) { var i, last, res, value; if (x > 0) last = input[x - 1]; var max = row.maximum || 1; for (i = 0; i < n; i++) { value = input[x + i]; if (last === undefined || value === undefined) { res = undefined; } else { res = (value - last); if (res < 0) { res = undefined; } else if (res > max) { row.maximum = max = res; change_queued = true; } } row[x + i] = res; last = value; } } function containers_sum(service, input, row, x, n) { var id, rowc, subset = []; var mapped = services[service]; if (mapped) { for(id in mapped) { rowc = input[id]; if (rowc) subset.push(rowc); } } rows_sum(subset, row, x, n); } self.metric = function metric(type) { if (type === undefined) return current_metric; if (rows[type] === undefined) throw "unsupported metric type"; self.rows = []; current_metric = type; var service_uids = Object.keys(services); var row, i, len = service_uids.length; for (i = 0; i < len; i++) { row = rows[type][service_uids[i]]; if (row !== undefined) { self.rows.push(row); row.uid = service_uids[i]; } } var event = document.createEvent("CustomEvent"); event.initCustomEvent("changed", false, false, null); self.dispatchEvent(event, null); }; var base_close = self.close; self.close = function close() { var hosts = Object.keys(cadvisors); var i; for (i = 0; i < hosts.length; i++) { var k = hosts[i]; var cadvisor = cadvisors[k]; if (cadvisor) { delete cadvisors[k]; cadvisor.close(); cadvisor = null; } } c.cancel(); base_close.apply(self); }; self.addEventListener("notify", function () { if (change_queued) { change_queued = false; self.metric(current_metric); } }); return self; } return { new_grid: function () { return new CockpitServiceGrid(); } }; } ]) .directive('kubernetesServiceGraph', [ "ServiceGrid", "KubeTranslate", "KubeFormat", function kubernetesServiceGraph(ServiceGrid, KubeTranslate, KubeFormat) { var _ = KubeTranslate.gettext; function service_graph(selector, highlighter) { var grid = ServiceGrid.new_grid(); var outer = d3.select(selector); var highlighted = null; /* Various tabs */ var tabs = { cpu: { label: _("CPU"), step: 1000 * 1000 * 1000, formatter: function(v) { return (v / (10 * 1000 * 1000)) + "%"; } }, memory: { label: _("Memory"), step: 1024 * 1024 * 64, formatter: function(v) { return KubeFormat.formatBytes(v); } }, network: { label: _("Network"), step: 1000 * 1000, formatter: function(v) { return KubeFormat.formatBitsPerSec(v, "Mbps"); } } }; outer.append("ul") .attr("class", "nav nav-tabs") .selectAll("li") .data(Object.keys(tabs)) .enter().append("li") .attr("data-metric", function(d) { return d; }) .append("a") .text(function(d) { return tabs[d].label; }); function metric_tab(tab) { outer.selectAll("ul li") .attr("class", function(d) { return tab === d ? "active": null; }); grid.metric(tab); } outer.selectAll("ul li") .on("click", function() { metric_tab(d3.select(this).attr("data-metric")); }); metric_tab("cpu"); /* The main svg graph stars here */ var margins = { top: 12, right: 15, bottom: 40, left: 60 }; var colors = d3.scale.category20(); var element = d3.select(selector).append("svg"); var stage = element.append("g") .attr("transform", "translate(" + margins.left + "," + margins.top + ")"); var y = d3.scale.linear(); var y_axis = d3.svg.axis() .scale(y) .ticks(5) .orient("left"); var y_group = stage.append("g") .attr("class", "y axis"); var x = d3.scale.linear(); var x_axis = d3.svg.axis() .scale(x) .orient("bottom"); var x_group = stage.append("g") .attr("class", "x axis"); var offset = 0; var line = d3.svg.line() .defined(function(d) { return d !== undefined; }) .x(function(d, i) { return x((grid.beg + i) - offset); }) .y(function(d, i) { return y(d); }); /* Initial display: 1024 px is 5 minutes of data */ var factor = 300000 / 1024; var width = 300; var height = 300; var changing = false; var rendered = false; window.setTimeout(function() { rendered = true; adjust(); }, 1); function ceil(value, step) { var d = value % step; if (value === 0 || d !== 0) value += (step - d); return value; } function jump() { var interval = grid.interval; var w = (width - margins.right) - margins.left; /* This doesn't yet work for an arbitary ponit in time */ var now = new Date().getTime(); var end = Math.floor(now / interval); var beg = end - Math.floor((factor * w) / interval); offset = beg; grid.move(beg, end); } function adjust() { if (!rendered) return; element .attr("width", width) .attr("height", height); var w = (width - margins.right) - margins.left; var h = (height - margins.top) - margins.bottom; var metric = grid.metric(); var interval = grid.interval; /* Calculate our maximum value, hopefully rows are tracking this for us */ var rows = grid.rows, maximum = 0; var i, max, len = rows.length; for (i = 0; i < len; i++) { if (rows[i].maximum !== undefined) max = rows[i].maximum; else max = d3.max(rows[i]); if (max > maximum) maximum = Math.ceil(max); } /* This doesn't yet work for an arbitary ponit in time */ var end = Math.floor((factor * w) / interval); x.domain([0, end]).range([0, w]); y.domain([0, ceil(maximum, tabs[metric].step)]).range([h, 0]); /* The ticks are inverted backwards */ var tsc = d3.scale.linear().domain([0, end]).range([end, 0]); /* Calculate ticks every 60 seconds in past */ var ticks = []; for (i = 60; i < end; i += 60) ticks.push(Math.round(tsc(i))); /* Make x-axis ticks into grid of right width */ x_axis .tickValues(ticks) .tickSize(-h, -h) .tickFormat(function(d) { d = Math.round(tsc.invert(d)); return (d / 60) + " min"; }); /* Re-render the X axis. Note that we also * bump down the labels a bit. */ x_group .attr("transform", "translate(0," + h + ")") .call(x_axis) .selectAll("text") .attr("y", "10px"); /* Turn the Y axis ticks into a grid */ y_axis .tickSize(-w, -w) .tickFormat(tabs[metric].formatter); y_group .call(y_axis) .selectAll("text") .attr("x", "-10px"); jump(); } function notified() { var rows = grid.rows; var series = stage.selectAll("path.line") .data(rows, function(d, i) { return i; }); var trans = series .style("stroke", function(d, i) { return colors(i); }) .attr("d", function(d) { return line(d); }) .classed("highlight", function(d) { return d.uid === highlighted; }); series.enter().append("path") .attr("class", "line") .on("mouseover", function() { highlighter(d3.select(this).datum().uid); }) .on("mouseout", function() { highlighter(null); }); series.exit().remove(); } grid.addEventListener('notify', notified); function changed() { adjust(); notified(); } grid.addEventListener('changed', changed); function resized() { width = selector.offsetWidth - 10; if (width < 0) width = 0; adjust(); } window.addEventListener('resize', resized); resized(); var timer = window.setInterval(jump, grid.interval); return { highlight: function highlight(uid) { highlighted = uid; notified(); }, close: function close() { window.removeEventListener('resize', resized); grid.removeEventListener('notify', notified); grid.removeEventListener('changed', changed); grid.close(); } }; } return { restrict: 'E', link: function($scope, element, attributes) { var graph = service_graph(element[0], function(uid) { $scope.$broadcast('highlight', uid); $scope.$digest(); }); $scope.$on("highlight", function(ev, uid) { graph.highlight(uid); }); element.on('$destroy', function() { graph.close(); graph = null; }); } }; } ]); }());
/* * Copyright (C) 2014 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef mozilla_nfcd_LlcpSocket_h #define mozilla_nfcd_LlcpSocket_h #include <vector> #include "ILlcpSocket.h" /** * LlcpClientSocket represents a LLCP Connection-Oriented client to be used in a * connection-oriented communication. */ class LlcpSocket : public ILlcpSocket { public: LlcpSocket(unsigned int aHandle, int aSap, int aMiu, int aRw); LlcpSocket(unsigned int aHandle, int aMiu, int aRw); virtual ~LlcpSocket(); /** * Establish a connection to the peer. * * @param aSap Establish a connection to the peer. * @return True if ok. */ bool ConnectToSap(int aSap); /** * Establish a connection to the peer. * * @param aSn Service name. * @return True if ok. */ bool ConnectToService(const char* aSn); /** * Close socket. * * @return True if ok. */ void Close(); /** * Send data to peer. * * @param aSendBuf Buffer of data. * @return True if sent ok. */ bool Send(std::vector<uint8_t>& aSendBuf); /** * Receive data from peer. * * @param aRecvBuf Buffer to put received data. * @return Buffer to put received data. */ int Receive(std::vector<uint8_t>& aRecvBuf); /** * Get peer's maximum information unit. * * @return Peer's maximum information unit. */ int GetRemoteMiu() const; /** * Peer's maximum information unit. * * @return Peer's receive window size. */ int GetRemoteRw() const; int GetLocalSap() const { return mSap; } int GetLocalMiu() const { return mLocalMiu; } int GetLocalRw() const { return mLocalRw; } private: uint32_t mHandle; int mSap; int mLocalMiu; int mLocalRw; bool DoConnect(int aSap); bool DoConnectBy(const char* aSn); bool DoClose(); bool DoSend(std::vector<uint8_t>& aData); int DoReceive(std::vector<uint8_t>& aRecvBuf); int DoGetRemoteSocketMIU() const; int DoGetRemoteSocketRW() const; }; #endif // mozilla_nfcd_LlcpSocket_h
/*! * FooTable - Awesome Responsive Tables * Version : 2.0.1.1 * http://fooplugins.com/plugins/footable-jquery/ * * Requires jQuery - http://jquery.com/ * * Copyright 2013 Steven Usher & Brad Vincent * Released under the MIT license * You are free to use FooTable in commercial projects as long as this copyright header is left intact. * * Date: 06 Sep 2013 */ (function ($, w, undefined) { w.footable = { options: { delay: 100, // The number of millseconds to wait before triggering the react event breakpoints: { // The different screen resolution breakpoints phone: 480, tablet: 1024 }, parsers: { // The default parser to parse the value out of a cell (values are used in building up row detail) alpha: function (cell) { return $(cell).data('value') || $.trim($(cell).text()); }, numeric: function (cell) { var val = $(cell).data('value') || $(cell).text().replace(/[^0-9.\-]/g, ''); val = parseFloat(val); if (isNaN(val)) val = 0; return val; } }, addRowToggle: true, calculateWidthOverride: null, toggleSelector: ' > tbody > tr:not(.footable-row-detail)', //the selector to show/hide the detail row columnDataSelector: '> thead > tr:last-child > th, > thead > tr:last-child > td', //the selector used to find the column data in the thead detailSeparator: ':', //the separator character used when building up the detail row toggleHTMLElement: '<span />', // override this if you want to insert a click target rather than use a background image. createGroupedDetail: function (data) { var groups = { '_none': { 'name': null, 'data': [] } }; for (var i = 0; i < data.length; i++) { var groupid = data[i].group; if (groupid !== null) { if (!(groupid in groups)) groups[groupid] = { 'name': data[i].groupName || data[i].group, 'data': [] }; groups[groupid].data.push(data[i]); } else { groups._none.data.push(data[i]); } } return groups; }, createDetail: function (element, data, createGroupedDetail, separatorChar, classes) { /// <summary>This function is used by FooTable to generate the detail view seen when expanding a collapsed row.</summary> /// <param name="element">This is the div that contains all the detail row information, anything could be added to it.</param> /// <param name="data"> /// This is an array of objects containing the cell information for the current row. /// These objects look like the below: /// obj = { /// 'name': String, // The name of the column /// 'value': Object, // The value parsed from the cell using the parsers. This could be a string, a number or whatever the parser outputs. /// 'display': String, // This is the actual HTML from the cell, so if you have images etc you want moved this is the one to use and is the default value used. /// 'group': String, // This is the identifier used in the data-group attribute of the column. /// 'groupName': String // This is the actual name of the group the column belongs to. /// } /// </param> /// <param name="createGroupedDetail">The grouping function to group the data</param> /// <param name="separatorChar">The separator charactor used</param> /// <param name="classes">The array of class names used to build up the detail row</param> var groups = createGroupedDetail(data); for (var group in groups) { if (groups[group].data.length === 0) continue; if (group !== '_none') element.append('<div class="' + classes.detailInnerGroup + '">' + groups[group].name + '</div>'); for (var j = 0; j < groups[group].data.length; j++) { var separator = (groups[group].data[j].name) ? separatorChar : ''; element.append('<div class="' + classes.detailInnerRow + '"><div class="' + classes.detailInnerName + '">' + groups[group].data[j].name + separator + '</div><div class="' + classes.detailInnerValue + '">' + groups[group].data[j].display + '</div></div>'); } } }, classes: { main: 'footable', loading: 'footable-loading', loaded: 'footable-loaded', toggle: 'footable-toggle', disabled: 'footable-disabled', detail: 'footable-row-detail', detailCell: 'footable-row-detail-cell', detailInner: 'footable-row-detail-inner', detailInnerRow: 'footable-row-detail-row', detailInnerGroup: 'footable-row-detail-group', detailInnerName: 'footable-row-detail-name', detailInnerValue: 'footable-row-detail-value', detailShow: 'footable-detail-show' }, triggers: { initialize: 'footable_initialize', //trigger this event to force FooTable to reinitialize resize: 'footable_resize', //trigger this event to force FooTable to resize redraw: 'footable_redraw', //trigger this event to force FooTable to redraw toggleRow: 'footable_toggle_row', //trigger this event to force FooTable to toggle a row expandFirstRow: 'footable_expand_first_row' //trigger this event to force FooTable to expand the first row }, events: { alreadyInitialized: 'footable_already_initialized', //fires when the FooTable has already been initialized initializing: 'footable_initializing', //fires before FooTable starts initializing initialized: 'footable_initialized', //fires after FooTable has finished initializing resizing: 'footable_resizing', //fires before FooTable resizes resized: 'footable_resized', //fires after FooTable has resized redrawn: 'footable_redrawn', //fires after FooTable has redrawn breakpoint: 'footable_breakpoint', //fires inside the resize function, when a breakpoint is hit columnData: 'footable_column_data', //fires when setting up column data. Plugins should use this event to capture their own info about a column rowDetailUpdating: 'footable_row_detail_updating', //fires before a detail row is updated rowDetailUpdated: 'footable_row_detail_updated', //fires when a detail row is being updated rowCollapsed: 'footable_row_collapsed', //fires when a row is collapsed rowExpanded: 'footable_row_expanded', //fires when a row is expanded rowRemoved: 'footable_row_removed', //fires when a row is removed reset: 'footable_reset' //fires when FooTable is reset }, debug: false, // Whether or not to log information to the console. log: null }, version: { major: 0, minor: 5, toString: function () { return w.footable.version.major + '.' + w.footable.version.minor; }, parse: function (str) { version = /(\d+)\.?(\d+)?\.?(\d+)?/.exec(str); return { major: parseInt(version[1], 10) || 0, minor: parseInt(version[2], 10) || 0, patch: parseInt(version[3], 10) || 0 }; } }, plugins: { _validate: function (plugin) { ///<summary>Simple validation of the <paramref name="plugin"/> to make sure any members called by FooTable actually exist.</summary> ///<param name="plugin">The object defining the plugin, this should implement a string property called "name" and a function called "init".</param> if (!$.isFunction(plugin)) { if (w.footable.options.debug === true) console.error('Validation failed, expected type "function", received type "{0}".', typeof plugin); return false; } var p = new plugin(); if (typeof p['name'] !== 'string') { if (w.footable.options.debug === true) console.error('Validation failed, plugin does not implement a string property called "name".', p); return false; } if (!$.isFunction(p['init'])) { if (w.footable.options.debug === true) console.error('Validation failed, plugin "' + p['name'] + '" does not implement a function called "init".', p); return false; } if (w.footable.options.debug === true) console.log('Validation succeeded for plugin "' + p['name'] + '".', p); return true; }, registered: [], // An array containing all registered plugins. register: function (plugin, options) { ///<summary>Registers a <paramref name="plugin"/> and its default <paramref name="options"/> with FooTable.</summary> ///<param name="plugin">The plugin that should implement a string property called "name" and a function called "init".</param> ///<param name="options">The default options to merge with the FooTable's base options.</param> if (w.footable.plugins._validate(plugin)) { w.footable.plugins.registered.push(plugin); if (typeof options === 'object') $.extend(true, w.footable.options, options); } }, load: function(instance){ var loaded = [], registered, i; for(i = 0; i < w.footable.plugins.registered.length; i++){ try { registered = w.footable.plugins.registered[i]; loaded.push(new registered(instance)); } catch (err) { if (w.footable.options.debug === true) console.error(err); } } return loaded; }, init: function (instance) { ///<summary>Loops through all registered plugins and calls the "init" method supplying the current <paramref name="instance"/> of the FooTable as the first parameter.</summary> ///<param name="instance">The current instance of the FooTable that the plugin is being initialized for.</param> for (var i = 0; i < instance.plugins.length; i++) { try { instance.plugins[i]['init'](instance); } catch (err) { if (w.footable.options.debug === true) console.error(err); } } } } }; var instanceCount = 0; $.fn.footable = function (options) { ///<summary>The main constructor call to initialize the plugin using the supplied <paramref name="options"/>.</summary> ///<param name="options"> ///<para>A JSON object containing user defined options for the plugin to use. Any options not supplied will have a default value assigned.</para> ///<para>Check the documentation or the default options object above for more information on available options.</para> ///</param> options = options || {}; var o = $.extend(true, {}, w.footable.options, options); //merge user and default options return this.each(function () { instanceCount++; var footable = new Footable(this, o, instanceCount); $(this).data('footable', footable); }); }; //helper for using timeouts function Timer() { ///<summary>Simple timer object created around a timeout.</summary> var t = this; t.id = null; t.busy = false; t.start = function (code, milliseconds) { ///<summary>Starts the timer and waits the specified amount of <paramref name="milliseconds"/> before executing the supplied <paramref name="code"/>.</summary> ///<param name="code">The code to execute once the timer runs out.</param> ///<param name="milliseconds">The time in milliseconds to wait before executing the supplied <paramref name="code"/>.</param> if (t.busy) { return; } t.stop(); t.id = setTimeout(function () { code(); t.id = null; t.busy = false; }, milliseconds); t.busy = true; }; t.stop = function () { ///<summary>Stops the timer if its runnning and resets it back to its starting state.</summary> if (t.id !== null) { clearTimeout(t.id); t.id = null; t.busy = false; } }; } function Footable(t, o, id) { ///<summary>Inits a new instance of the plugin.</summary> ///<param name="t">The main table element to apply this plugin to.</param> ///<param name="o">The options supplied to the plugin. Check the defaults object to see all available options.</param> ///<param name="id">The id to assign to this instance of the plugin.</param> var ft = this; ft.id = id; ft.table = t; ft.options = o; ft.breakpoints = []; ft.breakpointNames = ''; ft.columns = {}; ft.plugins = w.footable.plugins.load(ft); var opt = ft.options, cls = opt.classes, evt = opt.events, trg = opt.triggers, indexOffset = 0; // This object simply houses all the timers used in the FooTable. ft.timers = { resize: new Timer(), register: function (name) { ft.timers[name] = new Timer(); return ft.timers[name]; } }; ft.init = function () { var $window = $(w), $table = $(ft.table); w.footable.plugins.init(ft); if ($table.hasClass(cls.loaded)) { //already loaded FooTable for the table, so don't init again ft.raise(evt.alreadyInitialized); return; } //raise the initializing event ft.raise(evt.initializing); $table.addClass(cls.loading); // Get the column data once for the life time of the plugin $table.find(opt.columnDataSelector).each(function () { var data = ft.getColumnData(this); ft.columns[data.index] = data; }); // Create a nice friendly array to work with out of the breakpoints object. for (var name in opt.breakpoints) { ft.breakpoints.push({ 'name': name, 'width': opt.breakpoints[name] }); ft.breakpointNames += (name + ' '); } // Sort the breakpoints so the smallest is checked first ft.breakpoints.sort(function (a, b) { return a['width'] - b['width']; }); $table .unbind(trg.initialize) //bind to FooTable initialize trigger .bind(trg.initialize, function () { //remove previous "state" (to "force" a resize) $table.removeData('footable_info'); $table.data('breakpoint', ''); //trigger the FooTable resize $table.trigger(trg.resize); //remove the loading class $table.removeClass(cls.loading); //add the FooTable and loaded class $table.addClass(cls.loaded).addClass(cls.main); //raise the initialized event ft.raise(evt.initialized); }) .unbind(trg.redraw) //bind to FooTable redraw trigger .bind(trg.redraw, function () { ft.redraw(); }) .unbind(trg.resize) //bind to FooTable resize trigger .bind(trg.resize, function () { ft.resize(); }) .unbind(trg.expandFirstRow) //bind to FooTable expandFirstRow trigger .bind(trg.expandFirstRow, function () { $table.find(opt.toggleSelector).first().not('.' + cls.detailShow).trigger(trg.toggleRow); }); //trigger a FooTable initialize $table.trigger(trg.initialize); //bind to window resize $window .bind('resize.footable', function () { ft.timers.resize.stop(); ft.timers.resize.start(function () { ft.raise(trg.resize); }, opt.delay); }); }; ft.addRowToggle = function () { if (!opt.addRowToggle) return; var $table = $(ft.table), hasToggleColumn = false; //first remove all toggle spans $table.find('span.' + cls.toggle).remove(); for (var c in ft.columns) { var col = ft.columns[c]; if (col.toggle) { hasToggleColumn = true; var selector = '> tbody > tr:not(.' + cls.detail + ',.' + cls.disabled + ') > td:nth-child(' + (parseInt(col.index, 10) + 1) + ')'; $table.find(selector).not('.' + cls.detailCell).prepend($(opt.toggleHTMLElement).addClass(cls.toggle)); return; } } //check if we have an toggle column. If not then add it to the first column just to be safe if (!hasToggleColumn) { $table .find('> tbody > tr:not(.' + cls.detail + ',.' + cls.disabled + ') > td:first-child') .not('.' + cls.detailCell) .prepend($(opt.toggleHTMLElement).addClass(cls.toggle)); } }; ft.setColumnClasses = function () { $table = $(ft.table); for (var c in ft.columns) { var col = ft.columns[c]; if (col.className !== null) { var selector = '', first = true; $.each(col.matches, function (m, match) { //support for colspans if (!first) selector += ', '; selector += '> tbody > tr:not(.' + cls.detail + ') > td:nth-child(' + (parseInt(match, 10) + 1) + ')'; first = false; }); //add the className to the cells specified by data-class="blah" $table.find(selector).not('.' + cls.detailCell).addClass(col.className); } } }; //moved this out into it's own function so that it can be called from other add-ons ft.bindToggleSelectors = function () { var $table = $(ft.table); if (!ft.hasAnyBreakpointColumn()) return; $table.find(opt.toggleSelector).unbind(trg.toggleRow).bind(trg.toggleRow, function (e) { var $row = $(this).is('tr') ? $(this) : $(this).parents('tr:first'); ft.toggleDetail($row.get(0)); }); $table.find(opt.toggleSelector).unbind('click.footable').bind('click.footable', function (e) { if ($table.is('.breakpoint') && $(e.target).is('td,.'+ cls.toggle)) { $(this).trigger(trg.toggleRow); } }); }; ft.parse = function (cell, column) { var parser = opt.parsers[column.type] || opt.parsers.alpha; return parser(cell); }; ft.getColumnData = function (th) { var $th = $(th), hide = $th.data('hide'), index = $th.index(); hide = hide || ''; hide = jQuery.map(hide.split(','), function (a) { return jQuery.trim(a); }); var data = { 'index': index, 'hide': { }, 'type': $th.data('type') || 'alpha', 'name': $th.data('name') || $.trim($th.text()), 'ignore': $th.data('ignore') || false, 'toggle': $th.data('toggle') || false, 'className': $th.data('class') || null, 'matches': [], 'names': { }, 'group': $th.data('group') || null, 'groupName': null }; if (data.group !== null) { var $group = $(ft.table).find('> thead > tr.footable-group-row > th[data-group="' + data.group + '"], > thead > tr.footable-group-row > td[data-group="' + data.group + '"]').first(); data.groupName = ft.parse($group, { 'type': 'alpha' }); } var pcolspan = parseInt($th.prev().attr('colspan') || 0, 10); indexOffset += pcolspan > 1 ? pcolspan - 1 : 0; var colspan = parseInt($th.attr('colspan') || 0, 10), curindex = data.index + indexOffset; if (colspan > 1) { var names = $th.data('names'); names = names || ''; names = names.split(','); for (var i = 0; i < colspan; i++) { data.matches.push(i + curindex); if (i < names.length) data.names[i + curindex] = names[i]; } } else { data.matches.push(curindex); } data.hide['default'] = ($th.data('hide') === "all") || ($.inArray('default', hide) >= 0); var hasBreakpoint = false; for (var name in opt.breakpoints) { data.hide[name] = ($th.data('hide') === "all") || ($.inArray(name, hide) >= 0); hasBreakpoint = hasBreakpoint || data.hide[name]; } data.hasBreakpoint = hasBreakpoint; var e = ft.raise(evt.columnData, { 'column': { 'data': data, 'th': th } }); return e.column.data; }; ft.getViewportWidth = function () { return window.innerWidth || (document.body ? document.body.offsetWidth : 0); }; ft.calculateWidth = function ($table, info) { if (jQuery.isFunction(opt.calculateWidthOverride)) { return opt.calculateWidthOverride($table, info); } if (info.viewportWidth < info.width) info.width = info.viewportWidth; if (info.parentWidth < info.width) info.width = info.parentWidth; return info; }; ft.hasBreakpointColumn = function (breakpoint) { for (var c in ft.columns) { if (ft.columns[c].hide[breakpoint]) { if (ft.columns[c].ignore) { continue; } return true; } } return false; }; ft.hasAnyBreakpointColumn = function () { for (var c in ft.columns) { if (ft.columns[c].hasBreakpoint) { return true; } } return false; }; ft.resize = function () { var $table = $(ft.table); if (!$table.is(':visible')) { return; } //we only care about FooTables that are visible if (!ft.hasAnyBreakpointColumn()) { return; } //we only care about FooTables that have breakpoints var info = { 'width': $table.width(), //the table width 'viewportWidth': ft.getViewportWidth(), //the width of the viewport 'parentWidth': $table.parent().width() //the width of the parent }; info = ft.calculateWidth($table, info); var pinfo = $table.data('footable_info'); $table.data('footable_info', info); ft.raise(evt.resizing, { 'old': pinfo, 'info': info }); // This (if) statement is here purely to make sure events aren't raised twice as mobile safari seems to do if (!pinfo || (pinfo && pinfo.width && pinfo.width !== info.width)) { var current = null, breakpoint; for (var i = 0; i < ft.breakpoints.length; i++) { breakpoint = ft.breakpoints[i]; if (breakpoint && breakpoint.width && info.width <= breakpoint.width) { current = breakpoint; break; } } var breakpointName = (current === null ? 'default' : current['name']), hasBreakpointFired = ft.hasBreakpointColumn(breakpointName), previousBreakpoint = $table.data('breakpoint'); $table .data('breakpoint', breakpointName) .removeClass('default breakpoint').removeClass(ft.breakpointNames) .addClass(breakpointName + (hasBreakpointFired ? ' breakpoint' : '')); //only do something if the breakpoint has changed if (breakpointName !== previousBreakpoint) { //trigger a redraw $table.trigger(trg.redraw); //raise a breakpoint event ft.raise(evt.breakpoint, { 'breakpoint': breakpointName, 'info': info }); } } ft.raise(evt.resized, { 'old': pinfo, 'info': info }); }; ft.redraw = function () { //add the toggler to each row ft.addRowToggle(); //bind the toggle selector click events ft.bindToggleSelectors(); //set any cell classes defined for the columns ft.setColumnClasses(); var $table = $(ft.table), breakpointName = $table.data('breakpoint'), hasBreakpointFired = ft.hasBreakpointColumn(breakpointName); $table .find('> tbody > tr:not(.' + cls.detail + ')').data('detail_created', false).end() .find('> thead > tr:last-child > th') .each(function () { var data = ft.columns[$(this).index()], selector = '', first = true; $.each(data.matches, function (m, match) { if (!first) { selector += ', '; } var count = match + 1; selector += '> tbody > tr:not(.' + cls.detail + ') > td:nth-child(' + count + ')'; selector += ', > tfoot > tr:not(.' + cls.detail + ') > td:nth-child(' + count + ')'; selector += ', > colgroup > col:nth-child(' + count + ')'; first = false; }); selector += ', > thead > tr[data-group-row="true"] > th[data-group="' + data.group + '"]'; var $column = $table.find(selector).add(this); if (data.hide[breakpointName] === false) $column.show(); else $column.hide(); if ($table.find('> thead > tr.footable-group-row').length === 1) { var $groupcols = $table.find('> thead > tr:last-child > th[data-group="' + data.group + '"]:visible, > thead > tr:last-child > th[data-group="' + data.group + '"]:visible'), $group = $table.find('> thead > tr.footable-group-row > th[data-group="' + data.group + '"], > thead > tr.footable-group-row > td[data-group="' + data.group + '"]'), groupspan = 0; $.each($groupcols, function () { groupspan += parseInt($(this).attr('colspan') || 1, 10); }); if (groupspan > 0) $group.attr('colspan', groupspan).show(); else $group.hide(); } }) .end() .find('> tbody > tr.' + cls.detailShow).each(function () { ft.createOrUpdateDetailRow(this); }); $table.find('> tbody > tr.' + cls.detailShow + ':visible').each(function () { var $next = $(this).next(); if ($next.hasClass(cls.detail)) { if (!hasBreakpointFired) $next.hide(); else $next.show(); } }); // adding .footable-first-column and .footable-last-column to the first and last th and td of each row in order to allow // for styling if the first or last column is hidden (which won't work using :first-child or :last-child) $table.find('> thead > tr > th.footable-last-column, > tbody > tr > td.footable-last-column').removeClass('footable-last-column'); $table.find('> thead > tr > th.footable-first-column, > tbody > tr > td.footable-first-column').removeClass('footable-first-column'); $table.find('> thead > tr, > tbody > tr') .find('> th:visible:last, > td:visible:last') .addClass('footable-last-column') .end() .find('> th:visible:first, > td:visible:first') .addClass('footable-first-column'); ft.raise(evt.redrawn); }; ft.toggleDetail = function (row) { var $row = (row.jquery) ? row : $(row), $next = $row.next(); //check if the row is already expanded if ($row.hasClass(cls.detailShow)) { $row.removeClass(cls.detailShow); //only hide the next row if it's a detail row if ($next.hasClass(cls.detail)) $next.hide(); ft.raise(evt.rowCollapsed, { 'row': $row[0] }); } else { ft.createOrUpdateDetailRow($row[0]); $row.addClass(cls.detailShow); $row.next().show(); ft.raise(evt.rowExpanded, { 'row': $row[0] }); } }; ft.removeRow = function (row) { var $row = (row.jquery) ? row : $(row); if ($row.hasClass(cls.detail)) { $row = $row.prev(); } var $next = $row.next(); if ($row.data('detail_created') === true) { //remove the detail row $next.remove(); } $row.remove(); //raise event ft.raise(evt.rowRemoved); }; ft.appendRow = function (row) { var $row = (row.jquery) ? row : $(row); $(ft.table).find('tbody').append($row); //redraw the table ft.redraw(); }; ft.getColumnFromTdIndex = function (index) { /// <summary>Returns the correct column data for the supplied index taking into account colspans.</summary> /// <param name="index">The index to retrieve the column data for.</param> /// <returns type="json">A JSON object containing the column data for the supplied index.</returns> var result = null; for (var column in ft.columns) { if ($.inArray(index, ft.columns[column].matches) >= 0) { result = ft.columns[column]; break; } } return result; }; ft.createOrUpdateDetailRow = function (actualRow) { var $row = $(actualRow), $next = $row.next(), $detail, values = []; if ($row.data('detail_created') === true) return true; if ($row.is(':hidden')) return false; //if the row is hidden for some reason (perhaps filtered) then get out of here ft.raise(evt.rowDetailUpdating, { 'row': $row, 'detail': $next }); $row.find('> td:hidden').each(function () { var index = $(this).index(), column = ft.getColumnFromTdIndex(index), name = column.name; if (column.ignore === true) return true; if (index in column.names) name = column.names[index]; values.push({ 'name': name, 'value': ft.parse(this, column), 'display': $.trim($(this).html()), 'group': column.group, 'groupName': column.groupName }); return true; }); if (values.length === 0) return false; //return if we don't have any data to show var colspan = $row.find('> td:visible').length; var exists = $next.hasClass(cls.detail); if (!exists) { // Create $next = $('<tr class="' + cls.detail + '"><td class="' + cls.detailCell + '"><div class="' + cls.detailInner + '"></div></td></tr>'); $row.after($next); } $next.find('> td:first').attr('colspan', colspan); $detail = $next.find('.' + cls.detailInner).empty(); opt.createDetail($detail, values, opt.createGroupedDetail, opt.detailSeparator, cls); $row.data('detail_created', true); ft.raise(evt.rowDetailUpdated, { 'row': $row, 'detail': $next }); return !exists; }; ft.raise = function (eventName, args) { if (ft.options.debug === true && $.isFunction(ft.options.log)) ft.options.log(eventName, 'event'); args = args || { }; var def = { 'ft': ft }; $.extend(true, def, args); var e = $.Event(eventName, def); if (!e.ft) { $.extend(true, e, def); } //pre jQuery 1.6 which did not allow data to be passed to event object constructor $(ft.table).trigger(e); return e; }; //reset the state of FooTable ft.reset = function() { var $table = $(ft.table); $table.removeData('footable_info') .data('breakpoint', '') .removeClass(cls.loading) .removeClass(cls.loaded); $table.find(opt.toggleSelector).unbind(trg.toggleRow).unbind('click.footable'); $table.find('> tbody > tr').removeClass(cls.detailShow); $table.find('> tbody > tr.' + cls.detail).remove(); ft.raise(evt.reset); }; ft.init(); return ft; } })(jQuery, window);
// #docregion import { Injectable } from '@angular/core'; import { FormBuilder, Validators } from '@angular/common'; import { QuestionBase } from './question-base'; @Injectable() export class QuestionControlService { constructor(private fb: FormBuilder) { } toControlGroup(questions: QuestionBase<any>[] ) { let group = {}; questions.forEach(question => { group[question.key] = question.required ? [question.value || '', Validators.required] : [question.value || '']; }); return this.fb.group(group); } }
"=========== Meta ============ "StrID : 1835 "Title : Vim 异步运行 Shell 指令的插件 - AsyncRun "Slug : "Cats : 随笔 "Tags : Vim "============================= "EditType : post "EditFormat : Markdown "TextAttach : "========== Content ========== 自制另一个新的 Vim 8.0 专用异步插件:[asyncrun.vim](https://github.com/skywind3000/asyncrun.vim),它可以让你在 Vim 里面异步运行各种 Shell 指令并且把结果实时输出到 Quickfix,需要 Vim 7.4.1829 以上版本。 **安装方法** 到插件首页 [https://github.com/skywind3000/asyncrun.vim](https://github.com/skywind3000/asyncrun.vim) 下载项目,并拷贝 `asyncrun.vim` 到你的 `~/.vim/plugin`。或者使用 Vundle 指向 `skywind3000/asyncrun.vim` 来自动更新。 **基本教程** 使用 gcc 异步编译当前文件: ```text :AsyncRun gcc % -o %< :AsyncRun g++ -O3 % -o %< -lpthread ``` 该命令会在后台运行 gcc 并且把输出实时显示在 Quickfix 窗口,宏 `%` 代表当前文件名,`%<` 代表没有扩展名的文件名。 异步运行 make: ```text :AsyncRun make :AsyncRun make -f makefile ``` 异步调用 grep: ```text :AsyncRun! grep -R word . :AsyncRun! grep -R <cword> . ``` 默认 :AsyncRun 运行命令后,输出添加到 Quickfix时 Quickfix 会自动滚动到最下面那一行,使用感叹号修饰符以后,可以避免 Quickfix 自动滚动。同时 `<cword>` 代表当前光标下面的单词。 编译 go项目: ```text :AsyncRun go build %:p:h ``` 宏 `%:p:h` 代表当前文件的目录 查询 man page,异步 git push ,以及把设置 F7异步编译当前文件: ```text :AsyncRun! man -S 3:2:1 <cword> :AsyncRun git push origin master :noremap <F7> :AsyncRun gcc % -o %< <cr> ``` **使用手册** AsyncRun - Run shell command: ```text :AsyncRun{!} [cmd] ... ``` 后台运行命令并且实时输出到 quickfix 窗口,如果有感叹号修饰符,quickfix 窗口的自动滚动将会禁止。 命令参数以空格分割,接受下面这些以 '`%`', '`#`' or '`<`' 开头的替换宏: ```text %:p - File name of current buffer with full path %:t - File name of current buffer without path %:p:h - File path of current buffer without file name %:e - File extension of current buffer %:t:r - File name of current buffer without path and extension % - File name relativize to current directory %:h:. - File path relativize to current directory <cwd> - Current working directory <cword> - Current word under cursor <cfile> - Current file name under cursor ``` 运行一个命令前,环境变量也会做如下设置: ```text $VIM_FILEPATH - File name of current buffer with full path $VIM_FILENAME - File name of current buffer without path $VIM_FILEDIR - Full path of current buffer without the file name $VIM_FILEEXT - File extension of current buffer $VIM_FILENOEXT - File name of current buffer without path and extension $VIM_CWD - Current directory $VIM_RELDIR - File path relativize to current directory $VIM_RELNAME - File name relativize to current directory $VIM_CWORD - Current word under cursor $VIM_CFILE - Current filename under cursor $VIM_GUI - Is running under gui ? $VIM_VERSION - Value of v:version $VIM_MODE - Execute via 0:!, 1:makeprg, 2:system() $VIM_COLUMNS - How many columns in vim's screen $VIM_LINES - How many lines in vim's screen ``` AsyncStop - Stop the running job: ```text :AsyncStop{!} ``` 停止后台任务(使用 TERM信号),如果有感叹号修饰,则使用 KILL 信号结束 基本设置: ```text g:asyncrun_exit - 字符串,如果不为空那么任务结束时会被执行(VimScript) g:asyncrun_bell - 如果非零的话,任务结束后会响铃(终端输出控制符 \a) g:asyncrun_mode - 0:异步(需要 vim 7.4.1829) 1:同步 2:直接运行 ``` 全局变量: ```text g:asyncrun_code - 退出码 g:asyncrun_status - 状态 'running', 'success' or 'failure' ``` 如果你喜欢的话请为我投一票: [http://www.vim.org/scripts/script.php?script_id=5431](http://www.vim.org/scripts/script.php?script_id=5431)
// // libavg - Media Playback Engine. // Copyright (C) 2003-2011 Ulrich von Zadow // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Current versions can be found at www.libavg.de // #ifndef _SyncVideoDecoder_H_ #define _SyncVideoDecoder_H_ #include "../avgconfigwrapper.h" #include "VideoDecoder.h" #include "FFMpegDemuxer.h" #include "FFMpegFrameDecoder.h" namespace avg { class AVG_API SyncVideoDecoder: public VideoDecoder { public: SyncVideoDecoder(); virtual ~SyncVideoDecoder(); virtual void open(const std::string& sFilename, bool bUseHardwareAcceleration, bool bEnableSound); virtual void startDecoding(bool bDeliverYCbCr, const AudioParams* pAP); virtual void close(); virtual int getCurFrame() const; virtual int getNumFramesQueued() const; virtual float getCurTime() const; virtual float getFPS() const; virtual void setFPS(float fps); virtual FrameAvailableCode renderToBmps(std::vector<BitmapPtr>& pBmps, float timeWanted); virtual void throwAwayFrame(float timeWanted); virtual void seek(float destTime); virtual void loop(); virtual bool isEOF() const; private: FrameAvailableCode readFrameForTime(AVFrame* pFrame, float timeWanted); void readFrame(AVFrame* pFrame); FFMpegFrameDecoderPtr m_pFrameDecoder; bool m_bVideoSeekDone; FFMpegDemuxer * m_pDemuxer; bool m_bProcessingLastFrames; bool m_bFirstPacket; bool m_bUseStreamFPS; float m_FPS; AVFrame* m_pFrame; }; typedef boost::shared_ptr<SyncVideoDecoder> SyncVideoDecoderPtr; } #endif
(function() { 'use strict'; describe('ToDo project', function () { it('should set up testing boilerplate code', function () { expect(true).toBe(true); }); }); }());
<?php $name='DejaVuSerifCondensed'; $type='TTF'; $desc=array ( 'CapHeight' => 729, 'XHeight' => 519, 'FontBBox' => '[-693 -347 1512 1109]', 'Flags' => 4, 'Ascent' => 928, 'Descent' => -236, 'Leading' => 0, 'ItalicAngle' => 0, 'StemV' => 87, 'MissingWidth' => 540, ); $unitsPerEm=2048; $up=-63; $ut=44; $strp=259; $strs=50; $ttffile='/Users/apple/Dropbox/www/anovacg/sites/all/libraries/mpdf/ttfonts/DejaVuSerifCondensed.ttf'; $TTCfontID='0'; $originalsize=334040; $sip=false; $smp=false; $BMPselected=true; $fontkey='dejavuserifcondensed'; $panose=' 0 0 2 6 6 6 5 6 5 2 2 4'; $haskerninfo=true; $haskernGPOS=false; $hassmallcapsGSUB=false; $fontmetrics='win'; // TypoAscender/TypoDescender/TypoLineGap = 760, -240, 200 // usWinAscent/usWinDescent = 928, -236 // hhea Ascent/Descent/LineGap = 928, -236, 0 $useOTL=0x0000; $rtlPUAstr=''; $kerninfo=array ( 45 => array ( 84 => -35, 86 => -72, 87 => -54, 88 => -35, 89 => -109, 221 => -109, 356 => -35, 376 => -109, ), 65 => array ( 84 => -54, 86 => -49, 87 => -40, 89 => -40, 102 => -17, 116 => -17, 118 => -40, 119 => -44, 121 => -40, 221 => -40, 253 => -40, 255 => -40, 354 => -54, 355 => -17, 356 => -54, 357 => -17, 372 => -40, 373 => -44, 374 => -40, 375 => -40, 376 => -40, 538 => -54, 539 => -17, 562 => -40, 7808 => -40, 7809 => -44, 7810 => -40, 7811 => -44, 7812 => -40, 7813 => -44, 7922 => -40, 7923 => -40, 8217 => -146, 8221 => -146, 64256 => -17, 64257 => -17, 64258 => -17, ), 66 => array ( 45 => 18, 67 => 18, 71 => 18, 79 => 18, 89 => -17, 199 => 18, 210 => 18, 211 => 18, 212 => 18, 213 => 18, 214 => 18, 216 => 18, 221 => -17, 262 => 18, 264 => 18, 266 => 18, 268 => 18, 284 => 18, 286 => 18, 288 => 18, 290 => 18, 332 => 18, 334 => 18, 336 => 18, 338 => 18, 374 => -17, 376 => -17, 490 => 18, 492 => 18, 558 => 18, 562 => -17, ), 67 => array ( 44 => -35, 46 => -35, ), 68 => array ( 44 => -35, 45 => 18, 46 => -35, 86 => -17, ), 69 => array ( 45 => 18, ), 70 => array ( 44 => -155, 45 => -44, 46 => -155, 58 => -35, 59 => -35, 65 => -86, 97 => -67, 101 => -54, 111 => -54, 192 => -86, 193 => -86, 194 => -86, 195 => -86, 196 => -86, 224 => -67, 225 => -67, 226 => -67, 227 => -67, 228 => -67, 229 => -67, 230 => -67, 232 => -54, 233 => -54, 234 => -54, 235 => -54, 242 => -54, 243 => -54, 244 => -54, 245 => -54, 246 => -54, 248 => -54, 256 => -86, 257 => -67, 258 => -86, 259 => -67, 260 => -86, 261 => -67, 275 => -54, 277 => -54, 279 => -54, 281 => -54, 283 => -54, 333 => -54, 335 => -54, 337 => -54, 339 => -54, 483 => -67, 491 => -54, 493 => -54, 559 => -54, ), 71 => array ( 44 => -35, 45 => 18, 46 => -35, 89 => -17, 221 => -17, 376 => -17, ), 74 => array ( 44 => -58, 46 => -77, 58 => -40, 59 => -40, ), 75 => array ( 45 => -72, 65 => -40, 67 => -26, 79 => -26, 85 => -35, 87 => -35, 89 => -26, 101 => -26, 111 => -26, 117 => -21, 121 => -63, 192 => -40, 193 => -40, 194 => -40, 195 => -40, 196 => -40, 199 => -26, 210 => -26, 211 => -26, 212 => -26, 213 => -26, 214 => -26, 216 => -26, 217 => -35, 218 => -35, 219 => -35, 220 => -35, 221 => -26, 232 => -26, 233 => -26, 234 => -26, 235 => -26, 242 => -26, 243 => -26, 244 => -26, 245 => -26, 246 => -26, 248 => -17, 249 => -21, 250 => -21, 251 => -21, 252 => -21, 253 => -63, 255 => -63, 262 => -26, 268 => -26, 283 => -26, 338 => -26, 339 => -26, 366 => -35, 367 => -21, 376 => -26, ), 76 => array ( 84 => -81, 85 => -54, 86 => -118, 87 => -86, 89 => -63, 121 => -17, 217 => -54, 218 => -54, 219 => -54, 220 => -54, 221 => -63, 253 => -17, 255 => -17, 356 => -81, 366 => -54, 376 => -63, 8217 => -239, 8221 => -239, ), 78 => array ( 44 => -63, 46 => -63, 58 => -35, 59 => -35, ), 79 => array ( 44 => -58, 45 => 36, 46 => -58, 86 => -17, 88 => -17, ), 80 => array ( 44 => -202, 45 => -54, 46 => -202, 58 => -35, 59 => -35, 65 => -91, 85 => -17, 97 => -44, 101 => -44, 111 => -40, 115 => -26, 192 => -91, 193 => -91, 194 => -91, 195 => -91, 196 => -91, 217 => -17, 218 => -17, 219 => -17, 220 => -17, 224 => -44, 225 => -44, 226 => -44, 227 => -44, 228 => -44, 229 => -44, 230 => -44, 232 => -44, 233 => -44, 234 => -44, 235 => -44, 242 => -40, 243 => -40, 244 => -40, 245 => -40, 246 => -40, 248 => -40, 283 => -44, 339 => -40, 351 => -26, 353 => -26, 366 => -17, ), 81 => array ( 44 => -49, 45 => 36, 46 => -49, 8217 => 18, 8221 => 18, ), 82 => array ( 84 => -17, 86 => -35, 87 => -21, 89 => -30, 97 => 22, 121 => -17, 221 => -30, 224 => 22, 225 => 22, 226 => 22, 227 => 22, 228 => 22, 229 => 22, 230 => 22, 248 => 18, 253 => -17, 255 => -17, 356 => -17, 376 => -30, 8217 => -54, 8221 => -54, ), 83 => array ( 44 => -35, 45 => 36, 46 => -35, 83 => -17, 350 => -17, 352 => -17, ), 84 => array ( 44 => -146, 45 => -128, 46 => -146, 58 => -35, 59 => -35, 65 => -54, 84 => 18, 97 => -77, 99 => -77, 101 => -77, 111 => -77, 115 => -72, 119 => -35, 192 => -54, 193 => -54, 194 => -54, 195 => -54, 196 => -54, 224 => -28, 225 => -77, 226 => -28, 227 => -28, 228 => -28, 229 => -28, 230 => -77, 231 => -77, 232 => -48, 233 => -77, 234 => -48, 235 => -48, 242 => -38, 243 => -77, 244 => -38, 245 => -38, 246 => -38, 248 => -77, 263 => -77, 269 => -77, 283 => -77, 339 => -77, 351 => -72, 353 => -72, 356 => 18, ), 85 => array ( 44 => -91, 45 => -17, 46 => -91, 58 => -35, 59 => -35, 65 => -30, 74 => -26, 192 => -30, 193 => -30, 194 => -30, 195 => -30, 196 => -30, ), 86 => array ( 44 => -174, 45 => -91, 46 => -174, 58 => -100, 59 => -100, 65 => -67, 79 => -17, 97 => -91, 101 => -91, 105 => -17, 111 => -91, 117 => -63, 121 => -40, 192 => -67, 193 => -67, 194 => -67, 195 => -67, 196 => -67, 210 => -17, 211 => -17, 212 => -17, 213 => -17, 214 => -17, 216 => -17, 224 => -91, 225 => -91, 226 => -91, 227 => -91, 228 => -91, 229 => -91, 230 => -91, 232 => -91, 233 => -91, 234 => -91, 235 => -91, 242 => -91, 243 => -91, 244 => -91, 245 => -91, 246 => -91, 248 => -91, 249 => -63, 250 => -63, 251 => -63, 252 => -63, 253 => -40, 255 => -40, 283 => -91, 338 => -17, 339 => -91, 367 => -63, 8217 => 36, 8221 => 36, ), 87 => array ( 44 => -174, 45 => -72, 46 => -174, 58 => -86, 59 => -86, 65 => -49, 97 => -86, 101 => -81, 105 => -17, 111 => -67, 114 => -44, 117 => -40, 121 => -21, 192 => -49, 193 => -49, 194 => -49, 195 => -49, 196 => -49, 224 => -86, 225 => -86, 226 => -86, 227 => -86, 228 => -86, 229 => -86, 230 => -67, 232 => -81, 233 => -81, 234 => -81, 235 => -81, 242 => -67, 243 => -67, 244 => -67, 245 => -67, 246 => -67, 248 => -67, 249 => -40, 250 => -40, 251 => -40, 252 => -40, 253 => -21, 255 => -21, 283 => -81, 339 => -67, 341 => -44, 345 => -44, 367 => -40, 8217 => 18, 8221 => 18, ), 88 => array ( 45 => -35, 65 => -35, 67 => -17, 79 => -17, 192 => -35, 193 => -35, 194 => -35, 195 => -35, 196 => -35, 199 => -17, 210 => -17, 211 => -17, 212 => -17, 213 => -17, 214 => -17, 216 => -17, 262 => -17, 268 => -17, 338 => -17, ), 89 => array ( 44 => -128, 45 => -109, 46 => -128, 58 => -123, 59 => -123, 65 => -77, 67 => -17, 97 => -77, 101 => -86, 105 => -17, 111 => -86, 117 => -86, 192 => -77, 193 => -77, 194 => -77, 195 => -77, 196 => -77, 199 => -17, 224 => -77, 225 => -77, 226 => -77, 227 => -77, 228 => -77, 229 => -77, 230 => -95, 232 => -86, 233 => -86, 234 => -86, 235 => -86, 242 => -86, 243 => -86, 244 => -86, 245 => -86, 246 => -86, 248 => -86, 249 => -86, 250 => -86, 251 => -86, 252 => -86, 262 => -17, 268 => -17, 283 => -86, 339 => -104, 367 => -86, ), 90 => array ( 44 => -17, 46 => -17, ), 102 => array ( 44 => -35, 45 => -35, 46 => -35, 8217 => 73, 8220 => 18, 8221 => 73, ), 107 => array ( 45 => -17, ), 111 => array ( 46 => -17, ), 114 => array ( 44 => -109, 46 => -109, ), 118 => array ( 44 => -118, 46 => -118, ), 119 => array ( 44 => -118, 46 => -118, ), 120 => array ( 45 => -17, ), 121 => array ( 44 => -132, 46 => -132, ), 192 => array ( 84 => -54, 86 => -49, 87 => -40, 89 => -40, 102 => -17, 116 => -17, 118 => -40, 119 => -44, 121 => -40, 221 => -40, 253 => -40, 255 => -40, 354 => -54, 355 => -17, 356 => -54, 357 => -17, 372 => -40, 373 => -44, 374 => -40, 375 => -40, 376 => -40, 538 => -54, 539 => -17, 562 => -40, 7808 => -40, 7809 => -44, 7810 => -40, 7811 => -44, 7812 => -40, 7813 => -44, 7922 => -40, 7923 => -40, 8217 => -146, 8221 => -146, 64256 => -17, 64257 => -17, 64258 => -17, ), 193 => array ( 84 => -54, 86 => -49, 87 => -40, 89 => -40, 102 => -17, 116 => -17, 118 => -40, 119 => -44, 121 => -40, 221 => -40, 253 => -40, 255 => -40, 354 => -54, 355 => -17, 356 => -54, 357 => -17, 372 => -40, 373 => -44, 374 => -40, 375 => -40, 376 => -40, 538 => -54, 539 => -17, 562 => -40, 7808 => -40, 7809 => -44, 7810 => -40, 7811 => -44, 7812 => -40, 7813 => -44, 7922 => -40, 7923 => -40, 8217 => -146, 8221 => -146, 64256 => -17, 64257 => -17, 64258 => -17, ), 194 => array ( 84 => -54, 86 => -49, 87 => -40, 89 => -40, 102 => -17, 116 => -17, 118 => -40, 119 => -44, 121 => -40, 221 => -40, 253 => -40, 255 => -40, 354 => -54, 355 => -17, 356 => -54, 357 => -17, 372 => -40, 373 => -44, 374 => -40, 375 => -40, 376 => -40, 538 => -54, 539 => -17, 562 => -40, 7808 => -40, 7809 => -44, 7810 => -40, 7811 => -44, 7812 => -40, 7813 => -44, 7922 => -40, 7923 => -40, 8217 => -146, 8221 => -146, 64256 => -17, 64257 => -17, 64258 => -17, ), 195 => array ( 84 => -54, 86 => -49, 87 => -40, 89 => -40, 102 => -17, 116 => -17, 118 => -40, 119 => -44, 121 => -40, 221 => -40, 253 => -40, 255 => -40, 354 => -54, 355 => -17, 356 => -54, 357 => -17, 372 => -40, 373 => -44, 374 => -40, 375 => -40, 376 => -40, 538 => -54, 539 => -17, 562 => -40, 7808 => -40, 7809 => -44, 7810 => -40, 7811 => -44, 7812 => -40, 7813 => -44, 7922 => -40, 7923 => -40, 8217 => -146, 8221 => -146, 64256 => -17, 64257 => -17, 64258 => -17, ), 196 => array ( 84 => -54, 86 => -49, 87 => -40, 89 => -40, 102 => -17, 116 => -17, 118 => -40, 119 => -44, 121 => -40, 221 => -40, 253 => -40, 255 => -40, 354 => -54, 355 => -17, 356 => -54, 357 => -17, 372 => -40, 373 => -44, 374 => -40, 375 => -40, 376 => -40, 538 => -54, 539 => -17, 562 => -40, 7808 => -40, 7809 => -44, 7810 => -40, 7811 => -44, 7812 => -40, 7813 => -44, 7922 => -40, 7923 => -40, 8217 => -146, 8221 => -146, 64256 => -17, 64257 => -17, 64258 => -17, ), 198 => array ( 45 => 18, ), 199 => array ( 44 => -35, 46 => -35, ), 200 => array ( 45 => 18, ), 201 => array ( 45 => 18, ), 202 => array ( 45 => 18, ), 203 => array ( 45 => 18, ), 208 => array ( 44 => -35, 45 => 36, 46 => -35, 65 => -17, 86 => -17, 89 => -17, 192 => -17, 193 => -17, 194 => -17, 195 => -17, 196 => -17, 221 => -17, 376 => -17, ), 209 => array ( 44 => -63, 46 => -63, 58 => -35, 59 => -35, ), 210 => array ( 44 => -58, 45 => 36, 46 => -58, 86 => -17, 88 => -17, ), 211 => array ( 44 => -58, 45 => 36, 46 => -58, 86 => -17, 88 => -17, ), 212 => array ( 44 => -58, 45 => 36, 46 => -58, 86 => -17, 88 => -17, ), 213 => array ( 44 => -58, 45 => 36, 46 => -58, 86 => -17, 88 => -17, ), 214 => array ( 44 => -58, 45 => 36, 46 => -58, 86 => -17, 88 => -17, ), 216 => array ( 44 => -58, 45 => 36, 46 => -58, 86 => -17, 88 => -17, ), 217 => array ( 44 => -91, 45 => -17, 46 => -91, 58 => -35, 59 => -35, 65 => -30, 74 => -26, 192 => -30, 193 => -30, 194 => -30, 195 => -30, 196 => -30, ), 218 => array ( 44 => -91, 45 => -17, 46 => -91, 58 => -35, 59 => -35, 65 => -30, 74 => -26, 192 => -30, 193 => -30, 194 => -30, 195 => -30, 196 => -30, ), 219 => array ( 44 => -91, 45 => -17, 46 => -91, 58 => -35, 59 => -35, 65 => -30, 74 => -26, 192 => -30, 193 => -30, 194 => -30, 195 => -30, 196 => -30, ), 220 => array ( 44 => -91, 45 => -17, 46 => -91, 58 => -35, 59 => -35, 65 => -30, 74 => -26, 192 => -30, 193 => -30, 194 => -30, 195 => -30, 196 => -30, ), 221 => array ( 44 => -128, 45 => -109, 46 => -128, 58 => -123, 59 => -123, 65 => -77, 67 => -17, 97 => -77, 101 => -86, 105 => -17, 111 => -86, 117 => -86, 192 => -77, 193 => -77, 194 => -77, 195 => -77, 196 => -77, 199 => -17, 224 => -77, 225 => -77, 226 => -77, 227 => -77, 228 => -77, 229 => -77, 230 => -95, 232 => -86, 233 => -86, 234 => -86, 235 => -86, 242 => -86, 243 => -86, 244 => -86, 245 => -86, 246 => -86, 248 => -86, 249 => -86, 250 => -86, 251 => -86, 252 => -86, 262 => -17, 268 => -17, 283 => -86, 339 => -104, 367 => -86, ), 222 => array ( 44 => -165, 45 => 18, 46 => -165, ), 240 => array ( 46 => -17, ), 242 => array ( 46 => -17, ), 243 => array ( 46 => -17, ), 244 => array ( 46 => -17, ), 245 => array ( 46 => -17, ), 246 => array ( 46 => -17, ), 248 => array ( 46 => -17, ), 253 => array ( 44 => -132, 46 => -132, ), 254 => array ( 44 => -17, 46 => -49, ), 255 => array ( 44 => -132, 46 => -132, ), 256 => array ( 84 => -54, 86 => -49, 87 => -40, 89 => -40, 102 => -17, 116 => -17, 118 => -40, 119 => -44, 121 => -40, 221 => -40, 253 => -40, 255 => -40, 354 => -54, 355 => -17, 356 => -54, 357 => -17, 372 => -40, 373 => -44, 374 => -40, 375 => -40, 376 => -40, 538 => -54, 539 => -17, 562 => -40, 7808 => -40, 7809 => -44, 7810 => -40, 7811 => -44, 7812 => -40, 7813 => -44, 7922 => -40, 7923 => -40, 8217 => -146, 8221 => -146, 64256 => -17, 64257 => -17, 64258 => -17, ), 258 => array ( 84 => -54, 86 => -49, 87 => -40, 89 => -40, 102 => -17, 116 => -17, 118 => -40, 119 => -44, 121 => -40, 221 => -40, 253 => -40, 255 => -40, 354 => -54, 355 => -17, 356 => -54, 357 => -17, 372 => -40, 373 => -44, 374 => -40, 375 => -40, 376 => -40, 538 => -54, 539 => -17, 562 => -40, 7808 => -40, 7809 => -44, 7810 => -40, 7811 => -44, 7812 => -40, 7813 => -44, 7922 => -40, 7923 => -40, 8217 => -146, 8221 => -146, 64256 => -17, 64257 => -17, 64258 => -17, ), 260 => array ( 84 => -54, 86 => -49, 87 => -40, 89 => -40, 102 => -17, 116 => -17, 118 => -40, 119 => -44, 121 => -40, 221 => -40, 253 => -40, 255 => -40, 354 => -54, 355 => -17, 356 => -54, 357 => -17, 372 => -40, 373 => -44, 374 => -40, 375 => -40, 376 => -40, 538 => -54, 539 => -17, 562 => -40, 7808 => -40, 7809 => -44, 7810 => -40, 7811 => -44, 7812 => -40, 7813 => -44, 7922 => -40, 7923 => -40, 8217 => -146, 8221 => -146, 64256 => -17, 64257 => -17, 64258 => -17, ), 262 => array ( 44 => -35, 46 => -35, ), 264 => array ( 44 => -35, 46 => -35, ), 266 => array ( 44 => -35, 46 => -35, ), 268 => array ( 44 => -35, 46 => -35, ), 270 => array ( 44 => -35, 45 => 18, 46 => -35, 86 => -17, ), 272 => array ( 44 => -35, 45 => 18, 46 => -35, 86 => -17, ), 282 => array ( 45 => 18, ), 286 => array ( 44 => -35, 45 => 18, 46 => -35, 89 => -17, 221 => -17, 376 => -17, ), 313 => array ( 84 => -81, 85 => -54, 86 => -118, 87 => -86, 89 => -63, 121 => -17, 217 => -54, 218 => -54, 219 => -54, 220 => -54, 221 => -63, 253 => -17, 255 => -17, 356 => -81, 366 => -54, 376 => -63, 8217 => -239, 8221 => -239, ), 317 => array ( 84 => -81, 85 => -54, 86 => -118, 87 => -86, 89 => -63, 121 => -17, 217 => -54, 218 => -54, 219 => -54, 220 => -54, 221 => -63, 253 => -17, 255 => -17, 356 => -81, 366 => -54, 376 => -63, 8217 => -239, 8221 => -239, ), 320 => array ( 108 => -110, ), 321 => array ( 84 => -81, 85 => -17, 86 => -118, 87 => -86, 89 => -100, 121 => -17, 217 => -17, 218 => -17, 219 => -17, 220 => -17, 221 => -100, 253 => -17, 255 => -17, 356 => -81, 366 => -17, 376 => -100, 8217 => -239, 8221 => -239, ), 327 => array ( 44 => -63, 46 => -63, 58 => -35, 59 => -35, ), 338 => array ( 45 => 18, ), 340 => array ( 84 => -17, 86 => -35, 87 => -21, 89 => -30, 97 => 22, 121 => -17, 221 => -30, 224 => 22, 225 => 22, 226 => 22, 227 => 22, 228 => 22, 229 => 22, 230 => 22, 248 => 18, 253 => -17, 255 => -17, 356 => -17, 376 => -30, 8217 => -54, 8221 => -54, ), 341 => array ( 44 => -109, 46 => -109, ), 344 => array ( 84 => -17, 86 => -35, 87 => -21, 89 => -30, 97 => 22, 121 => -17, 221 => -30, 224 => 22, 225 => 22, 226 => 22, 227 => 22, 228 => 22, 229 => 22, 230 => 22, 248 => 18, 253 => -17, 255 => -17, 356 => -17, 376 => -30, 8217 => -54, 8221 => -54, ), 345 => array ( 44 => -109, 46 => -109, ), 350 => array ( 44 => -35, 45 => 36, 46 => -35, 83 => -17, 350 => -17, 352 => -17, ), 352 => array ( 44 => -35, 45 => 36, 46 => -35, 83 => -17, 350 => -17, 352 => -17, ), 356 => array ( 44 => -146, 45 => -128, 46 => -146, 58 => -35, 59 => -35, 65 => -54, 84 => 18, 97 => -77, 99 => -77, 101 => -77, 111 => -77, 115 => -72, 119 => -35, 192 => -54, 193 => -54, 194 => -54, 195 => -54, 196 => -54, 224 => -77, 225 => -77, 226 => -77, 227 => -77, 228 => -77, 229 => -77, 230 => -77, 231 => -77, 232 => -77, 233 => -77, 234 => -77, 235 => -77, 242 => -77, 243 => -77, 244 => -77, 245 => -77, 246 => -77, 248 => -77, 263 => -77, 269 => -77, 283 => -77, 339 => -77, 351 => -72, 353 => -72, 356 => 18, ), 366 => array ( 44 => -91, 45 => -17, 46 => -91, 58 => -35, 59 => -35, 65 => -30, 74 => -26, 192 => -30, 193 => -30, 194 => -30, 195 => -30, 196 => -30, ), 373 => array ( 44 => -149, 46 => -133, 97 => 53, 99 => 41, 100 => 47, 101 => 41, 102 => 107, 103 => 47, 105 => 107, 106 => 106, 109 => 61, 110 => 61, 111 => 41, 112 => 68, 113 => 47, 114 => 61, 115 => 75, 116 => 114, 117 => 70, 118 => 100, 119 => 81, 120 => 84, 121 => 100, 122 => 87, 373 => 127, 64256 => 107, ), 376 => array ( 44 => -128, 45 => -109, 46 => -128, 58 => -123, 59 => -123, 65 => -77, 67 => -17, 97 => -77, 101 => -86, 105 => -17, 111 => -86, 117 => -86, 192 => -77, 193 => -77, 194 => -77, 195 => -77, 196 => -77, 199 => -17, 224 => -77, 225 => -77, 226 => -77, 227 => -77, 228 => -77, 229 => -77, 230 => -95, 232 => -86, 233 => -86, 234 => -86, 235 => -86, 242 => -86, 243 => -86, 244 => -86, 245 => -86, 246 => -86, 248 => -86, 249 => -86, 250 => -86, 251 => -86, 252 => -86, 262 => -17, 268 => -17, 283 => -86, 339 => -104, 367 => -86, ), 381 => array ( 44 => -17, 46 => -17, ), 699 => array ( 65 => -128, 74 => 22, 192 => -128, 193 => -128, 194 => -128, 195 => -128, 196 => -128, 198 => -109, ), 8208 => array ( 84 => -35, 86 => -72, 87 => -54, 88 => -35, 89 => -109, 221 => -109, 356 => -35, 376 => -109, ), 8216 => array ( 65 => -128, 74 => 22, 192 => -128, 193 => -128, 194 => -128, 195 => -128, 196 => -128, 198 => -109, ), 8220 => array ( 65 => -128, 74 => 22, 86 => 27, 87 => 27, 88 => 27, 89 => 27, 192 => -128, 193 => -128, 194 => -128, 195 => -128, 196 => -128, 198 => -146, 221 => 27, 376 => 27, ), 8222 => array ( 84 => -35, 86 => -54, 87 => -35, 88 => 27, 89 => -35, 118 => -17, 119 => -17, 221 => -35, 356 => -35, 376 => -35, ), 42816 => array ( 45 => -72, 65 => -40, 67 => -26, 79 => -26, 85 => -35, 87 => -35, 89 => -26, 101 => -26, 111 => -26, 117 => -21, 121 => -63, 192 => -40, 193 => -40, 194 => -40, 195 => -40, 196 => -40, 199 => -26, 210 => -26, 211 => -26, 212 => -26, 213 => -26, 214 => -26, 216 => -26, 217 => -35, 218 => -35, 219 => -35, 220 => -35, 221 => -26, 232 => -26, 233 => -26, 234 => -26, 235 => -26, 242 => -26, 243 => -26, 244 => -26, 245 => -26, 246 => -26, 248 => -17, 249 => -21, 250 => -21, 251 => -21, 252 => -21, 253 => -63, 255 => -63, 262 => -26, 268 => -26, 283 => -26, 338 => -26, 339 => -26, 366 => -35, 367 => -21, 376 => -26, ), 42817 => array ( 45 => -17, ), 64256 => array ( 44 => -35, 45 => -35, 46 => -35, 8217 => 73, 8220 => 18, 8221 => 73, ), ); ?>
--- layout: page title: Township Helix Holdings Party date: 2016-05-24 author: Joseph Olsen tags: weekly links, java status: published summary: Aenean mauris est, posuere eget enim vel, fringilla blandit dolor. banner: images/banner/meeting-01.jpg booking: startDate: 09/17/2017 endDate: 09/18/2017 ctyhocn: MEMMAHX groupCode: THHP published: true --- Vestibulum sit amet iaculis nibh. Quisque rutrum urna vel tristique pretium. Duis at feugiat dolor. Proin ac porta quam, quis suscipit ex. Cras viverra in justo ac fringilla. Fusce efficitur ante rhoncus aliquam scelerisque. Suspendisse eleifend, diam quis cursus venenatis, metus magna convallis turpis, quis molestie dolor dolor eu dui. Ut vehicula id eros eu convallis. Proin quis facilisis enim, a euismod dolor. Donec vitae diam quis nulla consequat luctus. Fusce eget tincidunt elit. Curabitur nec laoreet justo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur eu ante egestas, luctus ex ac, vestibulum eros. Nulla finibus enim est, quis congue tellus fringilla a. Nullam accumsan nisl augue, quis euismod lorem dapibus nec. Nunc ornare venenatis tortor, at pulvinar ligula ultricies sit amet. Curabitur finibus purus ultrices neque bibendum, sed sodales augue dapibus. * Duis sed ligula congue, tincidunt nulla consectetur, rhoncus ligula * Sed a quam nec elit tristique pellentesque * Nulla ut ipsum eu ante efficitur bibendum * Pellentesque eget magna egestas dui volutpat maximus ac vel massa. Nunc imperdiet lectus felis, eget hendrerit turpis tincidunt non. Sed bibendum purus et commodo viverra. Cras quis pharetra neque. Quisque a sodales est, nec ultrices velit. Vivamus blandit maximus elit at luctus. Duis vel orci vitae nulla tempor bibendum quis ac tellus. Nunc cursus consequat nunc, vitae sagittis turpis lacinia vel.
<!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <ul></ul> <script src="./jquery-1.11.2.min.js"></script> <script> $(document).ready(function (){ update(); }); function update(){ $.getJSON("indicator.php",function (data){ var inidicators = []; $("ul").empty(); $.each(data.result, function (){ inidicators.push(this['indicator']); }); console.log(inidicators); }); } </script> </body> </html>
#include "minunit.h" #include "../src/model.h" void set_state( uint32_t *, int , int ); void set_ioState( int, int ); int voidPtr_to_int( void * ); void createAvr( char *, char *, char *); void setupGdb( int ); int loadGsimavrCore( char * ); void unloadCore( void ); uint32_t expected; uint32_t noConnection; uint32_t powerPins; uint32_t powerState; uint32_t ddrPins; uint32_t outputState; uint32_t inputState; MU_TEST( set_state___setOfftoOn ) { expected = 0b0000000000000000000000000010; uint32_t test_val = 0b0000000000000000000000000000; set_state( &test_val, 2, 1 ); mu_assert_uint32_eq( expected, test_val ); } MU_TEST( set_state___setOntoOff ) { expected = 0b0000000000000000000000000100; uint32_t test_val = 0b0000000000000000000000000110; set_state( &test_val, 2, 0 ); mu_assert_uint32_eq( expected, test_val ); } MU_TEST( set_ddr___setOfftoOn ) { expected = 0b0000000000000000000000001110; ddrPins = 0b0000000000000000000000001100; // 1=output 0=input set_ddr( 2, 1 ); mu_assert_uint32_eq( expected, ddrPins ); } MU_TEST( set_ddr___setOntoOff ) { expected = 0b0000000000000000000000000100; ddrPins = 0b0000000000000000000000001100; // 1=output 0=input set_ddr( 4, 0 ); mu_assert_uint32_eq( expected, ddrPins ); } MU_TEST( set_ioState___output___setOntoOff ) { expected = 0b0000000000000000000000000010; ddrPins = 0b0000000000000000000000001100; // 1=output 0=input outputState = 0b0000000000000000000000000110; inputState = 0b0000000000000000000000000110; set_ioState( 3, 0 ); mu_assert_uint32_eq( expected, outputState ); mu_assert_uint32_eq( 0b0000000000000000000000000110, inputState ); } MU_TEST( set_ioState___output___setOfftoOn ) { uint32_t expected = 0b00000000000000000000000000001110; ddrPins = 0b0000000000000000000000001100; // 1=output 0=input outputState = 0b0000000000000000000000000110; inputState = 0b0000000000000000000000000110; set_ioState( 4, 1 ); mu_assert_uint32_eq( expected, outputState ); mu_assert_uint32_eq( 0b0000000000000000000000000110, inputState ); } MU_TEST( set_ioState___input___setOntoOff ) { uint32_t expected = 0b00000000000000000000000000000100; ddrPins = 0b0000000000000000000000001100; // 1=output 0=input outputState = 0b0000000000000000000000000110; inputState = 0b0000000000000000000000000110; set_ioState( 2, 0 ); mu_assert_uint32_eq( expected, inputState ); mu_assert_uint32_eq( 0b0000000000000000000000000110, outputState ); } MU_TEST( set_ioState___input___setOfftoOn ) { uint32_t expected = 0b00000000000000000000000000000111; ddrPins = 0b0000000000000000000000001100; // 1=output 0=input outputState = 0b0000000000000000000000000110; inputState = 0b0000000000000000000000000110; set_ioState( 1, 1 ); mu_assert_uint32_eq( expected, inputState ); mu_assert_uint32_eq( 0b0000000000000000000000000110, outputState ); } MU_TEST( voidPtr_to_int___undef ) { int input = '\0'; void *ptr = &input; int output = voidPtr_to_int( ptr ); mu_assert( output == 0, "Output incorrectly is not zero" ); } MU_TEST( voidPtr_to_int___string ) { char *input = "Some string\0"; void *ptr = input; int output = voidPtr_to_int( ptr ); mu_assert( output == 1701670739, "Output incorrectly is not int int value of the string" ); } MU_TEST( voidPtr_to_int___int ) { int input = 12345; void *ptr = &input; int output = voidPtr_to_int( ptr ); mu_assert( output == 12345, "Output incorrectly is not 12345" ); } MU_TEST( get_positive_power___correct ) { expected = 0b0000000000100000000; uint32_t actual = get_positive_power(); mu_assert_uint32_eq( expected, actual ); } MU_TEST( get_negative_power___correct ) { expected = 0b0000000001000000000; uint32_t actual = get_negative_power(); mu_assert_uint32_eq( expected, actual ); } MU_TEST( get_positive_outputs___correct ) { expected = 0b0000000000011000000; uint32_t actual = get_positive_outputs(); mu_assert_uint32_eq( expected, actual ); } MU_TEST( get_negative_outputs___correct ) { expected = 0b0000000000000110000; uint32_t actual = get_negative_outputs(); mu_assert_uint32_eq( expected, actual ); } MU_TEST( get_positive_inputs___correct ) { expected = 0b0000000000000001010; uint32_t actual = get_positive_inputs(); mu_assert_uint32_eq( expected, actual ); } MU_TEST( get_negative_inputs___correct ) { expected = 0b11111111111110000000000000000101; uint32_t actual = get_negative_inputs(); mu_assert_uint32_eq( expected, actual ); } MU_TEST( setupSimulator___fails ) { int ret = setupSimulator( 1 ); unloadCore(); mu_assert( ret == 1, "setupSimulator expected to fail with '1'" ); } MU_TEST( createAvr___completes ) { createAvr( WRAPPEDFIRMWAREDIR, WRAPPEDFIRMWARENAME, WRAPPEDFIRMWAREMCU ); int ret = loadGsimavrCore( "atmega328p" ); mu_assert( 0 == ret, "createAvr did not complete" ); } MU_TEST( setupGdb___waitForGdb___completes ) { setupGdb( 1 ); mu_assert( 1 == 1, "setupGdn did not complete" ); } MU_TEST( setupGdb___noGdb___completes ) { setupGdb( 0 ); mu_assert( 1 == 1, "setupGdn did not complete" ); } MU_TEST( unloadCore___completes ) { unloadCore(); mu_assert( 1 == 1, "unloadCore complete" ); } MU_TEST( loadGsimavrCore___unknown___fails ) { int ret = loadGsimavrCore( "UNKNOWN" ); mu_assert( ret == 1, "loadGsimavrCore did not fail as expected" ); } MU_TEST( loadGsimavrCore___atmega328p___completes ) { createAvr( WRAPPEDFIRMWAREDIR, WRAPPEDFIRMWARENAME, WRAPPEDFIRMWAREMCU ); int ret = loadGsimavrCore( "atmega328p" ); mu_assert( ret == 0, "loadGsimavrCore did not complete" ); mu_assert_string_eq( "ATmega328P", CHIPNAME() ); mu_assert( PINS == 28, "Device does not report 28 pins" ); mu_assert_string_eq( "BCD", REGISTERS() ); } MU_TEST( reg_pin_to_location___atmega328p___port_A ) { int pin = reg_pin_to_location( 'A', 0 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 1 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 2 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 3 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 4 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 5 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'a', 6 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'a', 7 ); mu_assert( pin == 0, "Incorrect pin reference" ); } MU_TEST( reg_pin_to_location___atmega328p___port_B ) { int pin = reg_pin_to_location( 'B', 0 ); mu_assert( pin == 14, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 1 ); mu_assert( pin == 15, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 2 ); mu_assert( pin == 16, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 3 ); mu_assert( pin == 17, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 4 ); mu_assert( pin == 18, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 5 ); mu_assert( pin == 19, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 6 ); mu_assert( pin == 9, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 7 ); mu_assert( pin == 10, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 8 ); mu_assert( pin == 0, "Incorrect pin reference" ); } MU_TEST( reg_pin_to_location___atmega328p___port_C ) { int pin = reg_pin_to_location( 'C', 0 ); mu_assert( pin == 23, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 1 ); mu_assert( pin == 24, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 2 ); mu_assert( pin == 25, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 3 ); mu_assert( pin == 26, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 4 ); mu_assert( pin == 27, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 5 ); mu_assert( pin == 28, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 6 ); mu_assert( pin == 1, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 7 ); mu_assert( pin == 0, "Incorrect pin reference" ); } MU_TEST( reg_pin_to_location___atmega328p___port_D ) { int pin = reg_pin_to_location( 'D', 0 ); mu_assert( pin == 2, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 1 ); mu_assert( pin == 3, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 2 ); mu_assert( pin == 4, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 3 ); mu_assert( pin == 5, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 4 ); mu_assert( pin == 6, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 5 ); mu_assert( pin == 11, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 6 ); mu_assert( pin == 12, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 7 ); mu_assert( pin == 13, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 8 ); mu_assert( pin == 0, "Incorrect pin reference" ); } MU_TEST( reg_pin_to_location___atmega328p___port_E ) { int pin = reg_pin_to_location( 'E', 0 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'E', 1 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'E', 2 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'E', 3 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'E', 4 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'E', 5 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'E', 6 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'E', 7 ); mu_assert( pin == 0, "Incorrect pin reference" ); } MU_TEST( unloadCore___atmega328p___completes ) { unloadCore(); mu_assert( PINS == 2, "Device does not report 2 pins" ); } MU_TEST( loadGsimavrCore___attiny2313___completes ) { createAvr( WRAPPEDFIRMWAREDIR, WRAPPEDFIRMWARENAME, WRAPPEDFIRMWAREMCU ); int ret = loadGsimavrCore( "attiny2313" ); mu_assert( ret == 0, "loadGsimavrCore did not complete" ); mu_assert_string_eq( "ATtiny2313", CHIPNAME() ); mu_assert( PINS == 20, "Device does not report 20 pins" ); mu_assert_string_eq( "ABD", REGISTERS() ); } MU_TEST( reg_pin_to_location___attiny2313___port_A ) { int pin = reg_pin_to_location( 'A', 0 ); mu_assert( pin == 5, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 1 ); mu_assert( pin == 4, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 2 ); mu_assert( pin == 1, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 3 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 4 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 5 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 6 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 7 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 8 ); mu_assert( pin == 0, "Incorrect pin reference" ); } MU_TEST( reg_pin_to_location___attiny2313___port_B ) { int pin = reg_pin_to_location( 'B', 0 ); mu_assert( pin == 12, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 1 ); mu_assert( pin == 13, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 2 ); mu_assert( pin == 14, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 3 ); mu_assert( pin == 15, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 4 ); mu_assert( pin == 16, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 5 ); mu_assert( pin == 17, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 6 ); mu_assert( pin == 18, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 7 ); mu_assert( pin == 19, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 8 ); mu_assert( pin == 0, "Incorrect pin reference" ); } MU_TEST( reg_pin_to_location___attiny2313___port_C ) { int pin = reg_pin_to_location( 'C', 0 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 1 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 2 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 3 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 4 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 5 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 6 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 7 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'C', 8 ); mu_assert( pin == 0, "Incorrect pin reference" ); } MU_TEST( reg_pin_to_location___attiny2313___port_D ) { int pin = reg_pin_to_location( 'D', 0 ); mu_assert( pin == 2, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 1 ); mu_assert( pin == 3, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 2 ); mu_assert( pin == 6, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 3 ); mu_assert( pin == 7, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 4 ); mu_assert( pin == 8, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 5 ); mu_assert( pin == 9, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 6 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 7 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'D', 8 ); mu_assert( pin == 0, "Incorrect pin reference" ); } MU_TEST( unloadCore___attiny2313___completes ) { unloadCore(); mu_assert( PINS == 2, "Device does not report 2 pins" ); } MU_TEST( loadGsimavrCore___attiny13___completes ) { createAvr( WRAPPEDFIRMWAREDIR, WRAPPEDFIRMWARENAME, WRAPPEDFIRMWAREMCU ); int ret = loadGsimavrCore( "attiny13" ); mu_assert( ret == 0, "loadGsimavrCore did not complete" ); mu_assert_string_eq( "ATtiny13", CHIPNAME() ); mu_assert( PINS == 8, "Device does not report 20 pins" ); mu_assert_string_eq( "B", REGISTERS() ); } MU_TEST( reg_pin_to_location___attiny13___port_A ) { int pin = reg_pin_to_location( 'A', 0 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 1 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 2 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 3 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 4 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 5 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 6 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 7 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'A', 8 ); mu_assert( pin == 0, "Incorrect pin reference" ); } MU_TEST( reg_pin_to_location___attiny13___port_B ) { int pin = reg_pin_to_location( 'B', 0 ); mu_assert( pin == 5, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 1 ); mu_assert( pin == 6, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 2 ); mu_assert( pin == 7, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 3 ); mu_assert( pin == 2, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 4 ); mu_assert( pin == 3, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 5 ); mu_assert( pin == 1, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 6 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 7 ); mu_assert( pin == 0, "Incorrect pin reference" ); pin = reg_pin_to_location( 'B', 8 ); mu_assert( pin == 0, "Incorrect pin reference" ); } MU_TEST( unloadCore___attiny13___completes ) { unloadCore(); mu_assert( PINS == 2, "Device does not report 2 pins" ); } MU_TEST_SUITE( test_model ) { MU_RUN_TEST( set_state___setOfftoOn ); MU_RUN_TEST( set_state___setOntoOff ); MU_RUN_TEST( set_ddr___setOfftoOn ); MU_RUN_TEST( set_ddr___setOntoOff ); MU_RUN_TEST( set_ioState___output___setOntoOff ); MU_RUN_TEST( set_ioState___output___setOfftoOn ); MU_RUN_TEST( set_ioState___input___setOntoOff ); MU_RUN_TEST( set_ioState___input___setOfftoOn ); MU_RUN_TEST( voidPtr_to_int___undef ); MU_RUN_TEST( voidPtr_to_int___string ); MU_RUN_TEST( voidPtr_to_int___int ); noConnection = 0b1111111110000000000; powerPins = 0b1100000001100000000; powerState = 0b1000000000100000000; ddrPins = 0b0001111000011110000; outputState = 0b0001100100011001100; inputState = 0b0001010010010101010; MU_RUN_TEST( get_positive_power___correct ); MU_RUN_TEST( get_negative_power___correct ); MU_RUN_TEST( get_positive_outputs___correct ); MU_RUN_TEST( get_negative_outputs___correct ); MU_RUN_TEST( get_positive_inputs___correct ); MU_RUN_TEST( get_negative_inputs___correct ); MU_RUN_TEST( setupSimulator___fails ); MU_RUN_TEST( createAvr___completes ); MU_RUN_TEST( setupGdb___waitForGdb___completes ); MU_RUN_TEST( setupGdb___noGdb___completes ); MU_RUN_TEST( unloadCore___completes ); MU_RUN_TEST( loadGsimavrCore___unknown___fails ); MU_RUN_TEST( loadGsimavrCore___atmega328p___completes ); MU_RUN_TEST( reg_pin_to_location___atmega328p___port_A ); MU_RUN_TEST( reg_pin_to_location___atmega328p___port_B ); MU_RUN_TEST( reg_pin_to_location___atmega328p___port_C ); MU_RUN_TEST( reg_pin_to_location___atmega328p___port_D ); MU_RUN_TEST( reg_pin_to_location___atmega328p___port_E ); MU_RUN_TEST( unloadCore___atmega328p___completes ); MU_RUN_TEST( loadGsimavrCore___attiny2313___completes ); MU_RUN_TEST( reg_pin_to_location___attiny2313___port_A ); MU_RUN_TEST( reg_pin_to_location___attiny2313___port_B ); MU_RUN_TEST( reg_pin_to_location___attiny2313___port_C ); MU_RUN_TEST( reg_pin_to_location___attiny2313___port_D ); MU_RUN_TEST( unloadCore___attiny2313___completes ); MU_RUN_TEST( loadGsimavrCore___attiny13___completes ); MU_RUN_TEST( reg_pin_to_location___attiny13___port_A ); MU_RUN_TEST( reg_pin_to_location___attiny13___port_B ); MU_RUN_TEST( unloadCore___attiny13___completes ); }
/* * Copyright (c) 2014, STMicroelectronics International N.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef __RNG_SUPPORT_H__ #define __RNG_SUPPORT_H__ #include <stdint.h> uint8_t hw_get_random_byte(void); #endif /* __RNG_SUPPORT_H__ */
using System; using NBitcoin.BouncyCastle.Math; using NBitcoin.BouncyCastle.Math.EC.Multiplier; using NBitcoin.BouncyCastle.Security; using NBitcoin.BouncyCastle.Utilities; namespace NBitcoin.BouncyCastle.Crypto.Generators { internal class DHParametersHelper { private static readonly BigInteger Six = BigInteger.ValueOf(6); private static readonly int[][] primeLists = BigInteger.primeLists; private static readonly int[] primeProducts = BigInteger.primeProducts; private static readonly BigInteger[] BigPrimeProducts = ConstructBigPrimeProducts(primeProducts); private static BigInteger[] ConstructBigPrimeProducts(int[] primeProducts) { BigInteger[] bpp = new BigInteger[primeProducts.Length]; for (int i = 0; i < bpp.Length; ++i) { bpp[i] = BigInteger.ValueOf(primeProducts[i]); } return bpp; } /* * Finds a pair of prime BigInteger's {p, q: p = 2q + 1} * * (see: Handbook of Applied Cryptography 4.86) */ internal static BigInteger[] GenerateSafePrimes(int size, int certainty, SecureRandom random) { BigInteger p, q; int qLength = size - 1; int minWeight = size >> 2; if (size <= 32) { for (;;) { q = new BigInteger(qLength, 2, random); p = q.ShiftLeft(1).Add(BigInteger.One); if (!p.IsProbablePrime(certainty)) continue; if (certainty > 2 && !q.IsProbablePrime(certainty - 2)) continue; break; } } else { // Note: Modified from Java version for speed for (;;) { q = new BigInteger(qLength, 0, random); retry: for (int i = 0; i < primeLists.Length; ++i) { int test = q.Remainder(BigPrimeProducts[i]).IntValue; if (i == 0) { int rem3 = test % 3; if (rem3 != 2) { int diff = 2 * rem3 + 2; q = q.Add(BigInteger.ValueOf(diff)); test = (test + diff) % primeProducts[i]; } } int[] primeList = primeLists[i]; for (int j = 0; j < primeList.Length; ++j) { int prime = primeList[j]; int qRem = test % prime; if (qRem == 0 || qRem == (prime >> 1)) { q = q.Add(Six); goto retry; } } } if (q.BitLength != qLength) continue; if (!q.RabinMillerTest(2, random)) continue; p = q.ShiftLeft(1).Add(BigInteger.One); if (!p.RabinMillerTest(certainty, random)) continue; if (certainty > 2 && !q.RabinMillerTest(certainty - 2, random)) continue; /* * Require a minimum weight of the NAF representation, since low-weight primes may be * weak against a version of the number-field-sieve for the discrete-logarithm-problem. * * See "The number field sieve for integers of low weight", Oliver Schirokauer. */ if (WNafUtilities.GetNafWeight(p) < minWeight) continue; break; } } return new BigInteger[] { p, q }; } /* * Select a high order element of the multiplicative group Zp* * * p and q must be s.t. p = 2*q + 1, where p and q are prime (see generateSafePrimes) */ internal static BigInteger SelectGenerator(BigInteger p, BigInteger q, SecureRandom random) { BigInteger pMinusTwo = p.Subtract(BigInteger.Two); BigInteger g; /* * (see: Handbook of Applied Cryptography 4.80) */ // do // { // g = BigIntegers.CreateRandomInRange(BigInteger.Two, pMinusTwo, random); // } // while (g.ModPow(BigInteger.Two, p).Equals(BigInteger.One) // || g.ModPow(q, p).Equals(BigInteger.One)); /* * RFC 2631 2.2.1.2 (and see: Handbook of Applied Cryptography 4.81) */ do { BigInteger h = BigIntegers.CreateRandomInRange(BigInteger.Two, pMinusTwo, random); g = h.ModPow(BigInteger.Two, p); } while (g.Equals(BigInteger.One)); return g; } } }
/** * Copyright (c) 2014 Stefan Feilmeier <stefan.feilmeier@fenecon.de>. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ package org.openhab.binding.fems.internal.essprotocol.modbus; public class ReservedElement implements ModbusElement { private int length; public ReservedElement(int fromAddress, int toAddress) { this.length = toAddress-fromAddress+1; } public ReservedElement(int address) { this(address, address); } public int getLength() { return length; } @Override public String getName() { return null; } }
/* * Copyright 2002-2018 Jalal Kiswani. * E-mail: Kiswani.Jalal@Gmail.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.jk.db.util.test.examples.beans; // TODO: Auto-generated Javadoc /** * The Class Department. * * @author Jalal Kiswani */ public class Department { /** The id. */ int id; /** The name. */ String name; /** * Gets the id. * * @return the id */ public int getId() { return id; } /** * Sets the id. * * @param id the new id */ public void setId(int id) { this.id = id; } /** * Gets the name. * * @return the name */ public String getName() { return name; } /** * Sets the name. * * @param name the new name */ public void setName(String name) { this.name = name; } }
/** * ______ ___ * / ____/___ / | _____________ __________ * / / __/ __ \/ /| |/ ___/ ___/ _ \/ ___/ ___/ * / /_/ / /_/ / ___ / /__/ /__/ __(__ |__ ) * \____/\____/_/ |_\___/\___/\___/____/____/ * * The MIT License (MIT) * Copyright (c) 2009-2016 Gerardo Orellana <hello @ goaccess.io> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef GOACCESS_H_INCLUDED #define GOACCESS_H_INCLUDED #include "ui.h" extern GSpinner *parsing_spinner; extern int active_gdns; /* kill dns pthread flag */ void read_client (void *ptr_data); #endif
\documentclass[t, aspectratio=169,xcolor={svgnames}, 10pt, handout]{beamer} \usepackage{rangapreamble} \usetheme{CambridgeUS} \usecolortheme{rose} %\import{}{Contents} \title{EN1060 Signals and Systems: Fourier Transform} \author{Ranga Rodrigo} \author[]{Ranga Rodrigo\\ \texttt{ranga@uom.lk}} \institute[]{The University of Moratuwa, Sri Lanka} \date{\today} \begin{document} \begin{frame} \titlepage \end{frame} %\import{a_introduction/}{body} %\import{b_signals/}{body} %\import{c_fourier_series/}{body} \import{d_fourier_transform/}{body} %\import{e_fourier_transform_properties/}{body} %\import{f_lti/}{body} %\import{g_dt_fs/}{body} %\import{h_dtft/}{body} %\import{h_dtft/}{test1} %\import{i_laplace/}{body} %\import{j_z_transform/}{body} %\import{k_sampling/}{body} %\import{}{test} \end{document}
/* * ACIDE - A Configurable IDE * Official web site: http://acide.sourceforge.net * * Copyright (C) 2007-2011 * Authors: * - Fernando Sáenz Pérez (Team Director). * - Version from 0.1 to 0.6: * - Diego Cardiel Freire. * - Juan José Ortiz Sánchez. * - Delfín Rupérez Cañas. * - Version 0.7: * - Miguel Martín Lázaro. * - Version 0.8: * - Javier Salcedo Gómez. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package acide.configuration.toolBar; import acide.configuration.toolBar.consolePanelToolBar.AcideConsolePanelToolBarConfiguration; import acide.configuration.toolBar.externalAppsToolBar.AcideExternalAppsToolBarConfiguration; import acide.configuration.toolBar.menuBarToolBar.AcideMenuBarToolBarConfiguration; /** * ACIDE - A Configurable IDE tool bar configuration. * * @version 0.8 */ public class AcideToolBarConfiguration { /** * ACIDE - A Configurable IDE tool bar configuration unique class instance. */ private static AcideToolBarConfiguration _instance; /** * ACIDE - A Configurable IDE menu bar tool bar configuration. */ private AcideMenuBarToolBarConfiguration _menuBarToolBarConfiguration; /** * ACIDE - A Configurable IDE console panel tool bar configuration. */ private AcideConsolePanelToolBarConfiguration _consolePanelToolBarConfiguration; /** * ACIDE - A Configurable IDE external applications tool bar configuration. */ private AcideExternalAppsToolBarConfiguration _externalAppsToolBarConfiguration; /** * Returns the ACIDE - A Configurable IDE tool bar configuration unique * class instance. * * @return the ACIDE - A Configurable IDE tool bar configuration unique * class instance. */ public static AcideToolBarConfiguration getInstance() { if (_instance == null) _instance = new AcideToolBarConfiguration(); return _instance; } /** * Creates a new ACIDE - A Configurable IDE tool bar configuration. */ public AcideToolBarConfiguration() { // Creates the menu bar tool bar configuration _menuBarToolBarConfiguration = new AcideMenuBarToolBarConfiguration(); // Creates the console panel tool bar configuration _consolePanelToolBarConfiguration = new AcideConsolePanelToolBarConfiguration(); // Creates the menu bar tool bar configuration _externalAppsToolBarConfiguration = new AcideExternalAppsToolBarConfiguration(); } /** * Loads the ACIDE - A Configurable IDE tool bar configuration from the file * given as a parameter. * * @param filePath * file path. * * @throws Exception * when something unusual occurs. */ public void load(String filePath) throws Exception { // Loads the menu bar tool bar configuration _menuBarToolBarConfiguration.load(filePath); // Loads the console panel tool bar configuration final list _consolePanelToolBarConfiguration.loadLists(filePath); // Loads the external applications tool bar configuration _externalAppsToolBarConfiguration.loadLists(filePath); } /** * Saves the ACIDE - A Configurable IDE tool bar configuration into the file * given as a parameter. * * @param filePath * file path. */ public void save(String filePath) { } /** * Returns the ACIDE - A Configurable IDE menu bar tool bar configuration. * * @return the ACIDE - A Configurable IDE menu bar tool bar configuration. */ public AcideMenuBarToolBarConfiguration getMenuBarToolBarConfiguration() { return _menuBarToolBarConfiguration; } /** * Sets a new value to the ACIDE - A Configurable IDE menu bar tool bar * configuration. * * @param menuBarToolBarConfiguration * new value to set. */ public void setMenuBarToolBarConfiguration( AcideMenuBarToolBarConfiguration menuBarToolBarConfiguration) { _menuBarToolBarConfiguration = menuBarToolBarConfiguration; } /** * Returns the ACIDE - A Configurable IDE console panel tool bar * configuration. * * @return the ACIDE - A Configurable IDE console panel tool bar * configuration. */ public AcideConsolePanelToolBarConfiguration getConsolePanelToolBarConfiguration() { return _consolePanelToolBarConfiguration; } /** * Sets a new value to the ACIDE - A Configurable IDE console panel tool bar * configuration. * * @param consolePanelToolBarConfiguration * new value to set. */ public void setConsolePanelToolBarConfiguration( AcideConsolePanelToolBarConfiguration consolePanelToolBarConfiguration) { _consolePanelToolBarConfiguration = consolePanelToolBarConfiguration; } /** * Returns the ACIDE - A Configurable IDE external applications tool bar * configuration. * * @return the ACIDE - A Configurable IDE external applications tool bar * configuration. */ public AcideExternalAppsToolBarConfiguration getExternalAppsToolBarConfiguration() { return _externalAppsToolBarConfiguration; } /** * Sets a new value to the ACIDE - A Configurable IDE external applications * tool bar configuration. * * @param externalAppsToolBarConfiguration * new value to set. */ public void setExternalAppsToolBarConfiguration( AcideExternalAppsToolBarConfiguration externalAppsToolBarConfiguration) { _externalAppsToolBarConfiguration = externalAppsToolBarConfiguration; } }
# for backwards compatibility from Cython import __version__ as version
/*! * froala_editor v3.2.2 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2020 Froala Labs */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('froala-editor')) : typeof define === 'function' && define.amd ? define(['froala-editor'], factory) : (factory(global.FroalaEditor)); }(this, (function (FE) { 'use strict'; FE = FE && FE.hasOwnProperty('default') ? FE['default'] : FE; /** * Persian */ FE.LANGUAGE['fa'] = { translation: { // Place holder 'Type something': "\u0686\u06CC\u0632\u06CC \u0628\u0646\u0648\u06CC\u0633\u06CC\u062F", // Basic formatting 'Bold': 'ضخیم', 'Italic': 'خط کج', 'Underline': 'خط زیر', 'Strikethrough': "\u062E\u0637 \u062E\u0648\u0631\u062F\u0647", // Main buttons 'Insert': "\u0627\u0636\u0627\u0641\u0647 \u06A9\u0631\u062F\u0646", 'Delete': "\u062D\u0630\u0641 \u06A9\u0631\u062F\u0646", 'Cancel': "\u0644\u063A\u0648", 'OK': "\u0628\u0627\u0634\u0647", 'Back': "\u0628\u0647 \u0639\u0642\u0628", 'Remove': "\u0628\u0631\u062F\u0627\u0634\u062A\u0646", 'More': "\u0628\u06CC\u0634\u062A\u0631", 'Update': "\u0628\u0647 \u0631\u0648\u0632 \u0631\u0633\u0627\u0646\u06CC", 'Style': "\u0633\u0628\u06A9", // Font 'Font Family': "\u0642\u0644\u0645", 'Font Size': "\u0627\u0646\u062F\u0627\u0632\u0647 \u0642\u0644\u0645", // Colors 'Colors': "\u0631\u0646\u06AF", 'Background': "\u0632\u0645\u06CC\u0646\u0647 \u0645\u062A\u0646", 'Text': "\u0645\u062A\u0646", 'HEX Color': 'کد رنگ', // Paragraphs 'Paragraph Format': "\u0642\u0627\u0644\u0628", 'Normal': "\u0637\u0628\u06CC\u0639\u06CC - Normal", 'Code': "\u062F\u0633\u062A\u0648\u0631\u0627\u0644\u0639\u0645\u0644\u0647\u0627 - Code", 'Heading 1': "\u0633\u0631\u200C\u0635\u0641\u062D\u0647 1", 'Heading 2': "\u0633\u0631\u200C\u0635\u0641\u062D\u0647 2", 'Heading 3': "\u0633\u0631\u200C\u0635\u0641\u062D\u0647 3", 'Heading 4': "\u0633\u0631\u200C\u0635\u0641\u062D\u0647 4", // Style 'Paragraph Style': "\u067E\u0627\u0631\u0627\u06AF\u0631\u0627\u0641 \u0633\u0628\u06A9", 'Inline Style': "\u062E\u0637\u06CC \u0633\u0628\u06A9", // Alignment 'Align': "\u0631\u062F\u06CC\u0641 \u0628\u0646\u062F\u06CC \u0646\u0648\u0634\u062A\u0647", 'Align Left': "\u0686\u067E \u0686\u06CC\u0646", 'Align Center': "\u0648\u0633\u0637 \u0686\u06CC\u0646", 'Align Right': "\u0631\u0627\u0633\u062A \u0686\u06CC\u0646", 'Align Justify': "\u0645\u0633\u0627\u0648\u06CC \u0627\u0632 \u0637\u0631\u0641\u06CC\u0646", 'None': "\u0647\u06CC\u0686", // Lists 'Ordered List': "\u0644\u06CC\u0633\u062A \u0634\u0645\u0627\u0631\u0647 \u0627\u06CC", 'Unordered List': "\u0644\u06CC\u0633\u062A \u062F\u0627\u06CC\u0631\u0647 \u0627\u06CC", // Indent 'Decrease Indent': "\u06A9\u0627\u0647\u0634 \u062A\u0648 \u0631\u0641\u062A\u06AF\u06CC", 'Increase Indent': "\u0627\u0641\u0632\u0627\u06CC\u0634 \u062A\u0648 \u0631\u0641\u062A\u06AF\u06CC", // Links 'Insert Link': "\u0627\u0636\u0627\u0641\u0647 \u06A9\u0631\u062F\u0646 \u0644\u06CC\u0646\u06A9", 'Open in new tab': "\u0628\u0627\u0632 \u06A9\u0631\u062F\u0646 \u062F\u0631 \u0628\u0631\u06AF\u0647 \u062C\u062F\u06CC\u062F", 'Open Link': "\u0644\u06CC\u0646\u06A9 \u0647\u0627\u06CC \u0628\u0627\u0632", 'Edit Link': "\u0644\u06CC\u0646\u06A9 \u0648\u06CC\u0631\u0627\u06CC\u0634", 'Unlink': "\u062D\u0630\u0641 \u0644\u06CC\u0646\u06A9", 'Choose Link': "\u0644\u06CC\u0646\u06A9 \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F", // Images 'Insert Image': "\u0627\u0636\u0627\u0641\u0647 \u06A9\u0631\u062F\u0646 \u062A\u0635\u0648\u06CC\u0631", 'Upload Image': "\u0622\u067E\u0644\u0648\u062F \u062A\u0635\u0648\u06CC\u0631", 'By URL': "URL \u062A\u0648\u0633\u0637", 'Browse': "\u0641\u0647\u0631\u0633\u062A", 'Drop image': "\u062A\u0635\u0648\u06CC\u0631 \u0631\u0627 \u0627\u06CC\u0646\u062C\u0627 \u0628\u06CC\u0646\u062F\u0627\u0632\u06CC\u062F", 'or click': "\u06CC\u0627 \u06A9\u0644\u06CC\u06A9 \u06A9\u0646\u06CC\u062F", 'Manage Images': "\u0645\u062F\u06CC\u0631\u06CC\u062A \u062A\u0635\u0627\u0648\u06CC\u0631", 'Loading': "\u0628\u0627\u0631\u06AF\u06CC\u0631\u06CC", 'Deleting': "\u062D\u0630\u0641", 'Tags': "\u0628\u0631\u0686\u0633\u0628 \u0647\u0627", 'Are you sure? Image will be deleted.': ".\u0622\u06CC\u0627 \u0645\u0637\u0645\u0626\u0646 \u0647\u0633\u062A\u06CC\u062F\u061F \u062A\u0635\u0648\u06CC\u0631 \u062D\u0630\u0641 \u062E\u0648\u0627\u0647\u062F \u0634\u062F", 'Replace': "\u062C\u0627\u06CC\u06AF\u0632\u06CC\u0646 \u06A9\u0631\u062F\u0646", 'Uploading': "\u0622\u067E\u0644\u0648\u062F", 'Loading image': "\u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u062A\u0635\u0648\u06CC\u0631", 'Display': "\u0646\u0634\u0627\u0646 \u062F\u0627\u062F\u0646", 'Inline': "\u062E\u0637\u06CC", 'Break Text': "\u0634\u06A9\u0633\u062A\u0646 \u0627\u0633\u062A\u0631\u0627\u062D\u062A", 'Alternative Text': "\u0645\u062A\u0646 \u062C\u0627\u06CC\u06AF\u0632\u06CC\u0646", 'Change Size': "\u062A\u063A\u06CC\u06CC\u0631 \u0627\u0646\u062F\u0627\u0632\u0647", 'Width': "\u0639\u0631\u0636", 'Height': "\u0627\u0631\u062A\u0641\u0627\u0639", 'Something went wrong. Please try again.': 'خطایی رخ داده است ، لطفا مجددا تلاش کنید', 'Image Caption': 'عنوان تصویر', 'Advanced Edit': 'ویرایش پیشرفته', // Video 'Insert Video': "\u0627\u0636\u0627\u0641\u0647 \u06A9\u0631\u062F\u0646 \u0641\u0627\u06CC\u0644 \u062A\u0635\u0648\u06CC\u0631\u06CC", 'Embedded Code': "\u06A9\u062F \u062C\u0627\u0633\u0627\u0632\u06CC \u0634\u062F\u0647", 'Paste in a video URL': 'در URL ویدیو وارد کنید', 'Drop video': 'رها کردن ویدیو', 'Your browser does not support HTML5 video.': 'مرورگر شما ویدیو HTML5 را پشتیبانی نمی کند.', 'Upload Video': 'آپلود ویدیو', // Tables 'Insert Table': "\u0627\u0636\u0627\u0641\u0647 \u06A9\u0631\u062F\u0646 \u062C\u062F\u0648\u0644", 'Table Header': "\u0647\u062F\u0631 \u062C\u062F\u0648\u0644", 'Remove Table': "\u062D\u0630\u0641 \u062C\u062F\u0648\u0644", 'Table Style': "\u0633\u0628\u06A9 \u062C\u062F\u0648\u0644", 'Horizontal Align': "\u062A\u0646\u0638\u06CC\u0645 \u0627\u0641\u0642\u06CC", 'Row': "\u0633\u0637\u0631", 'Insert row above': "\u062F\u0631\u062C \u0631\u062F\u06CC\u0641 \u062F\u0631 \u0628\u0627\u0644\u0627", 'Insert row below': "\u0633\u0637\u0631 \u0632\u06CC\u0631 \u0631\u0627 \u0648\u0627\u0631\u062F \u06A9\u0646\u06CC\u062F", 'Delete row': "\u062D\u0630\u0641 \u0633\u0637\u0631", 'Column': "\u0633\u062A\u0648\u0646", 'Insert column before': "\u062F\u0631\u062C \u0633\u062A\u0648\u0646 \u0642\u0628\u0644", 'Insert column after': "\u062F\u0631\u062C \u0633\u062A\u0648\u0646 \u0628\u0639\u062F", 'Delete column': "\u062D\u0630\u0641 \u0633\u062A\u0648\u0646", 'Cell': "\u0633\u0644\u0648\u0644", 'Merge cells': "\u0627\u062F\u063A\u0627\u0645 \u0633\u0644\u0648\u0644\u200C\u0647\u0627", 'Horizontal split': "\u062A\u0642\u0633\u06CC\u0645 \u0627\u0641\u0642\u06CC", 'Vertical split': "\u062A\u0642\u0633\u06CC\u0645 \u0639\u0645\u0648\u062F\u06CC", 'Cell Background': "\u067E\u0633 \u0632\u0645\u06CC\u0646\u0647 \u0647\u0645\u0631\u0627\u0647", 'Vertical Align': "\u0631\u062F\u06CC\u0641 \u0639\u0645\u0648\u062F\u06CC", 'Top': "\u0628\u0627\u0644\u0627", 'Middle': "\u0645\u062A\u0648\u0633\u0637", 'Bottom': "\u067E\u0627\u06CC\u06CC\u0646", 'Align Top': "\u062A\u0631\u0627\u0632 \u0628\u0627\u0644\u0627\u06CC", 'Align Middle': "\u062A\u0631\u0627\u0632 \u0648\u0633\u0637", 'Align Bottom': "\u062A\u0631\u0627\u0632 \u067E\u0627\u06CC\u06CC\u0646", 'Cell Style': "\u0633\u0628\u06A9 \u0647\u0627\u06CC \u0647\u0645\u0631\u0627\u0647", // Files 'Upload File': "\u0622\u067E\u0644\u0648\u062F \u0641\u0627\u06CC\u0644", 'Drop file': "\u0627\u0641\u062A \u0641\u0627\u06CC\u0644", // Emoticons 'Emoticons': "\u0634\u06A9\u0644\u06A9 \u0647\u0627", 'Grinning face': "\u0686\u0647\u0631\u0647 \u067E\u0648\u0632\u062E\u0646\u062F", 'Grinning face with smiling eyes': "\u0686\u0647\u0631\u0647 \u067E\u0648\u0632\u062E\u0646\u062F \u0628\u0627 \u0686\u0634\u0645\u0627\u0646 \u062E\u0646\u062F\u0627\u0646", 'Face with tears of joy': "\u0686\u0647\u0631\u0647 \u0628\u0627 \u0627\u0634\u06A9 \u0634\u0627\u062F\u06CC", 'Smiling face with open mouth': "\u0686\u0647\u0631\u0647 \u062E\u0646\u062F\u0627\u0646 \u0628\u0627 \u062F\u0647\u0627\u0646 \u0628\u0627\u0632", 'Smiling face with open mouth and smiling eyes': "\u0686\u0647\u0631\u0647 \u062E\u0646\u062F\u0627\u0646 \u0628\u0627 \u062F\u0647\u0627\u0646 \u0628\u0627\u0632 \u0648 \u062E\u0646\u062F\u0627\u0646 \u0686\u0634\u0645", 'Smiling face with open mouth and cold sweat': "\u0686\u0647\u0631\u0647 \u062E\u0646\u062F\u0627\u0646 \u0628\u0627 \u062F\u0647\u0627\u0646 \u0628\u0627\u0632 \u0648 \u0639\u0631\u0642 \u0633\u0631\u062F", 'Smiling face with open mouth and tightly-closed eyes': "\u0686\u0647\u0631\u0647 \u062E\u0646\u062F\u0627\u0646 \u0628\u0627 \u062F\u0647\u0627\u0646 \u0628\u0627\u0632 \u0648 \u0686\u0634\u0645 \u062F\u0631\u0628\u062F\u0627\u0631", 'Smiling face with halo': "\u0686\u0647\u0631\u0647 \u062E\u0646\u062F\u0627\u0646 \u0628\u0627 \u0647\u0627\u0644\u0647", 'Smiling face with horns': "\u0686\u0647\u0631\u0647 \u062E\u0646\u062F\u0627\u0646 \u0628\u0627 \u0634\u0627\u062E", 'Winking face': "\u062D\u0631\u06A9\u062A \u067E\u0630\u06CC\u0631\u06CC", 'Smiling face with smiling eyes': "\u0686\u0647\u0631\u0647 \u062E\u0646\u062F\u0627\u0646 \u0628\u0627 \u0686\u0634\u0645 \u0644\u0628\u062E\u0646\u062F", 'Face savoring delicious food': "\u0686\u0647\u0631\u0647 \u0644\u0630\u06CC\u0630 \u063A\u0630\u0627\u06CC \u062E\u0648\u0634\u0645\u0632\u0647", 'Relieved face': "\u0686\u0647\u0631\u0647 \u0631\u0647\u0627", 'Smiling face with heart-shaped eyes': "\u0686\u0647\u0631\u0647 \u062E\u0646\u062F\u0627\u0646 \u0628\u0627 \u0686\u0634\u0645 \u0628\u0647 \u0634\u06A9\u0644 \u0642\u0644\u0628", 'Smiling face with sunglasses': "\u0686\u0647\u0631\u0647 \u062E\u0646\u062F\u0627\u0646 \u0628\u0627 \u0639\u06CC\u0646\u06A9 \u0622\u0641\u062A\u0627\u0628\u06CC", 'Smirking face': "\u067E\u0648\u0632\u062E\u0646\u062F \u0686\u0647\u0631\u0647", 'Neutral face': "\u0686\u0647\u0631\u0647 \u0647\u0627\u06CC \u062E\u0646\u062B\u06CC", 'Expressionless face': "\u0686\u0647\u0631\u0647 \u0646\u0627\u06AF\u0648\u06CC\u0627", 'Unamused face': "\u0686\u0647\u0631\u0647 \u062E\u0648\u0634\u062D\u0627\u0644 \u0646\u06CC\u0633\u062A", 'Face with cold sweat': "\u0686\u0647\u0631\u0647 \u0628\u0627 \u0639\u0631\u0642 \u0633\u0631\u062F", 'Pensive face': "\u0686\u0647\u0631\u0647 \u0627\u0641\u0633\u0631\u062F\u0647", 'Confused face': "\u0686\u0647\u0631\u0647 \u0627\u0634\u062A\u0628\u0627\u0647", 'Confounded face': "\u0686\u0647\u0631\u0647 \u0633\u0631 \u062F\u0631 \u06AF\u0645", 'Kissing face': "\u0628\u0648\u0633\u06CC\u062F\u0646 \u0635\u0648\u0631\u062A", 'Face throwing a kiss': "\u0686\u0647\u0631\u0647 \u067E\u0631\u062A\u0627\u0628 \u06CC\u06A9 \u0628\u0648\u0633\u0647", 'Kissing face with smiling eyes': "\u0628\u0648\u0633\u06CC\u062F\u0646 \u0686\u0647\u0631\u0647 \u0628\u0627 \u0686\u0634\u0645 \u0644\u0628\u062E\u0646\u062F", 'Kissing face with closed eyes': "\u0628\u0648\u0633\u06CC\u062F\u0646 \u0635\u0648\u0631\u062A \u0628\u0627 \u0686\u0634\u0645\u0627\u0646 \u0628\u0633\u062A\u0647", 'Face with stuck out tongue': "\u0686\u0647\u0631\u0647 \u0628\u0627 \u06AF\u06CC\u0631 \u06A9\u0631\u062F\u0646 \u0632\u0628\u0627\u0646", 'Face with stuck out tongue and winking eye': "\u0686\u0647\u0631\u0647 \u0628\u0627 \u0632\u0628\u0627\u0646 \u06AF\u06CC\u0631 \u06A9\u0631\u062F\u0646 \u0648 \u062D\u0631\u06A9\u062A \u0686\u0634\u0645", 'Face with stuck out tongue and tightly-closed eyes': "\u0635\u0648\u0631\u062A \u0628\u0627 \u0632\u0628\u0627\u0646 \u06AF\u06CC\u0631 \u06A9\u0631\u062F\u0646 \u0648 \u0686\u0634\u0645 \u0631\u0627 \u0645\u062D\u06A9\u0645 \u0628\u0633\u062A\u0647", 'Disappointed face': "\u0686\u0647\u0631\u0647 \u0646\u0627 \u0627\u0645\u06CC\u062F", 'Worried face': "\u0686\u0647\u0631\u0647 \u0646\u06AF\u0631\u0627\u0646", 'Angry face': "\u0686\u0647\u0631\u0647 \u0639\u0635\u0628\u0627\u0646\u06CC", 'Pouting face': "\u0628\u063A \u0686\u0647\u0631\u0647", 'Crying face': "\u06AF\u0631\u06CC\u0647 \u0686\u0647\u0631\u0647", 'Persevering face': "\u067E\u0627\u06CC\u062F\u0627\u0631\u06CC \u0686\u0647\u0631\u0647", 'Face with look of triumph': "\u0686\u0647\u0631\u0647 \u0628\u0627 \u0646\u06AF\u0627\u0647\u06CC \u0627\u0632 \u067E\u06CC\u0631\u0648\u0632\u06CC", 'Disappointed but relieved face': "\u0646\u0627 \u0627\u0645\u06CC\u062F \u0627\u0645\u0627 \u0622\u0633\u0648\u062F\u0647 \u0686\u0647\u0631\u0647", 'Frowning face with open mouth': "\u0627\u062E\u0645 \u0635\u0648\u0631\u062A \u0628\u0627 \u062F\u0647\u0627\u0646 \u0628\u0627\u0632", 'Anguished face': "\u0686\u0647\u0631\u0647 \u0646\u06AF\u0631\u0627\u0646", 'Fearful face': "\u0686\u0647\u0631\u0647 \u062A\u0631\u0633", 'Weary face': "\u0686\u0647\u0631\u0647 \u062E\u0633\u062A\u0647", 'Sleepy face': "\u0686\u0647\u0631\u0647 \u062E\u0648\u0627\u0628 \u0622\u0644\u0648\u062F", 'Tired face': "\u0686\u0647\u0631\u0647 \u062E\u0633\u062A\u0647", 'Grimacing face': "\u0627\u0634 \u0686\u0647\u0631\u0647", 'Loudly crying face': "\u0646\u062F\u0627\u06CC\u06CC \u0631\u0633\u0627 \u06AF\u0631\u06CC\u0647 \u0686\u0647\u0631\u0647", 'Face with open mouth': "\u0686\u0647\u0631\u0647 \u0628\u0627 \u062F\u0647\u0627\u0646 \u0628\u0627\u0632", 'Hushed face': "\u0686\u0647\u0631\u0647 \u0633\u06A9\u0648\u062A", 'Face with open mouth and cold sweat': "\u0686\u0647\u0631\u0647 \u0628\u0627 \u062F\u0647\u0627\u0646 \u0628\u0627\u0632 \u0648 \u0639\u0631\u0642 \u0633\u0631\u062F", 'Face screaming in fear': "\u0686\u0647\u0631\u0647 \u062C\u06CC\u063A \u062F\u0631 \u062A\u0631\u0633", 'Astonished face': "\u0686\u0647\u0631\u0647 \u0634\u06AF\u0641\u062A \u0632\u062F\u0647", 'Flushed face': "\u0686\u0647\u0631\u0647 \u0628\u0631\u0627\u0641\u0631\u0648\u062E\u062A\u0647", 'Sleeping face': "\u062E\u0648\u0627\u0628 \u0686\u0647\u0631\u0647", 'Dizzy face': "\u0686\u0647\u0631\u0647 \u062F\u06CC\u0632\u06CC", 'Face without mouth': "\u0686\u0647\u0631\u0647 \u0628\u062F\u0648\u0646 \u062F\u0647\u0627\u0646", 'Face with medical mask': "\u0686\u0647\u0631\u0647 \u0628\u0627 \u0645\u0627\u0633\u06A9 \u0647\u0627\u06CC \u067E\u0632\u0634\u06A9\u06CC", // Line breaker 'Break': "\u0634\u06A9\u0633\u062A\u0646", // Math 'Subscript': "\u067E\u0627\u064A\u064A\u0646 \u0646\u0648\u064A\u0633", 'Superscript': "\u0628\u0627\u0644\u0627 \u0646\u06AF\u0627\u0634\u062A", // Full screen 'Fullscreen': "\u062A\u0645\u0627\u0645 \u0635\u0641\u062D\u0647", // Horizontal line 'Insert Horizontal Line': "\u0642\u0631\u0627\u0631 \u062F\u0627\u062F\u0646 \u0627\u0641\u0642\u06CC \u062E\u0637", // Clear formatting 'Clear Formatting': "\u062D\u0630\u0641 \u0642\u0627\u0644\u0628 \u0628\u0646\u062F\u06CC", // Save 'Save': "\u0635\u0631\u0641\u0647 \u062C\u0648\u06CC\u06CC", // Undo, redo 'Undo': "\u0628\u0627\u0637\u0644 \u06A9\u0631\u062F\u0646", 'Redo': "\u0627\u0646\u062C\u0627\u0645 \u062F\u0648\u0628\u0627\u0631\u0647", // Select all 'Select All': "\u0627\u0646\u062A\u062E\u0627\u0628 \u0647\u0645\u0647", // Code view 'Code View': "\u0645\u0634\u0627\u0647\u062F\u0647 \u06A9\u062F", // Quote 'Quote': "\u0646\u0642\u0644 \u0642\u0648\u0644", 'Increase': "\u0627\u0641\u0632\u0627\u06CC\u0634 \u062F\u0627\u062F\u0646", 'Decrease': "\u0646\u0632\u0648\u0644 \u06A9\u0631\u062F\u0646", // Quick Insert 'Quick Insert': "\u062F\u0631\u062C \u0633\u0631\u06CC\u0639", // Spcial Characters 'Special Characters': 'کاراکترهای خاص', 'Latin': 'لاتین', 'Greek': 'یونانی', 'Cyrillic': 'سیریلیک', 'Punctuation': 'نقطه گذاری', 'Currency': 'واحد پول', 'Arrows': 'فلش ها', 'Math': 'ریاضی', 'Misc': 'متاسفم', // Print. 'Print': 'چاپ', // Spell Checker. 'Spell Checker': 'بررسی کننده غلط املایی', // Help 'Help': 'کمک', 'Shortcuts': 'کلید های میانبر', 'Inline Editor': 'ویرایشگر خطی', 'Show the editor': 'ویرایشگر را نشان بده', 'Common actions': 'اقدامات مشترک', 'Copy': 'کپی کنید', 'Cut': 'برش', 'Paste': 'چسباندن', 'Basic Formatting': 'قالب بندی اولیه', 'Increase quote level': 'افزایش سطح نقل قول', 'Decrease quote level': 'کاهش میزان نقل قول', 'Image / Video': 'تصویر / ویدئو', 'Resize larger': 'تغییر اندازه بزرگتر', 'Resize smaller': 'تغییر اندازه کوچکتر', 'Table': 'جدول', 'Select table cell': 'سلول جدول را انتخاب کنید', 'Extend selection one cell': 'انتخاب یک سلول را گسترش دهید', 'Extend selection one row': 'یک ردیف را انتخاب کنید', 'Navigation': 'جهت یابی', 'Focus popup / toolbar': 'تمرکز پنجره / نوار ابزار', 'Return focus to previous position': 'تمرکز بازگشت به موقعیت قبلی', // Embed.ly 'Embed URL': 'آدرس جاسازی', 'Paste in a URL to embed': 'یک URL برای جاسازی کپی کنید', // Word Paste. 'The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?': 'محتوای جا به جا از یک سند Word Microsoft می آید. آیا می خواهید فرمت را نگه دارید یا پاک کنید؟', 'Keep': 'نگاه داشتن', 'Clean': 'پاک کن', 'Word Paste Detected': 'کلمه رب تشخیص داده شده است', // Character Counter 'Characters': 'شخصیت ها', // More Buttons 'More Text': 'متن بیشتر', 'More Paragraph': 'پاراگراف بیشتر', 'More Rich': 'بیشتر ثروتمند', 'More Misc': 'بیشتر متفرقه' }, direction: 'rtl' }; }))); //# sourceMappingURL=fa.js.map
// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package spanner // [START spanner_update_database_with_default_leader] import ( "context" "fmt" "io" "regexp" database "cloud.google.com/go/spanner/admin/database/apiv1" adminpb "google.golang.org/genproto/googleapis/spanner/admin/database/v1" ) // updateDatabaseWithDefaultLeader updates the default leader for a given database func updateDatabaseWithDefaultLeader(w io.Writer, db string, defaultLeader string) error { // db = `projects/<project>/instances/<instance-id>/database/<database-id>` // defaultLeader = `nam3` matches := regexp.MustCompile("^(.+)/databases/(.+)$").FindStringSubmatch(db) if matches == nil || len(matches) != 3 { return fmt.Errorf("updateDatabaseWithDefaultLeader: invalid database id %q", db) } ctx := context.Background() adminClient, err := database.NewDatabaseAdminClient(ctx) if err != nil { return err } defer adminClient.Close() op, err := adminClient.UpdateDatabaseDdl(ctx, &adminpb.UpdateDatabaseDdlRequest{ Database: db, Statements: []string{ fmt.Sprintf( "ALTER DATABASE `%s` SET OPTIONS (default_leader = '%s')", matches[2], defaultLeader, ), }, }) if err != nil { return err } if err := op.Wait(ctx); err != nil { return err } fmt.Fprintf(w, "Updated the default leader\n") return nil } // [END spanner_update_database_with_default_leader]
package test.org.protune.net; import java.io.IOException; import org.protune.net.DispatcherPeer; /** * * @author cjin */ public class ServerTest{ public static void main(String[] args){ Runnable runnable = new Runnable(){ public void run(){ // Local variables initialisation. System.out.println("new Thread..."); String[] sa = {"org.protune.net.DummyService"}; DispatcherPeer dp; try{ dp = new DispatcherPeer("localhost", 1234, sa); dp.init(); } catch(IOException e){ // TODO Auto-generated catch block e.printStackTrace(); } catch(ClassNotFoundException e){ // TODO Auto-generated catch block e.printStackTrace(); } } }; Thread thread = new Thread(runnable); thread.setDaemon(true); thread.start(); } }
declare module PEG { export interface Parser { parse(input: string): Array<ParseResult>; } export interface ParseResult { type: string; values: Array<string> } class SyntaxError { line: number; column: number; offset: number; expected: any[]; found: any; name: string; message: string; } }
#Overview# Service Controller Platform (SCP) is a system prototype which provides strategically automatic operation and maintenance scheme based on SDN. SCP possesses capabilities of grouping the policies to generate new service, defining policy based on customers, giving out policies quickly and defining service chain. The target of SCP is to quickly respond customer’s need and to improve the customer experience effectively. The overall architecture of SCP is shown as follows: ![image](https://github.com/chinatelecom-sdn-group/ServiceControlPlatform/raw/master/doc/SCP-Architecture.png) SCP mainly contains 8 functional modules and depends on 3 plug-ins of ODL which are PM, SCM and PFM, the overall structure is shown as follows: ![image](https://github.com/chinatelecom-sdn-group/ServiceControlPlatform/raw/master/doc/SCP-Structure.png) #Function# * Simplify service orchestration by providing the method to define basic policy, to define service, to activate project etc. * Simplify the complexity of policy distribution by connecting with SDN Controller(OpenDaylight). * Manage resource pool in real time by defining YANG model of resource monitoring and connect with netconf server. * Monitor customer status in real time by connecting with BRASes and update flowtables according to customer status. #Environment# mongodb >= 2.6.7 nodejs >= 0.10.29 #Installation# npm install #Configuration# vi bin/config.js var system_cfg = { "mongodb": { "IP": "172.21.2.1", "Port": "27019", "ServiceControlPlatform": { "User": "SCP", "Password": "SCP123" }, "PolicyManagement": { "User": "PM", "Password": "PM123" } }, "opendaylight": { "IP": "172.21.2.6", "Port": "8080", "User": "admin", "Password": "admin" } } exports.system_cfg = system_cfg; #Run# node bin/ServiceControlPlatform #Corporator# * Guangzhou Research Institute of China Telecom #Author# ##designer## * Hong Tang(chinatelecom.sdn.group@gmail.com) * Liang Ou(chinatelecom.sdn.group@gmail.com) ##Coder## * Qianfeng Chen (chinatelecom.sdn.group@gmail.com) * Peng Li (chinatelecom.sdn.group@gmail.com) * Boqi Mo (chinatelecom.sdn.group@gmail.com)
$(document).ready(function() { $.get("/api/user_daily_mobility_summary/",function(data,status){ // alert(data[0]['body']['walking_distance_in_km']) for (i = 0; i < data.length; i++) { date = data[i]['body']['date'].split("-") var source = { title: "walking_distance_in_km:"+"\n" + data[i]['body']['walking_distance_in_km'].toString() +"\n" + "active_time_in_seconds:"+"\n" + data[i]['body']['active_time_in_seconds'].toString(), start: new Date(date[0].toString(),date[1].toString()-1,date[2].toString()), allDay: true, // id: i, } // alert(source.start) $('#calendar').fullCalendar( 'addEventSource', [source] ) } // alert("Done") }); var calendar = $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, editable: true, weekMode: 'liquid', url:'#', dayClick: function(date, allDay, jsEvent, view) { saveInLocalStorage(date.toString()) }, eventDrop: function(event, delta, revertFunc) { if (!confirm("Are you sure about this change?")) { revertFunc(); } }, eventClick: function(calEvent, jsEvent, view) { $(this).css('border-color', 'red'); // window.location.replace("/foodJournal/meal/"+calEvent.id+"/"); } }); });
<?php /** * Created by PhpStorm. * User: Mark * Date: 2015/12/28 * Time: 0:05 */ namespace Tests\Models; use ManaPHP\Data\Db\Model; class Store extends Model { public $store_id; public $manager_staff_id; public $address_id; public $last_update; }
/* * [The "BSD licence"] * Copyright (c) 2010 Ben Gruver (JesusFreke) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.jf.dexlib.Code.Format; import org.jf.dexlib.Code.Instruction; import org.jf.dexlib.Code.LiteralInstruction; import org.jf.dexlib.Code.Opcode; import org.jf.dexlib.Code.SingleRegisterInstruction; import org.jf.dexlib.DexFile; import org.jf.dexlib.Util.AnnotatedOutput; import org.jf.dexlib.Util.NumberUtils; public class Instruction51l extends Instruction implements SingleRegisterInstruction, LiteralInstruction { public static final Instruction.InstructionFactory Factory = new Factory(); private byte regA; private long litB; public Instruction51l(Opcode opcode, short regA, long litB) { super(opcode); if (regA >= 1 << 8) { throw new RuntimeException("The register number must be less than v256"); } this.regA = (byte)regA; this.litB = litB; } private Instruction51l(Opcode opcode, byte[] buffer, int bufferIndex) { super(opcode); regA = (byte)NumberUtils.decodeUnsignedByte(buffer[bufferIndex + 1]); litB = NumberUtils.decodeLong(buffer, bufferIndex + 2); } protected void writeInstruction(AnnotatedOutput out, int currentCodeAddress) { out.writeByte(opcode.value); out.writeByte(regA); out.writeLong(litB); } public Format getFormat() { return Format.Format51l; } public int getRegisterA() { return regA & 0xFF; } public long getLiteral() { return litB; } private static class Factory implements Instruction.InstructionFactory { public Instruction makeInstruction(DexFile dexFile, Opcode opcode, byte[] buffer, int bufferIndex) { return new Instruction51l(opcode, buffer, bufferIndex); } } }
/*±¾µÀÌâÄ¿µÄÌâºÅÊÇ£º1 *ÒªÇóÊÇ£ºÐ´Ò»¸ö³ÌÐò£¬ÒÑÖª¹¹³ÉÎÄÕµÄn¸ö×Ö·û´®£¬ ͳ¼ÆÓÉÕâЩ×Ö·û´®¹¹³ÉµÄ¾ä×ÓÖе¥´ÊµÄ¸öÊý²¢ÕÒ³ö°´×Öµä˳Ðò×îÇ°µÄºÍ×îºóµÄµ¥´Ê£¬ÇÒ°ÑËüÃǵÄλÖÃÁгöÀ´¡£ */ #include <iostream> #include <vector> #include <algorithm> #include "word_stream.h" using namespace std; int main() try{ cout << "Input a passage (end with end_of_file in a newline)" << endl; Word_stream ws(cin); Word word("", Pos(1, 1)); vector<Word> word_list; while (ws >> word){ word_list.push_back(word); } if (word_list.size() == 0){ throw runtime_error("no word"); } else{ cout << "There are " << word_list.size() << " words." << endl; } sort(word_list.begin(), word_list.end()); string min_word = word_list[0].get_word(); cout << "The minimum word is " << min_word << endl; unsigned long i = 0; while (i < word_list.size() && word_list[i].get_word() == min_word){ cout << "Line: " << word_list[i].get_pos().get_line() << "\tWord: " << word_list[i].get_pos().get_word() << endl; ++i; } string max_word = word_list[word_list.size() - 1].get_word(); cout << "The maximum word is " << max_word << endl; unsigned long j = word_list.size(); while (j > 0 && word_list[j - 1].get_word() == max_word){ --j; } for (size_t i = j; i < word_list.size(); ++i){ cout << "Line: " << word_list[i].get_pos().get_line() << "\tWord: " << word_list[i].get_pos().get_word() << endl; } return 0; } catch (runtime_error& e){ cerr << "Error: " << e.what() << endl; return 1; } catch (...){ cerr << "Unknown error" << endl; return 2; }
require 'spec_helper' describe Spree::CheckoutController, :type => :controller do let(:token) { 'some_token' } let(:user) { stub_model(Spree::LegacyUser) } let(:order) { FactoryGirl.create(:order_with_totals) } let(:address_params) do address = FactoryGirl.build(:address) address.attributes.except("created_at", "updated_at") end before do allow(controller).to receive_messages try_spree_current_user: user allow(controller).to receive_messages spree_current_user: user allow(controller).to receive_messages current_order: order end context "#edit" do it 'should check if the user is authorized for :edit' do expect(controller).to receive(:authorize!).with(:edit, order, token) request.cookie_jar.signed[:guest_token] = token spree_get :edit, { state: 'address' } end it "should redirect to the cart path unless checkout_allowed?" do allow(order).to receive_messages :checkout_allowed? => false spree_get :edit, { :state => "delivery" } expect(response).to redirect_to(spree.cart_path) end it "should redirect to the cart path if current_order is nil" do allow(controller).to receive(:current_order).and_return(nil) spree_get :edit, { :state => "delivery" } expect(response).to redirect_to(spree.cart_path) end it "should redirect to cart if order is completed" do allow(order).to receive_messages(:completed? => true) spree_get :edit, { :state => "address" } expect(response).to redirect_to(spree.cart_path) end # Regression test for #2280 it "should redirect to current step trying to access a future step" do order.update_column(:state, "address") spree_get :edit, { :state => "delivery" } expect(response).to redirect_to spree.checkout_state_path("address") end context "when entering the checkout" do before do # The first step for checkout controller is address # Transitioning into this state first is required order.update_column(:state, "address") end it "should associate the order with a user" do order.update_column :user_id, nil expect(order).to receive(:associate_user!).with(user) spree_get :edit, {}, order_id: 1 end end end context "#update" do it 'should check if the user is authorized for :edit' do expect(controller).to receive(:authorize!).with(:edit, order, token) request.cookie_jar.signed[:guest_token] = token spree_post :update, { state: 'address' } end context "save successful" do def spree_post_address spree_post :update, { :state => "address", :order => { :bill_address_attributes => address_params, :use_billing => true } } end before do # Must have *a* shipping method and a payment method so updating from address works allow(order).to receive_messages :available_shipping_methods => [stub_model(Spree::ShippingMethod)] allow(order).to receive_messages :available_payment_methods => [stub_model(Spree::PaymentMethod)] allow(order).to receive_messages :ensure_available_shipping_rates => true order.line_items << FactoryGirl.create(:line_item) end context "with the order in the cart state" do before do order.update_column(:state, "cart") allow(order).to receive_messages :user => user end it "should assign order" do spree_post :update, {:state => "address"} expect(assigns[:order]).not_to be_nil end it "should advance the state" do spree_post_address expect(order.reload.state).to eq("delivery") end it "should redirect the next state" do spree_post_address expect(response).to redirect_to spree.checkout_state_path("delivery") end context "current_user respond to save address method" do it "calls persist order address on user" do expect(user).to receive(:persist_order_address) spree_post :update, { :state => "address", :order => { :bill_address_attributes => address_params, :use_billing => true }, :save_user_address => "1" } end end context "current_user doesnt respond to persist_order_address" do it "doesnt raise any error" do expect { spree_post :update, { :state => "address", :order => { :bill_address_attributes => address_params, :use_billing => true }, :save_user_address => "1" } }.to_not raise_error end end end context "with the order in the address state" do before do order.update_columns(ship_address_id: create(:address).id, state: "address") allow(order).to receive_messages user: user end context "with a billing and shipping address" do before do @expected_bill_address_id = order.bill_address.id @expected_ship_address_id = order.ship_address.id spree_post :update, { :state => "address", :order => { :bill_address_attributes => order.bill_address.attributes.except("created_at", "updated_at"), :ship_address_attributes => order.ship_address.attributes.except("created_at", "updated_at"), :use_billing => false } } order.reload end it "updates the same billing and shipping address" do expect(order.bill_address.id).to eq(@expected_bill_address_id) expect(order.ship_address.id).to eq(@expected_ship_address_id) end end end context "when in the confirm state" do before do allow(order).to receive_messages :confirmation_required? => true order.update_column(:state, "confirm") allow(order).to receive_messages :user => user # An order requires a payment to reach the complete state # This is because payment_required? is true on the order create(:payment, :amount => order.total, :order => order) order.payments.reload end # This inadvertently is a regression test for #2694 it "should redirect to the order view" do spree_post :update, {:state => "confirm"} expect(response).to redirect_to spree.order_path(order) end it "should populate the flash message" do spree_post :update, {:state => "confirm"} expect(flash.notice).to eq(Spree.t(:order_processed_successfully)) end it "should remove completed order from current_order" do spree_post :update, {:state => "confirm"}, {:order_id => "foofah"} expect(assigns(:current_order)).to be_nil expect(assigns(:order)).to eql controller.current_order end end # Regression test for #4190 context "state_lock_version" do let(:post_params) { { state: "address", order: { bill_address_attributes: order.bill_address.attributes.except("created_at", "updated_at"), state_lock_version: 0, use_billing: true } } } context "correct" do it "should properly update and increment version" do spree_post :update, post_params expect(order.state_lock_version).to eq 1 end end context "incorrect" do before do order.update_columns(state_lock_version: 1, state: "address") end it "order should receieve ensure_valid_order_version callback" do expect_any_instance_of(described_class).to receive(:ensure_valid_state_lock_version) spree_post :update, post_params end it "order should receieve with_lock message" do expect(order).to receive(:with_lock) spree_post :update, post_params end it "redirects back to current state" do spree_post :update, post_params expect(response).to redirect_to spree.checkout_state_path('address') expect(flash[:error]).to eq "The order has already been updated." end end end end context "save unsuccessful" do before do allow(order).to receive_messages :user => user allow(order).to receive_messages :update_attributes => false end it "should not assign order" do spree_post :update, {:state => "address"} expect(assigns[:order]).not_to be_nil end it "should not change the order state" do spree_post :update, { :state => 'address' } end it "should render the edit template" do spree_post :update, { :state => 'address' } expect(response).to render_template :edit end end context "when current_order is nil" do before { allow(controller).to receive_messages :current_order => nil } it "should not change the state if order is completed" do expect(order).not_to receive(:update_attribute) spree_post :update, {:state => "confirm"} end it "should redirect to the cart_path" do spree_post :update, {:state => "confirm"} expect(response).to redirect_to spree.cart_path end end context "Spree::Core::GatewayError" do before do allow(order).to receive_messages :user => user allow(order).to receive(:update_attributes).and_raise(Spree::Core::GatewayError.new("Invalid something or other.")) spree_post :update, {:state => "address"} end it "should render the edit template and display exception message" do expect(response).to render_template :edit expect(flash.now[:error]).to eq(Spree.t(:spree_gateway_error_flash_for_checkout)) expect(assigns(:order).errors[:base]).to include("Invalid something or other.") end end context "fails to transition from address" do let(:order) do FactoryGirl.create(:order_with_line_items).tap do |order| order.next! expect(order.state).to eq('address') end end before do allow(controller).to receive_messages :current_order => order allow(controller).to receive_messages :check_authorization => true end context "when the country is not a shippable country" do before do order.ship_address.tap do |address| # A different country which is not included in the list of shippable countries address.country = FactoryGirl.create(:country, :name => "Australia") address.state_name = 'Victoria' address.save end end it "due to no available shipping rates for any of the shipments" do expect(order.shipments.count).to eq(1) order.shipments.first.shipping_rates.delete_all spree_put :update, :order => {} expect(flash[:error]).to eq(Spree.t(:items_cannot_be_shipped)) expect(response).to redirect_to(spree.checkout_state_path('address')) end end context "when the order is invalid" do before do allow(order).to receive_messages :update_attributes => true, :next => nil order.errors.add :base, 'Base error' order.errors.add :adjustments, 'error' end it "due to the order having errors" do spree_put :update, :order => {} expect(flash[:error]).to eq("Base error\nAdjustments error") expect(response).to redirect_to(spree.checkout_state_path('address')) end end end context "fails to transition from payment to complete" do let(:order) do FactoryGirl.create(:order_with_line_items).tap do |order| until order.state == 'payment' order.next! end # So that the confirmation step is skipped and we get straight to the action. payment_method = FactoryGirl.create(:simple_credit_card_payment_method) payment = FactoryGirl.create(:payment, :payment_method => payment_method) order.payments << payment end end before do allow(controller).to receive_messages :current_order => order allow(controller).to receive_messages :check_authorization => true end it "when GatewayError is raised" do allow_any_instance_of(Spree::Payment).to receive(:process!).and_raise(Spree::Core::GatewayError.new(Spree.t(:payment_processing_failed))) spree_put :update, :order => {} expect(flash[:error]).to eq(Spree.t(:payment_processing_failed)) end end end context "When last inventory item has been purchased" do let(:product) { mock_model(Spree::Product, :name => "Amazing Object") } let(:variant) { mock_model(Spree::Variant) } let(:line_item) { mock_model Spree::LineItem, :insufficient_stock? => true, :amount => 0 } let(:order) { create(:order) } before do allow(order).to receive_messages(:line_items => [line_item], :state => "payment") configure_spree_preferences do |config| config.track_inventory_levels = true end end context "and back orders are not allowed" do before do spree_post :update, { :state => "payment" } end it "should redirect to cart" do expect(response).to redirect_to spree.cart_path end it "should set flash message for no inventory" do expect(flash[:error]).to eq(Spree.t(:inventory_error_flash_for_insufficient_quantity , :names => "'#{product.name}'" )) end end end context "order doesn't have a delivery step" do before do allow(order).to receive_messages(:checkout_steps => ["cart", "address", "payment"]) allow(order).to receive_messages state: "address" allow(controller).to receive_messages :check_authorization => true end it "doesn't set shipping address on the order" do expect(order).to_not receive(:ship_address=) spree_post :update end it "doesn't remove unshippable items before payment" do expect { spree_post :update, { :state => "payment" } }.to_not change { order.line_items } end end it "does remove unshippable items before payment" do allow(order).to receive_messages :payment_required? => true allow(controller).to receive_messages :check_authorization => true expect { spree_post :update, { :state => "payment" } }.to change { order.line_items } end end
TEST_URI=http://www.w3.org/People/mimasa/test/xhtml/media-types/test.xhtml aout="${0}" fail () { echo 1>&2 "${aout} FAILED: ${@}" exit 1 } if [ ! -f in.xhtml ] ; then wget -O in.xhtml ${TEST_URI} || fail Unable to retrieve test document fi python rewrite.py || fail Unable to rewrite test document xmllint --format in.xhtml > inf.xhtml xmllint --format out.xhtml > outf.xhtml diff -uw inf.xhtml outf.xhtml > deltas # Need to manually validate that outf.xhtml and in.xhtml are about the # same. The rewrite does not preserve the order of attributes in the # elements. echo "See deltas for differences" # Test most primitive generation of documents rm -f genout.xhtml python generate.py \ && diff expout.xhtml genout.xhtml \ || fail generate did not match expected echo "Passed XHTML tests"
<?php namespace Ei\Calendar\Resolution; use DateTime; use Ei\Calendar\ResolutionInterface; use Ei\Calendar\Week; class WeekResolution implements ResolutionInterface { protected $currentDate; protected $startDay = 'Monday'; public function __construct($startDay = null) { if ($startDay !== null) { $this->setStartDay($startDay); } } public function setStartDay($startDay) { $this->startDay = $startDay; return $this; } public function startDay() { return $this->startDay; } public function setDateTime(DateTime $dateTime) { $this->currentDate = $dateTime; return $this; } public function dateTime() { return $this->currentDate; } public function build() { if ($this->currentDate === null) { return null; } return new Week($this->currentDate, $this->startDay); } }
// Generated from html/HTMLLexer.g4 by ANTLR 4.4 import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.TokenStream; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.misc.*; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class HTMLLexer extends Lexer { static { RuntimeMetaData.checkVersion("4.4", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int HTML_COMMENT=1, HTML_CONDITIONAL_COMMENT=2, XML_DECLARATION=3, CDATA=4, DTD=5, SCRIPTLET=6, SEA_WS=7, SCRIPT_OPEN=8, STYLE_OPEN=9, TAG_OPEN=10, HTML_TEXT=11, TAG_CLOSE=12, TAG_SLASH_CLOSE=13, TAG_SLASH=14, TAG_EQUALS=15, TAG_NAME=16, TAG_WHITESPACE=17, SCRIPT_BODY=18, SCRIPT_SHORT_BODY=19, STYLE_BODY=20, STYLE_SHORT_BODY=21, ATTVALUE_VALUE=22, ATTRIBUTE=23; public static final int TAG = 1; public static final int SCRIPT = 2; public static final int STYLE = 3; public static final int ATTVALUE = 4; public static String[] modeNames = { "DEFAULT_MODE", "TAG", "SCRIPT", "STYLE", "ATTVALUE" }; public static final String[] tokenNames = { "'\\u0000'", "'\\u0001'", "'\\u0002'", "'\\u0003'", "'\\u0004'", "'\\u0005'", "'\\u0006'", "'\\u0007'", "'\b'", "'\t'", "'\n'", "'\\u000B'", "'\f'", "'\r'", "'\\u000E'", "'\\u000F'", "'\\u0010'", "'\\u0011'", "'\\u0012'", "'\\u0013'", "'\\u0014'", "'\\u0015'", "'\\u0016'", "'\\u0017'" }; public static final String[] ruleNames = { "HTML_COMMENT", "HTML_CONDITIONAL_COMMENT", "XML_DECLARATION", "CDATA", "DTD", "SCRIPTLET", "SEA_WS", "SCRIPT_OPEN", "STYLE_OPEN", "TAG_OPEN", "HTML_TEXT", "TAG_CLOSE", "TAG_SLASH_CLOSE", "TAG_SLASH", "TAG_EQUALS", "TAG_NAME", "TAG_WHITESPACE", "HEXDIGIT", "DIGIT", "TAG_NameChar", "TAG_NameStartChar", "SCRIPT_BODY", "SCRIPT_SHORT_BODY", "STYLE_BODY", "STYLE_SHORT_BODY", "ATTVALUE_VALUE", "ATTRIBUTE", "ATTCHAR", "ATTCHARS", "HEXCHARS", "DECCHARS", "DOUBLE_QUOTE_STRING", "SINGLE_QUOTE_STRING" }; public HTMLLexer(CharStream input) { super(input); _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); } @Override public String getGrammarFileName() { return "HTMLLexer.g4"; } @Override public String[] getTokenNames() { return tokenNames; } @Override public String[] getRuleNames() { return ruleNames; } @Override public String getSerializedATN() { return _serializedATN; } @Override public String[] getModeNames() { return modeNames; } @Override public ATN getATN() { return _ATN; } public static final String _serializedATN = "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\31\u017d\b\1\b\1"+ "\b\1\b\1\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4"+ "\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20"+ "\4\21\t\21\4\22\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27"+ "\4\30\t\30\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36"+ "\4\37\t\37\4 \t \4!\t!\4\"\t\"\3\2\3\2\3\2\3\2\3\2\3\2\7\2P\n\2\f\2\16"+ "\2S\13\2\3\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\7\3^\n\3\f\3\16\3a\13\3\3"+ "\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\7\4m\n\4\f\4\16\4p\13\4\3\4\3\4"+ "\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\7\5\177\n\5\f\5\16\5\u0082"+ "\13\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\7\6\u008c\n\6\f\6\16\6\u008f\13"+ "\6\3\6\3\6\3\7\3\7\3\7\3\7\7\7\u0097\n\7\f\7\16\7\u009a\13\7\3\7\3\7\3"+ "\7\3\7\3\7\3\7\7\7\u00a2\n\7\f\7\16\7\u00a5\13\7\3\7\3\7\5\7\u00a9\n\7"+ "\3\b\3\b\5\b\u00ad\n\b\3\b\6\b\u00b0\n\b\r\b\16\b\u00b1\3\t\3\t\3\t\3"+ "\t\3\t\3\t\3\t\3\t\3\t\7\t\u00bd\n\t\f\t\16\t\u00c0\13\t\3\t\3\t\3\t\3"+ "\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\7\n\u00ce\n\n\f\n\16\n\u00d1\13\n\3"+ "\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\f\6\f\u00dc\n\f\r\f\16\f\u00dd\3"+ "\r\3\r\3\r\3\r\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\20\3\20\3\20\3\20"+ "\3\21\3\21\7\21\u00f1\n\21\f\21\16\21\u00f4\13\21\3\22\3\22\3\22\3\22"+ "\3\23\3\23\3\24\3\24\3\25\3\25\3\25\3\25\5\25\u0102\n\25\3\26\5\26\u0105"+ "\n\26\3\27\7\27\u0108\n\27\f\27\16\27\u010b\13\27\3\27\3\27\3\27\3\27"+ "\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\30\7\30\u011a\n\30\f\30\16"+ "\30\u011d\13\30\3\30\3\30\3\30\3\30\3\30\3\30\3\31\7\31\u0126\n\31\f\31"+ "\16\31\u0129\13\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3"+ "\31\3\32\7\32\u0137\n\32\f\32\16\32\u013a\13\32\3\32\3\32\3\32\3\32\3"+ "\32\3\32\3\33\7\33\u0143\n\33\f\33\16\33\u0146\13\33\3\33\3\33\3\33\3"+ "\33\3\34\3\34\3\34\3\34\3\34\5\34\u0151\n\34\3\35\5\35\u0154\n\35\3\36"+ "\6\36\u0157\n\36\r\36\16\36\u0158\3\36\5\36\u015c\n\36\3\37\3\37\6\37"+ "\u0160\n\37\r\37\16\37\u0161\3 \6 \u0165\n \r \16 \u0166\3 \5 \u016a\n"+ " \3!\3!\7!\u016e\n!\f!\16!\u0171\13!\3!\3!\3\"\3\"\7\"\u0177\n\"\f\"\16"+ "\"\u017a\13\"\3\"\3\"\17Q_n\u0080\u008d\u0098\u00a3\u00be\u00cf\u0109"+ "\u011b\u0127\u0138\2#\7\3\t\4\13\5\r\6\17\7\21\b\23\t\25\n\27\13\31\f"+ "\33\r\35\16\37\17!\20#\21%\22\'\23)\2+\2-\2/\2\61\24\63\25\65\26\67\27"+ "9\30;\31=\2?\2A\2C\2E\2G\2\7\2\3\4\5\6\16\4\2\13\13\"\"\3\2>>\5\2\13\f"+ "\17\17\"\"\5\2\62;CHch\3\2\62;\4\2/\60aa\5\2\u00b9\u00b9\u0302\u0371\u2041"+ "\u2042\n\2<<C\\c|\u2072\u2191\u2c02\u2ff1\u3003\ud801\uf902\ufdd1\ufdf2"+ "\uffff\3\2\"\"\t\2%%-=??AAC\\aac|\4\2$$>>\4\2))>>\u0190\2\7\3\2\2\2\2"+ "\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2"+ "\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\3\35\3\2\2\2"+ "\3\37\3\2\2\2\3!\3\2\2\2\3#\3\2\2\2\3%\3\2\2\2\3\'\3\2\2\2\4\61\3\2\2"+ "\2\4\63\3\2\2\2\5\65\3\2\2\2\5\67\3\2\2\2\69\3\2\2\2\6;\3\2\2\2\7I\3\2"+ "\2\2\tX\3\2\2\2\13e\3\2\2\2\rs\3\2\2\2\17\u0087\3\2\2\2\21\u00a8\3\2\2"+ "\2\23\u00af\3\2\2\2\25\u00b3\3\2\2\2\27\u00c5\3\2\2\2\31\u00d6\3\2\2\2"+ "\33\u00db\3\2\2\2\35\u00df\3\2\2\2\37\u00e3\3\2\2\2!\u00e8\3\2\2\2#\u00ea"+ "\3\2\2\2%\u00ee\3\2\2\2\'\u00f5\3\2\2\2)\u00f9\3\2\2\2+\u00fb\3\2\2\2"+ "-\u0101\3\2\2\2/\u0104\3\2\2\2\61\u0109\3\2\2\2\63\u011b\3\2\2\2\65\u0127"+ "\3\2\2\2\67\u0138\3\2\2\29\u0144\3\2\2\2;\u0150\3\2\2\2=\u0153\3\2\2\2"+ "?\u0156\3\2\2\2A\u015d\3\2\2\2C\u0164\3\2\2\2E\u016b\3\2\2\2G\u0174\3"+ "\2\2\2IJ\7>\2\2JK\7#\2\2KL\7/\2\2LM\7/\2\2MQ\3\2\2\2NP\13\2\2\2ON\3\2"+ "\2\2PS\3\2\2\2QR\3\2\2\2QO\3\2\2\2RT\3\2\2\2SQ\3\2\2\2TU\7/\2\2UV\7/\2"+ "\2VW\7@\2\2W\b\3\2\2\2XY\7>\2\2YZ\7#\2\2Z[\7]\2\2[_\3\2\2\2\\^\13\2\2"+ "\2]\\\3\2\2\2^a\3\2\2\2_`\3\2\2\2_]\3\2\2\2`b\3\2\2\2a_\3\2\2\2bc\7_\2"+ "\2cd\7@\2\2d\n\3\2\2\2ef\7>\2\2fg\7A\2\2gh\7z\2\2hi\7o\2\2ij\7n\2\2jn"+ "\3\2\2\2km\13\2\2\2lk\3\2\2\2mp\3\2\2\2no\3\2\2\2nl\3\2\2\2oq\3\2\2\2"+ "pn\3\2\2\2qr\7@\2\2r\f\3\2\2\2st\7>\2\2tu\7#\2\2uv\7]\2\2vw\7E\2\2wx\7"+ "F\2\2xy\7C\2\2yz\7V\2\2z{\7C\2\2{|\7]\2\2|\u0080\3\2\2\2}\177\13\2\2\2"+ "~}\3\2\2\2\177\u0082\3\2\2\2\u0080\u0081\3\2\2\2\u0080~\3\2\2\2\u0081"+ "\u0083\3\2\2\2\u0082\u0080\3\2\2\2\u0083\u0084\7_\2\2\u0084\u0085\7_\2"+ "\2\u0085\u0086\7@\2\2\u0086\16\3\2\2\2\u0087\u0088\7>\2\2\u0088\u0089"+ "\7#\2\2\u0089\u008d\3\2\2\2\u008a\u008c\13\2\2\2\u008b\u008a\3\2\2\2\u008c"+ "\u008f\3\2\2\2\u008d\u008e\3\2\2\2\u008d\u008b\3\2\2\2\u008e\u0090\3\2"+ "\2\2\u008f\u008d\3\2\2\2\u0090\u0091\7@\2\2\u0091\20\3\2\2\2\u0092\u0093"+ "\7>\2\2\u0093\u0094\7A\2\2\u0094\u0098\3\2\2\2\u0095\u0097\13\2\2\2\u0096"+ "\u0095\3\2\2\2\u0097\u009a\3\2\2\2\u0098\u0099\3\2\2\2\u0098\u0096\3\2"+ "\2\2\u0099\u009b\3\2\2\2\u009a\u0098\3\2\2\2\u009b\u009c\7A\2\2\u009c"+ "\u00a9\7@\2\2\u009d\u009e\7>\2\2\u009e\u009f\7\'\2\2\u009f\u00a3\3\2\2"+ "\2\u00a0\u00a2\13\2\2\2\u00a1\u00a0\3\2\2\2\u00a2\u00a5\3\2\2\2\u00a3"+ "\u00a4\3\2\2\2\u00a3\u00a1\3\2\2\2\u00a4\u00a6\3\2\2\2\u00a5\u00a3\3\2"+ "\2\2\u00a6\u00a7\7\'\2\2\u00a7\u00a9\7@\2\2\u00a8\u0092\3\2\2\2\u00a8"+ "\u009d\3\2\2\2\u00a9\22\3\2\2\2\u00aa\u00b0\t\2\2\2\u00ab\u00ad\7\17\2"+ "\2\u00ac\u00ab\3\2\2\2\u00ac\u00ad\3\2\2\2\u00ad\u00ae\3\2\2\2\u00ae\u00b0"+ "\7\f\2\2\u00af\u00aa\3\2\2\2\u00af\u00ac\3\2\2\2\u00b0\u00b1\3\2\2\2\u00b1"+ "\u00af\3\2\2\2\u00b1\u00b2\3\2\2\2\u00b2\24\3\2\2\2\u00b3\u00b4\7>\2\2"+ "\u00b4\u00b5\7u\2\2\u00b5\u00b6\7e\2\2\u00b6\u00b7\7t\2\2\u00b7\u00b8"+ "\7k\2\2\u00b8\u00b9\7r\2\2\u00b9\u00ba\7v\2\2\u00ba\u00be\3\2\2\2\u00bb"+ "\u00bd\13\2\2\2\u00bc\u00bb\3\2\2\2\u00bd\u00c0\3\2\2\2\u00be\u00bf\3"+ "\2\2\2\u00be\u00bc\3\2\2\2\u00bf\u00c1\3\2\2\2\u00c0\u00be\3\2\2\2\u00c1"+ "\u00c2\7@\2\2\u00c2\u00c3\3\2\2\2\u00c3\u00c4\b\t\2\2\u00c4\26\3\2\2\2"+ "\u00c5\u00c6\7>\2\2\u00c6\u00c7\7u\2\2\u00c7\u00c8\7v\2\2\u00c8\u00c9"+ "\7{\2\2\u00c9\u00ca\7n\2\2\u00ca\u00cb\7g\2\2\u00cb\u00cf\3\2\2\2\u00cc"+ "\u00ce\13\2\2\2\u00cd\u00cc\3\2\2\2\u00ce\u00d1\3\2\2\2\u00cf\u00d0\3"+ "\2\2\2\u00cf\u00cd\3\2\2\2\u00d0\u00d2\3\2\2\2\u00d1\u00cf\3\2\2\2\u00d2"+ "\u00d3\7@\2\2\u00d3\u00d4\3\2\2\2\u00d4\u00d5\b\n\3\2\u00d5\30\3\2\2\2"+ "\u00d6\u00d7\7>\2\2\u00d7\u00d8\3\2\2\2\u00d8\u00d9\b\13\4\2\u00d9\32"+ "\3\2\2\2\u00da\u00dc\n\3\2\2\u00db\u00da\3\2\2\2\u00dc\u00dd\3\2\2\2\u00dd"+ "\u00db\3\2\2\2\u00dd\u00de\3\2\2\2\u00de\34\3\2\2\2\u00df\u00e0\7@\2\2"+ "\u00e0\u00e1\3\2\2\2\u00e1\u00e2\b\r\5\2\u00e2\36\3\2\2\2\u00e3\u00e4"+ "\7\61\2\2\u00e4\u00e5\7@\2\2\u00e5\u00e6\3\2\2\2\u00e6\u00e7\b\16\5\2"+ "\u00e7 \3\2\2\2\u00e8\u00e9\7\61\2\2\u00e9\"\3\2\2\2\u00ea\u00eb\7?\2"+ "\2\u00eb\u00ec\3\2\2\2\u00ec\u00ed\b\20\6\2\u00ed$\3\2\2\2\u00ee\u00f2"+ "\5/\26\2\u00ef\u00f1\5-\25\2\u00f0\u00ef\3\2\2\2\u00f1\u00f4\3\2\2\2\u00f2"+ "\u00f0\3\2\2\2\u00f2\u00f3\3\2\2\2\u00f3&\3\2\2\2\u00f4\u00f2\3\2\2\2"+ "\u00f5\u00f6\t\4\2\2\u00f6\u00f7\3\2\2\2\u00f7\u00f8\b\22\7\2\u00f8(\3"+ "\2\2\2\u00f9\u00fa\t\5\2\2\u00fa*\3\2\2\2\u00fb\u00fc\t\6\2\2\u00fc,\3"+ "\2\2\2\u00fd\u0102\5/\26\2\u00fe\u0102\t\7\2\2\u00ff\u0102\5+\24\2\u0100"+ "\u0102\t\b\2\2\u0101\u00fd\3\2\2\2\u0101\u00fe\3\2\2\2\u0101\u00ff\3\2"+ "\2\2\u0101\u0100\3\2\2\2\u0102.\3\2\2\2\u0103\u0105\t\t\2\2\u0104\u0103"+ "\3\2\2\2\u0105\60\3\2\2\2\u0106\u0108\13\2\2\2\u0107\u0106\3\2\2\2\u0108"+ "\u010b\3\2\2\2\u0109\u010a\3\2\2\2\u0109\u0107\3\2\2\2\u010a\u010c\3\2"+ "\2\2\u010b\u0109\3\2\2\2\u010c\u010d\7>\2\2\u010d\u010e\7\61\2\2\u010e"+ "\u010f\7u\2\2\u010f\u0110\7e\2\2\u0110\u0111\7t\2\2\u0111\u0112\7k\2\2"+ "\u0112\u0113\7r\2\2\u0113\u0114\7v\2\2\u0114\u0115\7@\2\2\u0115\u0116"+ "\3\2\2\2\u0116\u0117\b\27\5\2\u0117\62\3\2\2\2\u0118\u011a\13\2\2\2\u0119"+ "\u0118\3\2\2\2\u011a\u011d\3\2\2\2\u011b\u011c\3\2\2\2\u011b\u0119\3\2"+ "\2\2\u011c\u011e\3\2\2\2\u011d\u011b\3\2\2\2\u011e\u011f\7>\2\2\u011f"+ "\u0120\7\61\2\2\u0120\u0121\7@\2\2\u0121\u0122\3\2\2\2\u0122\u0123\b\30"+ "\5\2\u0123\64\3\2\2\2\u0124\u0126\13\2\2\2\u0125\u0124\3\2\2\2\u0126\u0129"+ "\3\2\2\2\u0127\u0128\3\2\2\2\u0127\u0125\3\2\2\2\u0128\u012a\3\2\2\2\u0129"+ "\u0127\3\2\2\2\u012a\u012b\7>\2\2\u012b\u012c\7\61\2\2\u012c\u012d\7u"+ "\2\2\u012d\u012e\7v\2\2\u012e\u012f\7{\2\2\u012f\u0130\7n\2\2\u0130\u0131"+ "\7g\2\2\u0131\u0132\7@\2\2\u0132\u0133\3\2\2\2\u0133\u0134\b\31\5\2\u0134"+ "\66\3\2\2\2\u0135\u0137\13\2\2\2\u0136\u0135\3\2\2\2\u0137\u013a\3\2\2"+ "\2\u0138\u0139\3\2\2\2\u0138\u0136\3\2\2\2\u0139\u013b\3\2\2\2\u013a\u0138"+ "\3\2\2\2\u013b\u013c\7>\2\2\u013c\u013d\7\61\2\2\u013d\u013e\7@\2\2\u013e"+ "\u013f\3\2\2\2\u013f\u0140\b\32\5\2\u01408\3\2\2\2\u0141\u0143\t\n\2\2"+ "\u0142\u0141\3\2\2\2\u0143\u0146\3\2\2\2\u0144\u0142\3\2\2\2\u0144\u0145"+ "\3\2\2\2\u0145\u0147\3\2\2\2\u0146\u0144\3\2\2\2\u0147\u0148\5;\34\2\u0148"+ "\u0149\3\2\2\2\u0149\u014a\b\33\5\2\u014a:\3\2\2\2\u014b\u0151\5E!\2\u014c"+ "\u0151\5G\"\2\u014d\u0151\5?\36\2\u014e\u0151\5A\37\2\u014f\u0151\5C "+ "\2\u0150\u014b\3\2\2\2\u0150\u014c\3\2\2\2\u0150\u014d\3\2\2\2\u0150\u014e"+ "\3\2\2\2\u0150\u014f\3\2\2\2\u0151<\3\2\2\2\u0152\u0154\t\13\2\2\u0153"+ "\u0152\3\2\2\2\u0154>\3\2\2\2\u0155\u0157\5=\35\2\u0156\u0155\3\2\2\2"+ "\u0157\u0158\3\2\2\2\u0158\u0156\3\2\2\2\u0158\u0159\3\2\2\2\u0159\u015b"+ "\3\2\2\2\u015a\u015c\7\"\2\2\u015b\u015a\3\2\2\2\u015b\u015c\3\2\2\2\u015c"+ "@\3\2\2\2\u015d\u015f\7%\2\2\u015e\u0160\t\5\2\2\u015f\u015e\3\2\2\2\u0160"+ "\u0161\3\2\2\2\u0161\u015f\3\2\2\2\u0161\u0162\3\2\2\2\u0162B\3\2\2\2"+ "\u0163\u0165\t\6\2\2\u0164\u0163\3\2\2\2\u0165\u0166\3\2\2\2\u0166\u0164"+ "\3\2\2\2\u0166\u0167\3\2\2\2\u0167\u0169\3\2\2\2\u0168\u016a\7\'\2\2\u0169"+ "\u0168\3\2\2\2\u0169\u016a\3\2\2\2\u016aD\3\2\2\2\u016b\u016f\7$\2\2\u016c"+ "\u016e\n\f\2\2\u016d\u016c\3\2\2\2\u016e\u0171\3\2\2\2\u016f\u016d\3\2"+ "\2\2\u016f\u0170\3\2\2\2\u0170\u0172\3\2\2\2\u0171\u016f\3\2\2\2\u0172"+ "\u0173\7$\2\2\u0173F\3\2\2\2\u0174\u0178\7)\2\2\u0175\u0177\n\r\2\2\u0176"+ "\u0175\3\2\2\2\u0177\u017a\3\2\2\2\u0178\u0176\3\2\2\2\u0178\u0179\3\2"+ "\2\2\u0179\u017b\3\2\2\2\u017a\u0178\3\2\2\2\u017b\u017c\7)\2\2\u017c"+ "H\3\2\2\2&\2\3\4\5\6Q_n\u0080\u008d\u0098\u00a3\u00a8\u00ac\u00af\u00b1"+ "\u00be\u00cf\u00dd\u00f2\u0101\u0104\u0109\u011b\u0127\u0138\u0144\u0150"+ "\u0153\u0158\u015b\u0161\u0166\u0169\u016f\u0178\b\7\4\2\7\5\2\7\3\2\6"+ "\2\2\7\6\2\b\2\2"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="OBeautifulCode"> // Copyright (c) OBeautifulCode 2018. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- using System; using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OBeautifulCode.Serialization.PropertyBag")] [assembly: AssemblyDescription("OBeautifulCode.Serialization.PropertyBag")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("OBeautifulCode")] [assembly: AssemblyProduct("OBeautifulCode.Serialization.PropertyBag")] [assembly: AssemblyCopyright("Copyright (c) 2018 OBeautifulCode")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7c60b21d-9d91-4832-9c4e-c55bbc597165")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: CLSCompliant(true)]
# ElasticaBundle This is a simple Symfony wrapper for [elastica](http://elastica.io/). It allows you to configure elastica as a service in Symfony. ## Installation Install is done via `composer`: ```zsh $ composer require wikibusiness/elastica-bundle ``` Add the bundle to your kernel: ```php // app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new WB\ElasticaBundle\WBElasticaBundle(), ); // ... } } // ... ``` Configure the bundle: ```yaml # app/config/config.yml wb_elastica: servers: main: host: 127.0.0.1 port: 9200 ``` Where `main` is a grouping. If you want to use Elastica in cluster mode, the config section should look something like this: ```yaml # app/config/config.yml wb_elastica: servers: host_1: host: 127.0.0.1 port: 9200 host_2: host: 127.0.0.1 port: 9201 ``` All done, you can now access the service via the service `wb_elastica.client` like this: ```php use Elastica\Search; $client = $container->get('wb_elastica.client'); $search = new Search($client); ... ```
--- title: النَّجاة مِن طُرُق العالم date: 20/01/2018 --- ### المراجع الأسبوعية مزمور ١١٩: ١١؛ أفسس ٦: ١٨؛ رومية ٨: ٥، ٦؛ عبرانيين ١١: ١-٦؛ ١ملوك ٣: ١٤؛ حزقيال ٣٦: ٢٦، ٢٧. > <p>آية الحفظ</p> > «لا ينفع الغِنى في يوم السَّخَط. أما البِرُّ فَيُنَجِّي من الموت... مَن يتَّكِل على غِنَاه يسقط. أمَّا الصِّدّيقون فَيَزْهون كالوَرَق» (أمثال ١١: ٤، ٢٨). رغم فشل الشيطان مع المسيح، إلا أنَّه نجح مع كل شخص آخر، وسوف يستمر في نجاحه ما لم نحاربه بسلاح وقوَّة الله، الذي وحده يهبنا الحرية من إغراءات هذا العالم. وهكذا، علينا أن نركِّز اهتمامنا على مُعيلنا السماوي. أدرَك داود القيمة الحقيقية في هذه الحياة عندما كتب، «الأشبال احتاجَت وجاعَتْ، وأمَّا طالِبُو الرَّبِّ فلا يُعوِزُهُم شيءٌ مِن الخير» (مزمور ٣٤: ١٠). وأدرك سليمان أنَّ الحكمة والفهم أكثر قيمة مِن الفضَّة والذّهب (أمثال ٣: ١٣، ١٤). السعادة الحقيقية والعيش الصحيح يأتيان حين نُحَوِّل أنظارنا مِن مُمْتلكاتِنا التي نمتلكها وننظر إلى المسيح الحي الذي يمتَلِكُنا. إنَّ رجاءَنا الوحيد للنجاة مِن إغواءات العالم هو علاقة حيويَّة وناجحة مع يسوع. سندرس في هذا الأسبوع عوامل تلك العلاقة ومدى أهميتها لنجاحنا الروحي لندرك القُوَّة الكامنة وراء قِناع العالم، ونرى أهمية المسيح كأساس حقيقي للحياة. _* نرجو التَّعمُّق في موضوع هذا الدرس، استعدادًا لِمُناقَشته يوم السبت القادم الموافق ٢٧ كانون الثاني (يناير)._
#!/bin/bash # get status information for a MiG job in LoadLeveler using llq # the command. A custom path can be specified here: QUERY="llq" ############################################################ ####### nothing serviceable below ### # these variables have to be set, checked below JOB_ENV="MIG_JOBNAME MIG_SUBMITUSER" function usage() { echo "Usage: $0 [CLASS]" echo "where CLASS is the LL class and the environment should provide" echo "values for MIG_JOBNAME and MIG_SUBMITUSER" } # check existence of environment variables: if [ -z "$MIG_JOBNAME" -o -z "$MIG_SUBMITUSER" ]; then usage exit 1 fi # a class name can be given if [ ! -z "$1" ]; then CLASS_OPT="-c $1" fi # Find job in queue - prints alphanumeric job PID if not yet done # query might return several lines, in which case we only use the first one. job=`$QUERY -f %st %jn %id $CLASS_OPT -u "$MIG_SUBMITUSER" | \ grep -e "$MIG_JOBNAME" | head -1` # job not found? ($jobs empty) [ -z "$job" ] && exit 0 # job might be in queue with status "Complete" (first column) echo "$job" | grep -e "^C.*$MIG_JOBNAME$" && exit 0 # otherwise, the job is still in the queue. exit 1
# Copyright (c) 2008-2013 Michael Dvorkin and contributors. # # Fat Free CRM is freely distributable under the terms of MIT license. # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe "/leads/_edit" do include LeadsHelper before do login_and_assign assign(:lead, @lead = FactoryGirl.create(:lead)) assign(:users, [current_user]) assign(:campaign, @campaign = FactoryGirl.create(:campaign)) assign(:campaigns, [@campaign]) end it "should render [edit lead] form" do render expect(view).to render_template(partial: "leads/_top_section") expect(view).to render_template(partial: "leads/_status") expect(view).to render_template(partial: "leads/_contact") expect(view).to render_template(partial: "leads/_web") expect(view).to render_template(partial: "entities/_permissions") expect(rendered).to have_tag("form[class=edit_lead]") do with_tag "input[type=hidden][id=lead_user_id][value='#{@lead.user_id}']" end end it "should render background info field if settings require so" do Setting.background_info = [:lead] render expect(rendered).to have_tag("textarea[id=lead_background_info]") end it "should not render background info field if settings do not require so" do Setting.background_info = [] render expect(rendered).not_to have_tag("textarea[id=lead_background_info]") end end
package org.andengine.engine.options.resolutionpolicy; import android.view.View.MeasureSpec; /** * (c) 2010 Nicolas Gramlich * (c) 2011 Zynga Inc. * * @author Nicolas Gramlich * @since 11:23:00 - 29.03.2010 */ public class RatioResolutionPolicy extends BaseResolutionPolicy { // =========================================================== // Constants // =========================================================== // =========================================================== // Fields // =========================================================== private final float mRatio; // =========================================================== // Constructors // =========================================================== public RatioResolutionPolicy(final float pRatio) { this.mRatio = pRatio; } public RatioResolutionPolicy(final float pWidthRatio, final float pHeightRatio) { this.mRatio = pWidthRatio / pHeightRatio; } // =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== @Override public void onMeasure(final IResolutionPolicy.Callback pResolutionPolicyCallback, final int pWidthMeasureSpec, final int pHeightMeasureSpec) { BaseResolutionPolicy.throwOnNotMeasureSpecEXACTLY(pWidthMeasureSpec, pHeightMeasureSpec); final int specWidth = MeasureSpec.getSize(pWidthMeasureSpec); final int specHeight = MeasureSpec.getSize(pHeightMeasureSpec); final float desiredRatio = this.mRatio; final float realRatio = ((float) specWidth) / specHeight; int measuredWidth; int measuredHeight; if (realRatio < desiredRatio) { measuredWidth = specWidth; measuredHeight = Math.round(measuredWidth / desiredRatio); } else { measuredHeight = specHeight; measuredWidth = Math.round(measuredHeight * desiredRatio); } pResolutionPolicyCallback.onResolutionChanged(measuredWidth, measuredHeight); } // =========================================================== // Methods // =========================================================== // =========================================================== // Inner and Anonymous Classes // =========================================================== }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE>AFL Match Statistics : North Melbourne defeats Brisbane at Etihad Stadium Round 11 Sunday, 3rd June 2018</TITLE> <meta NAME="description" CONTENT="North Melbourne defeats Brisbane at Etihad Stadium Round 11 Sunday, 3rd June 2018 AFL match statistics"> <meta NAME="keywords" CONTENT="AFL Match Statistics, AFL Game Statistics, AFL Match Stats"> <link rel="canonical" href="https://www.footywire.com/afl/footy/ft_match_statistics?mid=9609&advv=Y"/> <style> .tabbg { background-color: #000077; vertical-align: middle; } .blkbg { background-color: #000000; vertical-align: middle; } .tabbdr { background-color: #d8dfea; vertical-align: middle; } .wspace { background-color: #ffffff; vertical-align: middle; } .greybg { background-color: #f4f5f1; } .greybdr { background-color: #e3e4e0; } .blackbdr { background-color: #000000; } .lbgrey { background-color: #d4d5d1; text-decoration: none; color: #000000; vertical-align: middle; text-align: left; font-weight: bold; } .caprow { background-color: #f2f4f7; text-decoration: none; color: #000000; vertical-align: middle; text-align: center; font-weight: bold; } .ylwbg { background-color: #eeffee; text-decoration: none; color: #000000; vertical-align: middle; } .ylwbgmid { background-color: #eeffee; text-decoration: none; color: #000000; vertical-align: middle; text-align: center; } .ylwbgtop { background-color: #eeffee; text-decoration: none; color: #000000; vertical-align: top; } .ylwbgbottom { background-color: #eeffee; text-decoration: none; color: #000000; vertical-align: bottom; text-align: center; } .ylwbg2 { background-color: #ddeedd; } .ylwbdr { background-color: #ccddcc; } .mtabbg { background-color: #f2f4f7; vertical-align: top; text-align: center; } .error { background-color: #ffffff; text-decoration: none; color: #ff0000; vertical-align: middle; text-align: left; font-weight: bold; } .cerror { background-color: #ffffff; text-decoration: none; color: #ff0000; vertical-align: middle; text-align: center; font-weight: bold; } .greytxt { color: #777777; } .bluetxt { color: #003399; } .normtxt { color: #000000; } .norm { background-color: #ffffff; text-decoration: none; color: #000000; vertical-align: middle; text-align: center; } .drow { background-color: #f2f4f7; text-decoration: none; color: #000000; vertical-align: middle; text-align: center; } .lnorm { background-color: #ffffff; text-decoration: none; color: #000000; vertical-align: middle; text-align: left; } .rnorm { background-color: #ffffff; text-decoration: none; color: #000000; vertical-align: middle; text-align: right; } .rdrow { background-color: #f2f4f7; text-decoration: none; color: #000000; vertical-align: middle; text-align: right; } .ldrow { background-color: #f2f4f7; text-decoration: none; color: #000000; vertical-align: middle; text-align: left; } .bnorm { background-color: #ffffff; text-decoration: none; color: #000000; vertical-align: middle; text-align: center; font-weight: bold; } .rbnorm { background-color: #ffffff; text-decoration: none; color: #000000; vertical-align: middle; text-align: right; font-weight: bold; } .lbnorm { background-color: #ffffff; text-decoration: none; color: #000000; vertical-align: middle; text-align: left; font-weight: bold; } .bdrow { background-color: #f2f4f7; text-decoration: none; color: #000000; vertical-align: middle; text-align: center; font-weight: bold; } .lbdrow { background-color: #f2f4f7; text-decoration: none; color: #000000; vertical-align: middle; text-align: left; font-weight: bold; } .lylw { background-color: #eeffee; text-decoration: none; color: #000000; vertical-align: middle; text-align: left; } .normtop { background-color: #ffffff; text-decoration: none; color: #000000; vertical-align: top; text-align: center; } .lnormtop { background-color: #ffffff; text-decoration: none; color: #000000; vertical-align: top; text-align: left; } .drowtop { background-color: #f2f4f7; text-decoration: none; color: #000000; vertical-align: top; text-align: center; } .ldrowtop { background-color: #f2f4f7; text-decoration: none; color: #000000; vertical-align: top; text-align: left; } a.tblink:link { color: #ffffff; font-weight: bold; vertical-align: middle; } .dvr { color: #999999; font-weight: normal; vertical-align: middle; } .hltitle { text-decoration: none; color: #000000; font-size: 16px; font-weight: bold; } .whltitle { background-color: #ffffff; text-decoration: none; color: #000000; font-size: 16px; font-weight: bold; } .idxhltitle { text-decoration: none; color: #990099; font-size: 16px; font-weight: bold; } .tbtitle { text-decoration:none; color:#3B5998; font-weight:bold; border-top:1px solid #e4ebf6; border-bottom:1px solid #D8DFEA; background:#D8DFEA url(/afl/img/icon/tbback.png); bottom left repeat-x; } .innertbtitle { background-color:#D8DFEA; text-decoration:none; color:#3B5998; font-weight:normal; background:#D8DFEA url(/afl/img/icon/tbback.png); bottom left repeat-x; } .tabopt { background-color: #5555cc; vertical-align: middle; text-align: center; } .tabsel { background-color: #ffffff; text-decoration: underline; color: #000000; font-weight: bold; vertical-align: middle; text-align: center; } a.tablink { font-weight:bold; vertical-align:middle; } a.tablink:link { color: #ffffff; } a.tablink:hover { color: #eeeeee; } .lnitxt { } .lseltxt { } .lselbldtxt { font-weight: bold; } .formcls { background-color:#f2f4f7; vertical-align:middle; text-align:left } .formclsright { background-color:#f2f4f7; vertical-align:middle; text-align:right } li { background-color: #ffffff; color: #000000; } p { color: #000000; } th { background-color: #ffffff; text-decoration: none; color: #000000; vertical-align: middle; text-align: center; font-weight: bold; } a.wire { font-weight:bold } .menubg { background-color: #000077; text-decoration: none; color: #000000; vertical-align: middle; text-align: center; } .menubdr { background-color: #f2f4f7; vertical-align: middle; } table#wiretab { border-spacing:0px; border-collapse:collapse; background-color:#F2F4F7; width:450px; height:250px; } table#wiretab td.section { border-bottom:1px solid #D8DFEA; } table#wirecell { background-color:#F2F4F7; border:0px; } table#wirecell td#wirecelltitle { vertical-align:top; } table#wirecell td#wirecellblurb { vertical-align:top; } .smnt { background-color: #ffffff; text-decoration: none; color: #000000; vertical-align: middle; text-align: left; } a.peep { font-weight:bold; font-size: 12px; line-height: 14px; } form { padding:0px; margin:0px; } table.thickouter { border:1px solid #D8DFEA; } table.thickouter td.padded { padding:2px; } div.notice { border:1px solid #D8DFEA; padding:8px; background:#D8DFEA url(/afl/img/icon/customback.png); text-align:center; vertical-align:middle; margin-bottom:10px; font-size: 12px; } div.notice div.clickable { font-weight:bold; cursor:pointer; display:inline; color:#3B5998; } div.datadiv td.data, div.datadiv td.bdata { padding:3px; vertical-align:top; } div.datadiv td.bdata { font-weight:bold; } a:focus { outline:none; } h1.centertitle { padding-top:10px; font-size:20px; font-weight:bold; text-align:center; } #matchscoretable { background-color : #eeffee; border:1px solid #ccddcc; } #matchscoretable td, #matchscoretable th { background-color : #eeffee; text-decoration: none; color: #000000; vertical-align: middle; } #matchscoretable th, #matchscoretable th.leftbold { border-bottom:1px solid #ccddcc; font-weight:bold; } #matchscoretable td.leftbold { font-weight:bold; } #matchscoretable td.leftbold, #matchscoretable th.leftbold { text-align:left; padding-left:10px; } body { margin-top:0px; margin-bottom:5px; margin-left:5px; margin-right:5px; background-color:#ffffff; overflow-x: auto; overflow-y: auto; } body, p, td, th, textarea, input, select, h1, h2, h3, h4, h5, h6 { font-family: "lucida grande",tahoma,verdana,arial,sans-serif; font-size:11px; text-decoration: none; } table.plain { border-spacing:0px; border-collapse:collapse; padding:0px; } table.leftmenu { background-color:#F7F7F7; } table.leftmenu td { padding:2px 2px 2px 5px; } table.leftmenu td#skyscraper { padding:2px 0px 2px 0px; text-align:left; margin:auto; vertical-align:top; background-color:#ffffff; } table.leftmenu td#topborder { padding:0px 0px 0px 0px; border-top:5px solid #b7b7b7; font-size:5px; } table.leftmenu td#bottomborder { padding:0px 0px 0px 0px; border-bottom:1px solid #b7b7b7; font-size:5px; } table.leftmenu td#bottomborderpad { padding:0px 0px 0px 0px; border-bottom:0px solid #b7b7b7; font-size:3px; } td#headercell { text-align:left; vertical-align:bottom; background:#3B5998 url(/afl/img/logo/header-logo-bg-2011.png); } a.leftmenu { color:#3B5998; display:block; width:100%; text-decoration:none; } a.leftmenu:hover { text-decoration:none; } a { color:#3B5998; } a:link { text-decoration:none; } a:visited { text-decoration:none; } a:active { text-decoration:none; } a:hover { text-decoration:underline; } table#footer { border-spacing:0px; border-collapse:collapse; padding:0px; color:#868686; width:760px; } table#footer td#footercopy { text-align:left; } table#footer td#footerlinks { text-align:right; } table#footer a { padding:0px 2px 0px 2px; } .textinput { border:1px solid #BDC7D8; padding:2px 2px 2px 2px; } .button { color:#ffffff; height:18px; padding:0px 4px 4px 4px; border:1px solid #3B5998; background:#5b79b8 url(/afl/img/icon/btback.png); bottom left repeat-x; vertical-align:middle; cursor:pointer; } .button:focus { outline:none; } .button::-moz-focus-inner { border: 0; } a.button:link, a.button:visited, a.button:hover { text-decoration:none; } td.blocklink { padding:3px 3px 3px 3px; } a.blocklink { padding:2px 2px 2px 2px; } a.blocklink:hover { background-color:#3B5998; color:#ffffff; text-decoration:none; } table#teammenu, table#playermenu, table#playerrankmenu, table#teamrankmenu, table#draftmenu, table#risingstarmenu, table#matchmenu, table#laddermenu, table#brownlowmenu, table#attendancemenu, table#coachmenu, table#supercoachmenu, table#dreamteammenu, table#highlightsmenu, table#selectionsmenu, table#pastplayermenu, table#tweetmenu, table#contractsmenu { border-spacing:0px; border-collapse:collapse; background-color:#F7F7F7; z-index:1; position:absolute; left:0px; top:0px; visibility:hidden; border:1px solid #b7b7b7; opacity:.95; filter:alpha(opacity=95); width:220px; } a.submenuitem { padding:3px; color:#3B5998; text-decoration:none; border:0px solid #3B5998; } a.submenuitem:link { text-decoration:none; } a.submenuitem:hover { text-decoration:underline; } div.submenux, div.submenutitle { font-size:9px; color:#676767; font-weight:bold; } div.submenux { color:#676767; cursor:pointer; } div.submenutitle { color:#353535; padding:4px 2px 2px 2px; } td#teamArrow, td#playerArrow, td#playerrankArrow, td#teamrankArrow, td#draftArrow, td#risingstarArrow, td#matchArrow, td#ladderArrow, td#brownlowArrow, td#attendanceArrow, td#coachArrow, td#supercoachArrow, td#dreamteamArrow, td#highlightsArrow, td#selectionsArrow, td#pastplayerArrow, td#tweetArrow, td#contractsArrow { color:#676767; font-weight:bold; display:block; text-decoration:none; border-left:1px solid #F7F7F7; cursor:pointer; text-align:center; width:10px; } table#header { border-spacing:0px; border-collapse:collapse; margin:auto; width:100%; } table#header td { border:0px solid #3B5998; } table#header td#logo { vertical-align:middle; text-align:center; } table#header td#mainlinks { vertical-align:bottom; text-align:left; padding-bottom:10px; } table#header td#memberStatus { vertical-align:bottom; text-align:right; padding-bottom:10px; } a.emptylink, a.emptylink:link, a.emptylink:visited, a.emptylink:active, a.emptylink:hover { border:0px; margin:0px; text-decoration:none; } table#header a.headerlink { font-size:12px; font-weight:bold; color:#ffffff; padding:4px; } table#header a.headerlink:link { background-color:#3B5998; text-decoration:none; } table#header a.headerlink:visited { background-color:#3B5998; text-decoration:none; } table#header a.headerlink:active { background-color:#3B5998; text-decoration:none; } table#header a.headerlink:hover { background-color:#6D84B4; text-decoration:none; } table#header a.userlink { font-size:11px; font-weight:normal; color:#D8DFEA; padding:5px; } table#header a.userlink:link { color:#D8DFEA; text-decoration:none; } table#header a.userlink:visited { color:#D8DFEA; text-decoration:none; } table#header a.userlink:active { color:#D8DFEA; text-decoration:none; } table#header a.userlink:hover { color:#ffffff; text-decoration:underline; } table#header div#welcome { display:inline; font-size:11px; font-weight:bold; color:#D8DFEA; padding:5px; } td.hdbar { text-decoration:none; border-top:1px solid #92201e; border-bottom:1px solid #760402; background:#D8DFEA url(/afl/img/icon/hdback.png); bottom left repeat-x; padding:0px 5px 0px 5px; } td.hdbar div { color:#ffffff; display:inline; padding:0px 5px 0px 5px; } td.hdbar div a { font-size:11px; font-weight:normal; color:#ffffff; font-weight:bold; } td.hdbar div a:link { text-decoration:none; } td.hdbar div a:hover { text-decoration:underline; } div#membersbgdiv { background:#888888; opacity:.50; filter:alpha(opacity=50); z-index:1; position:absolute; left:0px; top:0px; width:100%; height:100%; text-align:center; vertical-align:middle; display:none; } div#memberswhitediv { width:610px; height:380px; border:3px solid #222222; background:#ffffff; opacity:1; filter:alpha(opacity=100); z-index:2; position:absolute; left:0; top:0; border-radius:20px; -moz-border-radius:20px; /* Old Firefox */ padding:15px; display:none; } #membersx { color:#222222; font-weight:bold; font-size:16px; cursor:pointer; } </style> <script type="text/javascript"> function flipSubMenu(cellid, tableid) { var table = document.getElementById(tableid); if (table.style.visibility == 'visible') { hideSubMenu(tableid); } else { showSubMenu(cellid, tableid); } } function showSubMenu(cellid, tableid) { hideAllSubMenus(); var cell = document.getElementById(cellid); var coors = findPos(cell); var table = document.getElementById(tableid); table.style.visibility = 'visible'; table.style.top = (coors[1]) + 'px'; table.style.left = (coors[0] + 175) + 'px'; } function hideSubMenu(tableid) { var table = document.getElementById(tableid); if (table != null) { table.style.visibility = 'hidden'; } } function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { curleft = obj.offsetLeft curtop = obj.offsetTop while (obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop } } return [curleft,curtop]; } function highlightCell(tag) { var cell = document.getElementById(tag + 'linkcell'); cell.style.backgroundColor = "#E7E7E7"; highlightArrow(tag + 'Arrow'); } function dehighlightCell(tag) { var cell = document.getElementById(tag + 'linkcell'); cell.style.backgroundColor = "transparent"; dehighlightArrow(tag + 'Arrow'); } function highlightArrow(arrowId) { var arrow = document.getElementById(arrowId); arrow.style.backgroundColor = "#E7E7E7"; } function dehighlightArrow(arrowId) { var arrow = document.getElementById(arrowId); arrow.style.backgroundColor = "transparent"; } function hideAllSubMenus() { hideSubMenu('teammenu'); hideSubMenu('playermenu'); hideSubMenu('teamrankmenu'); hideSubMenu('playerrankmenu'); hideSubMenu('draftmenu'); hideSubMenu('risingstarmenu'); hideSubMenu('matchmenu'); hideSubMenu('brownlowmenu'); hideSubMenu('laddermenu'); hideSubMenu('attendancemenu'); hideSubMenu('supercoachmenu'); hideSubMenu('dreamteammenu'); hideSubMenu('coachmenu'); hideSubMenu('highlightsmenu'); hideSubMenu('selectionsmenu'); hideSubMenu('pastplayermenu'); hideSubMenu('contractsmenu'); hideSubMenu('tweetmenu'); } function GetMemberStatusXmlHttpObject() { var xmlMemberStatusHttp=null; try { // Firefox, Opera 8.0+, Safari xmlMemberStatusHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlMemberStatusHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlMemberStatusHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlMemberStatusHttp; } function rememberMember() { xmlMemberStatusHttp=GetMemberStatusXmlHttpObject(); url="/club/sports/member-remember.html?sid=" + Math.random(); xmlMemberStatusHttp.onreadystatechange=showAlert; xmlMemberStatusHttp.open("GET",url,true); xmlMemberStatusHttp.send(null); } function quickLogout() { xmlMemberStatusHttp=GetMemberStatusXmlHttpObject(); url="/afl/club/quick-logout.html?sid=" + Math.random(); xmlMemberStatusHttp.onreadystatechange=showAlert; xmlMemberStatusHttp.open("GET",url,true); xmlMemberStatusHttp.send(null); } function showMemberStatus() { xmlMemberStatusHttp = GetMemberStatusXmlHttpObject(); url = "/afl/club/member-status.html?sid=" + Math.random(); fetchShowMemberStatus(xmlMemberStatusHttp, url); } function showMemberStatusWithUrl(url) { xmlMemberStatusHttp = GetMemberStatusXmlHttpObject(); url = "/afl/club/member-status.html?url=" + url + "&sid=" + Math.random(); fetchShowMemberStatus(xmlMemberStatusHttp, url); } function showMemberStatusSkipAds() { xmlMemberStatusHttp = GetMemberStatusXmlHttpObject(); url = "/afl/club/member-status.html?skipAds=Y&sid=" + Math.random(); fetchShowMemberStatus(xmlMemberStatusHttp, url); } function showMemberStatusWithUrlSkipAds(url) { xmlMemberStatusHttp = GetMemberStatusXmlHttpObject(); url = "/afl/club/member-status.html?skipAds=Y&url=" + url + "&sid=" + Math.random(); fetchShowMemberStatus(xmlMemberStatusHttp, url); } function fetchShowMemberStatus(xmlMemberStatusHttp, url) { xmlMemberStatusHttp.onreadystatechange = memberStatusChanged; xmlMemberStatusHttp.open("GET", url, true); xmlMemberStatusHttp.send(null); } function showAlert() { if (xmlMemberStatusHttp.readyState==4) { alertMessage = xmlMemberStatusHttp.responseText; showMemberStatus(); alert(alertMessage); } } function memberStatusChanged() { if (xmlMemberStatusHttp.readyState==4) { response = xmlMemberStatusHttp.responseText; if (response.indexOf("<!-- MEMBER STATUS -->") < 0) { response = " "; } document.getElementById("memberStatus").innerHTML = response; } } function pushSignUpEvent(signUpSource) { _gaq.push(['_trackEvent', 'Member Activity', 'Sign Up', signUpSource]); } function pushContent(category, page) { _gaq.push(['_trackEvent', 'Content', category, page]); } function GetXmlHttpObject() { var xmlWireHttp=null; try { // Firefox, Opera 8.0+, Safari xmlWireHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlWireHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlWireHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlWireHttp; } function showWire() { xmlWireHttp=GetXmlHttpObject() url="/afl/club/forum-threads-wire.html?sid=" + Math.random(); fetchWire(xmlWireHttp, url); } function showWireSkipAds() { xmlWireHttp=GetXmlHttpObject() url="/afl/club/forum-threads-wire.html?skipAds=Y&sid=" + Math.random(); fetchWire(xmlWireHttp, url); } function fetchWire(xmlWireHttp, url) { xmlWireHttp.onreadystatechange = wireChanged; xmlWireHttp.open("GET", url, true); xmlWireHttp.send(null); } function wireChanged() { if (xmlWireHttp.readyState==4) { response = xmlWireHttp.responseText; if (response.indexOf("<!-- WIRE -->") < 0) { response = " "; } document.getElementById("threadsWire").innerHTML=response; } } function positionMemberDivs() { var bodyOffsetHeight = document.body.offsetHeight; document.getElementById('membersbgdiv').style.width = '100%'; document.getElementById('membersbgdiv').style.height = '100%'; var leftOffset = (document.getElementById('membersbgdiv').offsetWidth - document.getElementById('memberswhitediv').offsetWidth) / 2; var topOffset = ((document.getElementById('membersbgdiv').offsetHeight - document.getElementById('memberswhitediv').offsetHeight) / 2); document.getElementById('memberswhitediv').style.left = leftOffset; document.getElementById('memberswhitediv').style.top = topOffset; document.getElementById('membersbgdiv').style.height = bodyOffsetHeight; } function closeMemberDivs() { document.getElementById('membersbgdiv').style.display = 'none'; document.getElementById('memberswhitediv').style.display = 'none'; } function displayMemberDivs() { document.getElementById('membersbgdiv').style.display = 'block'; document.getElementById('memberswhitediv').style.display = 'block'; positionMemberDivs(); } function openRegistrationLoginDialog() { document.getElementById('memberscontent').innerHTML = "<iframe src='/afl/footy/custom_login' width=600 height=350 hspace=0 vspace=0 frameborder=0 marginheight=0 marginwidth=0 scrolling=no></iframe>"; document.getElementById('memberswhitediv').style.width = '610px'; document.getElementById('memberswhitediv').style.height = '380px'; displayMemberDivs(); } function openRegistrationLoginDialogWithNextPage(nextPage) { document.getElementById('memberscontent').innerHTML = "<div><iframe src='/afl/footy/custom_login?p=" + nextPage + "' width=600 height=350 hspace=0 vspace=0 frameborder=0 marginheight=0 marginwidth=0 scrolling=no></iframe></div>" document.getElementById('memberswhitediv').style.width = '610px'; document.getElementById('memberswhitediv').style.height = '380px'; displayMemberDivs(); } function openChangePasswordDialog() { document.getElementById('memberscontent').innerHTML = "<div><iframe src='/afl/footy/custom_login?action=changePasswordForm' width=250 height=190 hspace=0 vspace=0 frameborder=0 marginheight=0 marginwidth=0 scrolling=no></iframe></div>" document.getElementById('memberswhitediv').style.width = '250px'; document.getElementById('memberswhitediv').style.height = '240px'; displayMemberDivs(); } function openManageSettingsDialog() { document.getElementById('memberscontent').innerHTML = "<div><iframe src='/afl/footy/custom_login?action=manageSettingsForm' width=380 height=210 hspace=0 vspace=0 frameborder=0 marginheight=0 marginwidth=0 scrolling=no></iframe></div>" document.getElementById('memberswhitediv').style.width = '380px'; document.getElementById('memberswhitediv').style.height = '260px'; displayMemberDivs(); } var xmlLoginHttp; function GetLoginXmlHttpObject() { var xmlLoginHttp=null; try { // Firefox, Opera 8.0+, Safari xmlLoginHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlLoginHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlLoginHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlLoginHttp; } function postLogout() { var params = "action=logout"; xmlLoginHttp=GetLoginXmlHttpObject(); xmlLoginHttp.onreadystatechange = validateLogoutResponse; xmlLoginHttp.open("POST", '/afl/footy/custom_login', true); xmlLoginHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlLoginHttp.setRequestHeader("Content-length", params.length); xmlLoginHttp.setRequestHeader("Connection", "close"); xmlLoginHttp.send(params); } function getPlugContent(type) { xmlLoginHttp=GetLoginXmlHttpObject() xmlLoginHttp.onreadystatechange = plugCustomFantasy; xmlLoginHttp.open("GET", '/afl/footy/custom_login?action=plug&type=' + type, true); xmlLoginHttp.send(null); } function validateResponse() { if(xmlLoginHttp.readyState == 4 && xmlLoginHttp.status == 200) { var result = xmlLoginHttp.responseText; if (result == 'PASS') { self.parent.location.reload(true); } else if (result.indexOf('ERROR:') == 0) { result = result.substring(6); alert(result + ". Please try again."); } else { alert("An error occurred during registration."); } } } function plugCustomFantasy() { if (xmlLoginHttp.readyState == 4 && xmlLoginHttp.status == 200) { var response = xmlLoginHttp.responseText; if (response.indexOf("<!-- PLUG -->") < 0) { response = ""; } document.getElementById("customPlugDiv").innerHTML=response; } } function validateLogoutResponse() { if(xmlLoginHttp.readyState == 4 && xmlLoginHttp.status == 200) { var result = xmlLoginHttp.responseText; if (result == 'PASS') { selfReload(); } else if (result.indexOf('ERROR:') == 0) { result = result.substring(6); alert(result + ". Please try again."); } else { alert("Oops! An error occurred!"); } } } function selfReload() { if (xmlLoginHttp.readyState == 4 && xmlLoginHttp.status == 200) { self.parent.location.reload(true); } } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-3312858-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </HEAD> <BODY onload="pushContent('Match Statistics', 'Match Statistics');showMemberStatusWithUrl('https%3A%2F%2Fwww.footywire.com%2Fafl%2Ffooty%2Fft_match_statistics');showWire();hideAllSubMenus();" onresize="positionMemberDivs();"> <DIV align="CENTER"> <table cellpadding="0" cellspacing="0" border="0" id="frametable2008" width="948"> <tr><td colspan="4" height="102" id="headercell" width="948"> <table id="header"> <tr> <td id="logo" valign="middle" height="102" width="200"> <a class="emptylink" href="//www.footywire.com/"><div style="width:200px;height:54px;cursor:pointer;">&nbsp;</div></a> </td> <td id="mainlinks" width="200"> </td> <td style="padding-top:3px;padding-right:4px;"> <div style="margin-left:-3px;"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Footywire 728x90 Prime --> <ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-1151582373407200" data-ad-slot="7204222137"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </td> </tr> </table> </td></tr> <tr><td colspan="4" height="21" class="hdbar" align="right" valign="middle" id="memberStatus"></td></tr> <tr> <td rowspan="4" width="175" valign="top"> <table width="175" cellpadding="0" cellspacing="0" border="0" class="leftmenu"> <tr><td colspan="2" id="topborder">&nbsp;</td></tr> <tr><td width="175" colspan="2" onMouseOver="this.style.backgroundColor='#e7e7e7';" onMouseOut="this.style.backgroundColor='transparent';"><a class="leftmenu" href="//www.footywire.com/">AFL Statistics Home</a></td></tr> <tr> <td id="matchlinkcell" width="165"><a onMouseOver="highlightCell('match')" onMouseOut="dehighlightCell('match')" class="leftmenu" href="/afl/footy/ft_match_list">AFL Fixture</a></td> <td id="matchArrow" onMouseOver="highlightArrow('matchArrow')" onMouseOut="dehighlightArrow('matchArrow')" onClick="flipSubMenu('matchlinkcell','matchmenu')">&#187;</td> </tr> <tr> <td id="playerlinkcell" width="165"><a onMouseOver="highlightCell('player')" onMouseOut="dehighlightCell('player')" class="leftmenu" href="/afl/footy/ft_players">Players</a></td> <td id="playerArrow" onMouseOver="highlightArrow('playerArrow')" onMouseOut="dehighlightArrow('playerArrow')" onClick="flipSubMenu('playerlinkcell','playermenu')">&#187;</td> </tr> <tr> <td id="teamlinkcell" width="165"><a onMouseOver="highlightCell('team')" onMouseOut="dehighlightCell('team')" class="leftmenu" href="/afl/footy/ft_teams">Teams</a></td> <td id="teamArrow" onMouseOver="highlightArrow('teamArrow')" onMouseOut="dehighlightArrow('teamArrow')" onClick="flipSubMenu('teamlinkcell','teammenu')">&#187;</td> </tr> <tr> <td id="playerranklinkcell" width="165"><a onMouseOver="highlightCell('playerrank')" onMouseOut="dehighlightCell('playerrank')" class="leftmenu" href="/afl/footy/ft_player_rankings">Player Rankings</a></td> <td id="playerrankArrow" onMouseOver="highlightArrow('playerrankArrow')" onMouseOut="dehighlightArrow('playerrankArrow')" onClick="flipSubMenu('playerranklinkcell','playerrankmenu')">&#187;</td> </tr> <tr> <td id="teamranklinkcell" width="165"><a onMouseOver="highlightCell('teamrank')" onMouseOut="dehighlightCell('teamrank')" class="leftmenu" href="/afl/footy/ft_team_rankings">Team Rankings</a></td> <td id="teamrankArrow" onMouseOver="highlightArrow('teamrankArrow')" onMouseOut="dehighlightArrow('teamrankArrow')" onClick="flipSubMenu('teamranklinkcell','teamrankmenu')">&#187;</td> </tr> <tr> <td id="risingstarlinkcell" width="165"><a onMouseOver="highlightCell('risingstar')" onMouseOut="dehighlightCell('risingstar')" class="leftmenu" href="/afl/footy/ft_rising_stars_round_performances">Rising Stars</a></td> <td id="risingstarArrow" onMouseOver="highlightArrow('risingstarArrow')" onMouseOut="dehighlightArrow('risingstarArrow')" onClick="flipSubMenu('risingstarlinkcell','risingstarmenu')">&#187;</td> </tr> <tr> <td id="draftlinkcell" width="165"><a onMouseOver="highlightCell('draft')" onMouseOut="dehighlightCell('draft')" class="leftmenu" href="/afl/footy/ft_drafts">AFL Draft</a></td> <td id="draftArrow" onMouseOver="highlightArrow('draftArrow')" onMouseOut="dehighlightArrow('draftArrow')" onClick="flipSubMenu('draftlinkcell','draftmenu')">&#187;</td> </tr> <tr> <td id="brownlowlinkcell" width="165"><a onMouseOver="highlightCell('brownlow')" onMouseOut="dehighlightCell('brownlow')" class="leftmenu" href="/afl/footy/brownlow_medal">Brownlow Medal</a></td> <td id="brownlowArrow" onMouseOver="highlightArrow('brownlowArrow')" onMouseOut="dehighlightArrow('brownlowArrow')" onClick="flipSubMenu('brownlowlinkcell','brownlowmenu')">&#187;</td> </tr> <tr> <td id="ladderlinkcell" width="165"><a onMouseOver="highlightCell('ladder')" onMouseOut="dehighlightCell('ladder')" class="leftmenu" href="/afl/footy/ft_ladder">AFL Ladder</a></td> <td id="ladderArrow" onMouseOver="highlightArrow('ladderArrow')" onMouseOut="dehighlightArrow('ladderArrow')" onClick="flipSubMenu('ladderlinkcell','laddermenu')">&#187;</td> </tr> <tr> <td id="coachlinkcell" width="165"><a onMouseOver="highlightCell('coach')" onMouseOut="dehighlightCell('coach')" class="leftmenu" href="/afl/footy/afl_coaches">Coaches</a></td> <td id="coachArrow" onMouseOver="highlightArrow('coachArrow')" onMouseOut="dehighlightArrow('coachArrow')" onClick="flipSubMenu('coachlinkcell','coachmenu')">&#187;</td> </tr> <tr> <td id="attendancelinkcell" width="165"><a onMouseOver="highlightCell('attendance')" onMouseOut="dehighlightCell('attendance')" class="leftmenu" href="/afl/footy/attendances">Attendances</a></td> <td id="attendanceArrow" onMouseOver="highlightArrow('attendanceArrow')" onMouseOut="dehighlightArrow('attendanceArrow')" onClick="flipSubMenu('attendancelinkcell','attendancemenu')">&#187;</td> </tr> <tr> <td id="supercoachlinkcell" width="165"><a onMouseOver="highlightCell('supercoach')" onMouseOut="dehighlightCell('supercoach')" class="leftmenu" href="/afl/footy/supercoach_round">Supercoach</a></td> <td id="supercoachArrow" onMouseOver="highlightArrow('supercoachArrow')" onMouseOut="dehighlightArrow('supercoachArrow')" onClick="flipSubMenu('supercoachlinkcell','supercoachmenu')">&#187;</td> </tr> <tr> <td id="dreamteamlinkcell" width="165"><a onMouseOver="highlightCell('dreamteam')" onMouseOut="dehighlightCell('dreamteam')" class="leftmenu" href="/afl/footy/dream_team_round">AFL Fantasy</a></td> <td id="dreamteamArrow" onMouseOver="highlightArrow('dreamteamArrow')" onMouseOut="dehighlightArrow('dreamteamArrow')" onClick="flipSubMenu('dreamteamlinkcell','dreamteammenu')">&#187;</td> </tr> <tr> <td id="highlightslinkcell" width="165"><a onMouseOver="highlightCell('highlights')" onMouseOut="dehighlightCell('highlights')" class="leftmenu" href="/afl/footy/afl_highlights">AFL Highlights</a></td> <td id="highlightsArrow" onMouseOver="highlightArrow('highlightsArrow')" onMouseOut="dehighlightArrow('highlightsArrow')" onClick="flipSubMenu('highlightslinkcell','highlightsmenu')">&#187;</td> </tr> <tr> <td id="selectionslinkcell" width="165"><a onMouseOver="highlightCell('selections')" onMouseOut="dehighlightCell('selections')" class="leftmenu" href="/afl/footy/afl_team_selections">AFL Team Selections</a></td> <td id="selectionsArrow" onMouseOver="highlightArrow('selectionsArrow')" onMouseOut="dehighlightArrow('selectionsArrow')" onClick="flipSubMenu('selectionslinkcell','selectionsmenu')">&#187;</td> </tr> <tr> <td id="pastplayerlinkcell" width="165"><a onMouseOver="highlightCell('pastplayer')" onMouseOut="dehighlightCell('pastplayer')" class="leftmenu" href="/afl/footy/past_players">Past Players</a></td> <td id="pastplayerArrow" onMouseOver="highlightArrow('pastplayerArrow')" onMouseOut="dehighlightArrow('pastplayerArrow')" onClick="flipSubMenu('pastplayerlinkcell','pastplayermenu')">&#187;</td> </tr> <tr> <td id="contractslinkcell" width="165"><a onMouseOver="highlightCell('contracts')" onMouseOut="dehighlightCell('contracts')" class="leftmenu" href="/afl/footy/out_of_contract_players">AFL Player Contracts</a></td> <td id="contractsArrow" onMouseOver="highlightArrow('contractsArrow')" onMouseOut="dehighlightArrow('contractsArrow')" onClick="flipSubMenu('contractslinkcell','contractsmenu')">&#187;</td> </tr> <tr><td width="175" colspan="2" onMouseOver="this.style.backgroundColor='#e7e7e7';" onMouseOut="this.style.backgroundColor='transparent';"><a class="leftmenu" href="/afl/footy/afl_betting">AFL Betting</a></td></tr> <tr><td width="175" colspan="2" onMouseOver="this.style.backgroundColor='#e7e7e7';" onMouseOut="this.style.backgroundColor='transparent';"><a class="leftmenu" href="/afl/footy/injury_list">AFL Injury List</a></td></tr> <tr><td width="175" colspan="2" onMouseOver="this.style.backgroundColor='#e7e7e7';" onMouseOut="this.style.backgroundColor='transparent';"><a class="leftmenu" href="/afl/footy/ft_season_records">Records</a></td></tr> <tr><td colspan="2" id="bottomborder">&nbsp;</td></tr> <tr><td colspan="2" class="norm" style="height:10px"></td></tr> <tr><td colspan="2" id="skyscraper"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Footywire 160x600 Prime --> <ins class="adsbygoogle" style="display:inline-block;width:160px;height:600px" data-ad-client="ca-pub-1151582373407200" data-ad-slot="2707810136"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </td></tr> </table> </td> <td rowspan="3" bgcolor="#b7b7b7" style="width:1px"></td> <td height="900" width="761" valign="top" align="center" style="padding:5px 5px 5px 5px"> <div id="liveStatus" style="margin:0px;padding:0px;"></div> <table border="0" cellspacing="0" cellpadding="0"> <tr><td> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="760"> <TR> <TD id="threadsWire" WIDTH="450" HEIGHT="250" VALIGN="TOP"> </TD> <td rowspan="2" class="norm" style="width:10px"></td> <TD WIDTH="300" HEIGHT="250" ROWSPAN="2"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Footywire 300x250 Prime --> <ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-1151582373407200" data-ad-slot="4250755734"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </TD> </TR> </TABLE> </td></tr> <tr><td colspan="1" class="norm" style="height:10px"></td></tr> <tr><td> <div class="notice" width="760"> Advanced stats currently displayed. <a href="/afl/footy/ft_match_statistics?mid=9609"><b>View Basic Stats</b></a>. </div> </td></tr> <tr><td> <style> td.statdata { text-align:center; cursor:default; } </style> <script type="text/javascript"> function getStats() { document.stat_select.submit(); } </script> <TABLE WIDTH="760" BORDER="0" CELLSPACING="0" CELLPADDING="0"> <TR><TD CLASS="lnormtop"> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="760"> <TR> <TD WIDTH="375" class="lnormtop"> <table border="0" cellspacing="0" cellpadding="0" width="375"> <tr><td width="375" valign="top" height="22" align="left" class="hltitle"> North Melbourne defeats Brisbane </td></tr> <tr><td class="lnorm" height="15">Round 11, Etihad Stadium, Attendance: 22133</td></tr> <tr><td class="lnorm" height="15"> Sunday, 3rd June 2018, 1:10 PM AEST</td></tr> <tr><td class="lnorm" height="19" style="padding-top:4px;"> North Melbourne Betting Odds: Win 1.24, Line -27.5 @ 1.92 </td></tr> <tr><td class="lnorm" height="19" style="padding-bottom:4px;"> Brisbane Betting Odds: Win 4.25, Line +27.5 @ 1.92 </td></tr> </table> </TD> <td rowspan="1" class="norm" style="width:9px"></td> <TD WIDTH="376" class="lnormtop"> <table border="0" cellspacing="0" cellpadding="0" width="376" id="matchscoretable"> <tr> <th class="leftbold" height="23" width="100">Team</td> <th width="49" align="center">Q1</td> <th width="49" align="center">Q2</td> <th width="49" align="center">Q3</td> <th width="49" align="center">Q4</td> <th width="49" align="center">Final</td> </tr> <tr> <td class="leftbold" height="22"><a href="th-kangaroos">North Melbourne</a></td> <td align="center">5.7 <td align="center">12.9 <td align="center">16.14 <td align="center">21.15 <td align="center">141 </tr> <tr> <td class="leftbold" height="22"><a href="th-brisbane-lions">Brisbane</a></td> <td align="center">0.4 <td align="center">3.8 <td align="center">7.11 <td align="center">12.15 <td align="center">87 </tr> </table> </TD></TR> <TR><TD COLSPAN="3" HEIGHT="30" CLASS="norm"> <a href="#t1">North Melbourne Player Stats</a> | <a href="#t2">Brisbane Player Stats</a> | <a href="#hd">Match Head to Head Stats</a> | <a href="#brk">Scoring Breakdown</a> | <a href="highlights?id=1852">Highlights</a> </TD></TR> </TABLE></TD></TR> <tr><td colspan="1" class="norm" style="height:5px"></td></tr> <TR><TD> <table border="0" cellspacing="0" cellpadding="0" width="760"> <tr> <td> <table border="0" cellspacing="0" cellpadding="0" width="585"> <tr> <td height="21" align="center" colspan="3" class="tbtitle" width="585"> <table border="0" cellspacing="0" cellpadding="0" width="585"> <tr> <td class="innertbtitle" align="left">&nbsp;&nbsp;<b><a name=t1></a>North Melbourne Match Statistics (Sorted by Disposals)</b></td> <td class="innertbtitle" align="right">Coach: <a href="cp-brad-scott--78">Brad Scott</a>&nbsp;&nbsp;</td> </tr> </table> </td> </tr> <tr> <td rowspan="1" class="tabbdr" style="width:1px"></td> <td> <table border="0" cellspacing="0" cellpadding="3" width="583"> <tr> <td width="148" class="lbnorm" height="21">Player</td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=23&advv=Y#t1" title="Contested Possessions">CP</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=24&advv=Y#t1" title="Uncontested Possessions">UP</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=25&advv=Y#t1" title="Effective Disposals">ED</a></td> <td width="34" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=34&advv=Y#t1" title="Disposal Efficiency %">DE%</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=27&advv=Y#t1" title="Contested Marks">CM</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=21&advv=Y#t1" title="Goal Assists">GA</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=28&advv=Y#t1" title="Marks Inside 50">MI5</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=31&advv=Y#t1" title="One Percenters">1%</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=32&advv=Y#t1" title="Bounces">BO</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=35&advv=Y#t1" title="Centre Clearances">CCL</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=36&advv=Y#t1" title="Stoppage Clearances">SCL</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=37&advv=Y#t1" title="Score Involvements">SI</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=38&advv=Y#t1" title="Metres Gained">MG</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=39&advv=Y#t1" title="Turnovers">TO</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=40&advv=Y#t1" title="Intercepts">ITC</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=41&advv=Y#t1" title="Tackles Inside 50">T5</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=42&advv=Y#t1" title="Time On Ground %">TOG%</a></td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-kangaroos--shaun-higgins" title="Shaun Higgins">S Higgins</a></td> <td class="statdata">12</td> <td class="statdata">26</td> <td class="statdata">31</td> <td class="statdata">81.6</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">2</td> <td class="statdata">4</td> <td class="statdata">2</td> <td class="statdata">10</td> <td class="statdata">606</td> <td class="statdata">3</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">88</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-kangaroos--luke-mcdonald" title="Luke McDonald">L McDonald</a></td> <td class="statdata">4</td> <td class="statdata">30</td> <td class="statdata">26</td> <td class="statdata">76.5</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">9</td> <td class="statdata">702</td> <td class="statdata">5</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">83</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-kangaroos--paul-ahern" title="Paul Ahern">P Ahern</a></td> <td class="statdata">13</td> <td class="statdata">17</td> <td class="statdata">19</td> <td class="statdata">65.5</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">3</td> <td class="statdata">7</td> <td class="statdata">381</td> <td class="statdata">5</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">77</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-kangaroos--ben-cunnington" title="Ben Cunnington">B Cunnington</a></td> <td class="statdata">18</td> <td class="statdata">10</td> <td class="statdata">23</td> <td class="statdata">82.1</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">6</td> <td class="statdata">4</td> <td class="statdata">8</td> <td class="statdata">158</td> <td class="statdata">2</td> <td class="statdata">7</td> <td class="statdata">0</td> <td class="statdata">84</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-kangaroos--jamie-macmillan" title="Jamie MacMillan">J MacMillan</a></td> <td class="statdata">3</td> <td class="statdata">15</td> <td class="statdata">18</td> <td class="statdata">81.8</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">6</td> <td class="statdata">339</td> <td class="statdata">2</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">89</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-kangaroos--ben-jacobs" title="Ben Jacobs">B Jacobs</a></td> <td class="statdata">8</td> <td class="statdata">15</td> <td class="statdata">18</td> <td class="statdata">81.8</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">3</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">9</td> <td class="statdata">242</td> <td class="statdata">4</td> <td class="statdata">4</td> <td class="statdata">1</td> <td class="statdata">86</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-kangaroos--robert-tarrant" title="Robbie Tarrant">R Tarrant</a></td> <td class="statdata">4</td> <td class="statdata">16</td> <td class="statdata">16</td> <td class="statdata">76.2</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">4</td> <td class="statdata">419</td> <td class="statdata">3</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">92</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-kangaroos--jy-simpkin" title="Jy Simpkin">J Simpkin</a></td> <td class="statdata">11</td> <td class="statdata">10</td> <td class="statdata">12</td> <td class="statdata">57.1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">4</td> <td class="statdata">7</td> <td class="statdata">202</td> <td class="statdata">2</td> <td class="statdata">3</td> <td class="statdata">0</td> <td class="statdata">88</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-kangaroos--mason-wood" title="Mason Wood">M Wood</a></td> <td class="statdata">5</td> <td class="statdata">14</td> <td class="statdata">18</td> <td class="statdata">90</td> <td class="statdata">1</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">2</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">8</td> <td class="statdata">372</td> <td class="statdata">3</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">85</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-kangaroos--trent-dumont" title="Trent Dumont">T Dumont</a></td> <td class="statdata">6</td> <td class="statdata">14</td> <td class="statdata">16</td> <td class="statdata">80</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">3</td> <td class="statdata">253</td> <td class="statdata">3</td> <td class="statdata">3</td> <td class="statdata">0</td> <td class="statdata">83</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-kangaroos--jack-ziebell" title="Jack Ziebell">J Ziebell</a></td> <td class="statdata">9</td> <td class="statdata">10</td> <td class="statdata">12</td> <td class="statdata">63.2</td> <td class="statdata">1</td> <td class="statdata">2</td> <td class="statdata">2</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">8</td> <td class="statdata">339</td> <td class="statdata">4</td> <td class="statdata">3</td> <td class="statdata">3</td> <td class="statdata">94</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-kangaroos--samuel-wright" title="Samuel Wright">S Wright</a></td> <td class="statdata">3</td> <td class="statdata">15</td> <td class="statdata">15</td> <td class="statdata">83.3</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">6</td> <td class="statdata">333</td> <td class="statdata">3</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">80</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-kangaroos--billy-hartung" title="Billy Hartung">B Hartung</a></td> <td class="statdata">4</td> <td class="statdata">13</td> <td class="statdata">16</td> <td class="statdata">88.9</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">4</td> <td class="statdata">160</td> <td class="statdata">0</td> <td class="statdata">3</td> <td class="statdata">0</td> <td class="statdata">82</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-kangaroos--shaun-atley" title="Shaun Atley">S Atley</a></td> <td class="statdata">1</td> <td class="statdata">15</td> <td class="statdata">16</td> <td class="statdata">100</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">8</td> <td class="statdata">138</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">87</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-kangaroos--todd-goldstein" title="Todd Goldstein">T Goldstein</a></td> <td class="statdata">6</td> <td class="statdata">8</td> <td class="statdata">12</td> <td class="statdata">85.7</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">3</td> <td class="statdata">2</td> <td class="statdata">12</td> <td class="statdata">184</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">87</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-kangaroos--ben-brown" title="Ben Brown">B Brown</a></td> <td class="statdata">7</td> <td class="statdata">7</td> <td class="statdata">8</td> <td class="statdata">57.1</td> <td class="statdata">2</td> <td class="statdata">2</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">7</td> <td class="statdata">190</td> <td class="statdata">5</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">100</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-kangaroos--kayne-turner" title="Kayne Turner">K Turner</a></td> <td class="statdata">2</td> <td class="statdata">12</td> <td class="statdata">11</td> <td class="statdata">78.6</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">3</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">5</td> <td class="statdata">192</td> <td class="statdata">2</td> <td class="statdata">2</td> <td class="statdata">3</td> <td class="statdata">87</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-kangaroos--thomas-murphy-1" title="Thomas Murphy">T Murphy</a></td> <td class="statdata">1</td> <td class="statdata">13</td> <td class="statdata">11</td> <td class="statdata">78.6</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">233</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">60</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-kangaroos--marley-williams" title="Marley Williams">M Williams</a></td> <td class="statdata">6</td> <td class="statdata">8</td> <td class="statdata">11</td> <td class="statdata">84.6</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">5</td> <td class="statdata">97</td> <td class="statdata">4</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">90</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-kangaroos--scott-thompson-1" title="Scott Thompson">S Thompson</a></td> <td class="statdata">4</td> <td class="statdata">7</td> <td class="statdata">9</td> <td class="statdata">81.8</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">161</td> <td class="statdata">1</td> <td class="statdata">5</td> <td class="statdata">0</td> <td class="statdata">90</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-kangaroos--majak-daw" title="Majak Daw">M Daw</a></td> <td class="statdata">7</td> <td class="statdata">3</td> <td class="statdata">7</td> <td class="statdata">70</td> <td class="statdata">2</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">4</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">215</td> <td class="statdata">2</td> <td class="statdata">6</td> <td class="statdata">0</td> <td class="statdata">86</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-kangaroos--jed-anderson" title="Jed Anderson">J Anderson</a></td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">43</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">4</td> </tr> </table> </td> <td rowspan="1" class="tabbdr" style="width:1px"></td> </tr> <tr><td colspan="3" class="tabbdr" style="height:1px"></td></tr> </table> </td> <td rowspan="1" class="norm" style="width:15px"></td> <td rowspan="4" width="160" align="center" valign="top"> <table border="0" cellspacing="0" cellpadding="5" width="160" style="border:1px solid #D8DFEA"> <tr><td height="15" valign="top"><a href="/afl/footy/custom_supercoach_latest_scores" class="peep"><a href='/afl/footy/custom_supercoach_latest_scores' class='peep'>Track your favourite Fantasy Players!</a></a></td></tr> <tr> <td height="100" align="center" valign="middle"> <a href="/afl/footy/custom_supercoach_latest_scores"><img src="/afl/img/peep/peep3.jpg" border="0" height="100"/></a> </td> </tr> <tr><td valign="top">Create and save your own custom list of <a href='/afl/footy/custom_supercoach_latest_scores'>Supercoach</a> or <a href='/afl/footy/custom_dream_team_latest_scores'>AFL Fantasy</a> players to track their stats!</td></tr> </table> <div style="padding-top:10px;"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Footywire 160x600 Right --> <ins class="adsbygoogle" style="display:inline-block;width:160px;height:600px" data-ad-client="ca-pub-1151582373407200" data-ad-slot="4900122530"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </td> </tr> <tr><td colspan="2" class="norm" style="height:20px"></td></tr> <tr><td> <table border="0" cellspacing="0" cellpadding="0" width="585"> <tr> <td height="21" align="center" colspan="3" class="tbtitle" width="585"> <table border="0" cellspacing="0" cellpadding="0" width="585"> <tr> <td class="innertbtitle" align="left">&nbsp;&nbsp;<b><a name=t1></a>Brisbane Match Statistics (Sorted by Disposals)</b></td> <td class="innertbtitle" align="right">Coach: <a href="cp-chris-fagan--357">Chris Fagan</a>&nbsp;&nbsp;</td> </tr> </table> </td> </tr> <tr> <td rowspan="1" class="tabbdr" style="width:1px"></td> <td> <table border="0" cellspacing="0" cellpadding="3" width="583"> <tr> <td width="148" class="lbnorm" height="21">Player</td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=23&advv=Y#t2" title="Contested Possessions">CP</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=24&advv=Y#t2" title="Uncontested Possessions">UP</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=25&advv=Y#t2" title="Effective Disposals">ED</a></td> <td width="34" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=34&advv=Y#t2" title="Disposal Efficiency %">DE%</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=27&advv=Y#t2" title="Contested Marks">CM</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=21&advv=Y#t2" title="Goal Assists">GA</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=28&advv=Y#t2" title="Marks Inside 50">MI5</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=31&advv=Y#t2" title="One Percenters">1%</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=32&advv=Y#t2" title="Bounces">BO</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=35&advv=Y#t2" title="Centre Clearances">CCL</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=36&advv=Y#t2" title="Stoppage Clearances">SCL</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=37&advv=Y#t2" title="Score Involvements">SI</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=38&advv=Y#t2" title="Metres Gained">MG</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=39&advv=Y#t2" title="Turnovers">TO</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=40&advv=Y#t2" title="Intercepts">ITC</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=41&advv=Y#t2" title="Tackles Inside 50">T5</a></td> <td width="29" class="bnorm"><a href="fts_match_statistics?mid=9609&sby=42&advv=Y#t2" title="Time On Ground %">TOG%</a></td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-brisbane-lions--dayne-beams" title="Dayne Beams">D Beams</a></td> <td class="statdata">12</td> <td class="statdata">20</td> <td class="statdata">23</td> <td class="statdata">71.9</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">4</td> <td class="statdata">2</td> <td class="statdata">11</td> <td class="statdata">462</td> <td class="statdata">4</td> <td class="statdata">2</td> <td class="statdata">0</td> <td class="statdata">92</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-brisbane-lions--luke-hodge" title="Luke Hodge">L Hodge</a></td> <td class="statdata">8</td> <td class="statdata">18</td> <td class="statdata">23</td> <td class="statdata">88.5</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">3</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">4</td> <td class="statdata">290</td> <td class="statdata">1</td> <td class="statdata">5</td> <td class="statdata">0</td> <td class="statdata">90</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-brisbane-lions--daniel-rich" title="Daniel Rich">D Rich</a></td> <td class="statdata">4</td> <td class="statdata">19</td> <td class="statdata">15</td> <td class="statdata">62.5</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">0</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">7</td> <td class="statdata">416</td> <td class="statdata">7</td> <td class="statdata">2</td> <td class="statdata">0</td> <td class="statdata">85</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-brisbane-lions--mitch-robinson" title="Mitch Robinson">M Robinson</a></td> <td class="statdata">8</td> <td class="statdata">16</td> <td class="statdata">19</td> <td class="statdata">79.2</td> <td class="statdata">0</td> <td class="statdata">3</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">9</td> <td class="statdata">342</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">82</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-brisbane-lions--dayne-zorko" title="Dayne Zorko">D Zorko</a></td> <td class="statdata">11</td> <td class="statdata">13</td> <td class="statdata">15</td> <td class="statdata">68.2</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">3</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">3</td> <td class="statdata">4</td> <td class="statdata">9</td> <td class="statdata">334</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">92</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-brisbane-lions--nicholas-robertson" title="Nicholas Robertson">N Robertson</a></td> <td class="statdata">3</td> <td class="statdata">18</td> <td class="statdata">17</td> <td class="statdata">77.3</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">5</td> <td class="statdata">400</td> <td class="statdata">5</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">94</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-brisbane-lions--alex-witherden" title="Alex Witherden">A Witherden</a></td> <td class="statdata">8</td> <td class="statdata">13</td> <td class="statdata">18</td> <td class="statdata">81.8</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">8</td> <td class="statdata">301</td> <td class="statdata">5</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">86</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-brisbane-lions--stefan-martin" title="Stefan Martin">S Martin</a></td> <td class="statdata">9</td> <td class="statdata">12</td> <td class="statdata">16</td> <td class="statdata">76.2</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">4</td> <td class="statdata">8</td> <td class="statdata">66</td> <td class="statdata">4</td> <td class="statdata">3</td> <td class="statdata">0</td> <td class="statdata">93</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-brisbane-lions--cameron-rayner" title="Cameron Rayner">C Rayner</a></td> <td class="statdata">8</td> <td class="statdata">15</td> <td class="statdata">16</td> <td class="statdata">76.2</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">3</td> <td class="statdata">2</td> <td class="statdata">7</td> <td class="statdata">456</td> <td class="statdata">3</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">88</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-brisbane-lions--tom-cutler" title="Tom Cutler">T Cutler</a></td> <td class="statdata">9</td> <td class="statdata">10</td> <td class="statdata">12</td> <td class="statdata">63.2</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">5</td> <td class="statdata">403</td> <td class="statdata">4</td> <td class="statdata">7</td> <td class="statdata">0</td> <td class="statdata">98</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-brisbane-lions--harris-andrews" title="Harris Andrews">H Andrews</a></td> <td class="statdata">9</td> <td class="statdata">10</td> <td class="statdata">16</td> <td class="statdata">88.9</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">10</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">6</td> <td class="statdata">230</td> <td class="statdata">2</td> <td class="statdata">9</td> <td class="statdata">0</td> <td class="statdata">100</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-brisbane-lions--lewis-taylor" title="Lewis Taylor">L Taylor</a></td> <td class="statdata">4</td> <td class="statdata">13</td> <td class="statdata">15</td> <td class="statdata">88.2</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">6</td> <td class="statdata">236</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">88</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-brisbane-lions--ben-keays" title="Ben Keays">B Keays</a></td> <td class="statdata">4</td> <td class="statdata">11</td> <td class="statdata">12</td> <td class="statdata">70.6</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">8</td> <td class="statdata">157</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">2</td> <td class="statdata">91</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-brisbane-lions--eric-hipwood" title="Eric Hipwood">E Hipwood</a></td> <td class="statdata">7</td> <td class="statdata">8</td> <td class="statdata">7</td> <td class="statdata">43.8</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">5</td> <td class="statdata">243</td> <td class="statdata">3</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">94</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-brisbane-lions--ryan-lester" title="Ryan Lester">R Lester</a></td> <td class="statdata">4</td> <td class="statdata">12</td> <td class="statdata">13</td> <td class="statdata">86.7</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">7</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">4</td> <td class="statdata">128</td> <td class="statdata">3</td> <td class="statdata">5</td> <td class="statdata">1</td> <td class="statdata">86</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-brisbane-lions--zac-bailey" title="Zac Bailey">Z Bailey</a></td> <td class="statdata">5</td> <td class="statdata">8</td> <td class="statdata">11</td> <td class="statdata">78.6</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">4</td> <td class="statdata">63</td> <td class="statdata">1</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">90</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-brisbane-lions--oscar-mcinerney" title="Oscar McInerney">O McInerney</a></td> <td class="statdata">6</td> <td class="statdata">6</td> <td class="statdata">3</td> <td class="statdata">25</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">2</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">5</td> <td class="statdata">167</td> <td class="statdata">2</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">95</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-brisbane-lions--darcy-gardiner" title="Darcy Gardiner">D Gardiner</a></td> <td class="statdata">6</td> <td class="statdata">3</td> <td class="statdata">9</td> <td class="statdata">90</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">11</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">4</td> <td class="statdata">49</td> <td class="statdata">3</td> <td class="statdata">3</td> <td class="statdata">0</td> <td class="statdata">92</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-brisbane-lions--daniel-mcstay" title="Daniel McStay">D McStay</a></td> <td class="statdata">5</td> <td class="statdata">4</td> <td class="statdata">6</td> <td class="statdata">60</td> <td class="statdata">4</td> <td class="statdata">0</td> <td class="statdata">3</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">5</td> <td class="statdata">269</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">87</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-brisbane-lions--hugh-mccluggage" title="Hugh McCluggage">H McCluggage</a></td> <td class="statdata">2</td> <td class="statdata">7</td> <td class="statdata">8</td> <td class="statdata">88.9</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">2</td> <td class="statdata">175</td> <td class="statdata">1</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">41</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td align="left" height="18"><a href="pp-brisbane-lions--charlie-cameron" title="Charlie Cameron">C Cameron</a></td> <td class="statdata">3</td> <td class="statdata">1</td> <td class="statdata">4</td> <td class="statdata">100</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">8</td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">27</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td align="left" height="18"><a href="pp-brisbane-lions--allen-christensen" title="Allen Christensen">A Christensen</a></td> <td class="statdata">0</td> <td class="statdata">1</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">-5</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">0</td> <td class="statdata">10</td> </tr> </table> </td> <td rowspan="1" class="tabbdr" style="width:1px"></td> </tr> <tr><td colspan="3" class="tabbdr" style="height:1px"></td></tr> </table> </td> <td rowspan="1" class="norm" style="width:10px"></td> </tr> </table> </TD></TR> <tr><td colspan="1" class="norm" style="height:20px"></td></tr> <TR><TD valign="top"> <table border="0" cellspacing="0" cellpadding="0" width="760"> <tr><td valign="top"> <table border="0" cellspacing="0" cellpadding="0" width="375"> <tr><td height="21" align="center" colspan="5" class="tbtitle"><a name=hd></a>Head to Head</td></tr> <tr> <td rowspan="24" class="tabbdr" style="width:1px"></td> <td width="124" class="bnorm" height="21">North Melbourne</td> <td width="125" class="bnorm">Statistic</td> <td width="124" class="bnorm">Brisbane</td> <td rowspan="24" class="tabbdr" style="width:1px"></td> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="25" class="statdata">134</td> <td class="statdata">Contested Possessions</td> <td class="statdata">135</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="25" class="statdata">279</td> <td class="statdata">Uncontested Possessions</td> <td class="statdata">238</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="25" class="statdata">325</td> <td class="statdata">Effective Disposals</td> <td class="statdata">278</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="25" class="statdata">77.9%</td> <td class="statdata">Disposal Efficiency %</td> <td class="statdata">74.1%</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="25" class="statdata">49</td> <td class="statdata">Clangers</td> <td class="statdata">44</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="25" class="statdata">9</td> <td class="statdata">Contested Marks</td> <td class="statdata">10</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="25" class="statdata">17</td> <td class="statdata">Marks Inside 50</td> <td class="statdata">15</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="25" class="statdata">41</td> <td class="statdata">Clearances</td> <td class="statdata">37</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="25" class="statdata">33</td> <td class="statdata">Rebound 50s</td> <td class="statdata">33</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="25" class="statdata">35</td> <td class="statdata">One Percenters</td> <td class="statdata">52</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="25" class="statdata">5</td> <td class="statdata">Bounces</td> <td class="statdata">0</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="25" class="statdata">14</td> <td class="statdata">Goal Assists</td> <td class="statdata">9</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="25" class="statdata">66.7%</td> <td class="statdata">% Goals Assisted</td> <td class="statdata">75.0%</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="25" class="statdata">20</td> <td class="statdata">Centre Clearances</td> <td class="statdata">15</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="25" class="statdata">21</td> <td class="statdata">Stoppage Clearances</td> <td class="statdata">22</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="25" class="statdata">132</td> <td class="statdata">Score Involvements</td> <td class="statdata">123</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="25" class="statdata">5959</td> <td class="statdata">Metres Gained</td> <td class="statdata">5190</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="25" class="statdata">57</td> <td class="statdata">Turnovers</td> <td class="statdata">59</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="25" class="statdata">60</td> <td class="statdata">Intercepts</td> <td class="statdata">58</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="25" class="statdata">9</td> <td class="statdata">Tackles Inside 50</td> <td class="statdata">7</td> </tr> <tr><td colspan="5" class="tabbdr" style="height:1px"></td></tr> </tr> </table> </td> <td rowspan="1" class="norm" style="width:11px"></td> <td valign="top"> <table border="0" cellspacing="0" cellpadding="0" width="374"> <tr><td height="21" align="center" colspan="5" class="tbtitle">Average Attributes</td></tr> <tr> <td rowspan="5" class="tabbdr" style="width:1px"></td> <td width="124" class="bnorm" height="20">North Melbourne</td> <td width="124" class="bnorm">Attribute</td> <td width="124" class="bnorm">Brisbane</td> <td rowspan="5" class="tabbdr" style="width:1px"></td> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="18" class="statdata">187.7cm</td> <td class="statdata">Height</td> <td class="statdata">188.4cm</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="18" class="statdata">87.6kg</td> <td class="statdata">Weight</td> <td class="statdata">88.6kg</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="18" class="statdata">25yr 7mth</td> <td class="statdata">Age</td> <td class="statdata">24yr 5mth</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="18" class="statdata">97.4</td> <td class="statdata">Games</td> <td class="statdata">88.4</td> </tr> <tr><td colspan="5" class="tabbdr" style="height:1px"></td></tr> <tr><td colspan="5" class="norm" style="height:7px"></td></tr> <tr><td height="21" align="center" colspan="5" class="tbtitle">Total Players By Games</td></tr> <tr> <td rowspan="5" class="tabbdr" style="width:1px"></td> <td width="124" class="bnorm" height="20">North Melbourne</td> <td width="124" class="bnorm">Games</td> <td width="124" class="bnorm">Brisbane</td> <td rowspan="5" class="tabbdr" style="width:1px"></td> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="18" class="statdata">7</td> <td class="statdata">Less than 50</td> <td class="statdata">7</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="18" class="statdata">6</td> <td class="statdata">50 to 99</td> <td class="statdata">7</td> </tr> <tr bgcolor="#f2f4f7" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#f2f4f7';"> <td height="18" class="statdata">3</td> <td class="statdata">100 to 149</td> <td class="statdata">4</td> </tr> <tr bgcolor="#ffffff" onMouseOver="this.bgColor='#cbcdd0';" onMouseOut="this.bgColor='#ffffff';"> <td height="18" class="statdata">6</td> <td class="statdata">150 or more</td> <td class="statdata">4</td> </tr> <tr><td colspan="5" class="tabbdr" style="height:1px"></td></tr> </tr> <tr><td colspan="5" align="center" style="padding-top:20px;"> </td></tr> </table> </td></tr> </table> </TD></TR> <tr><td colspan="1" class="norm" style="height:20px"></td></tr> <TR><TD> <table border="0" cellspacing="0" cellpadding="0" width="760"> <tr><td height="21" align="center" colspan="7" class="tbtitle"><a name=brk></a>Quarter by Quarter Scoring Breakdown</td></tr> <tr> <td rowspan="6" class="ylwbdr" style="width:1px"></td> <td rowspan="5" class="ylwbg2" style="width:4px"></td> <td colspan="1" class="ylwbg2" style="height:4px"></td> <td rowspan="5" class="ylwbg2" style="width:4px"></td> <td colspan="1" class="ylwbg2" style="height:4px"></td> <td rowspan="5" class="ylwbg2" style="width:4px"></td> <td rowspan="6" class="ylwbdr" style="width:1px"></td> </tr> <tr> <td> <table border="0" cellspacing="0" cellpadding="0" width="373"> <tr> <td rowspan="9" class="ylwbdr" style="width:1px"></td> <td colspan="3" class="ylwbdr" style="height:1px"></td> <td rowspan="9" class="ylwbdr" style="width:1px"></td> </tr> <tr> <td class="ylwbgmid" height="20" width="124"><b>North Melbourne</b></td> <td class="ylwbgmid" width="125"><b>First Quarter</b></td> <td class="ylwbgmid" width="124"><b>Brisbane</b></td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> <tr> <td class="ylwbgmid">5.7 37</td> <td class="ylwbgmid">Score</td> <td class="ylwbgmid">0.4 4</td> </tr> <tr> <td class="ylwbgmid">12</td> <td class="ylwbgmid">Scoring Shots</td> <td class="ylwbgmid">4</td> </tr> <tr> <td class="ylwbgmid">41.7%</td> <td class="ylwbgmid">Conversion</td> <td class="ylwbgmid">0%</td> </tr> <tr> <td class="ylwbgmid">Won quarter by 33</td> <td class="ylwbgmid">Result</td> <td class="ylwbgmid">Lost quarter by 33</td> </tr> <tr> <td class="ylwbgmid">Leading by 33</td> <td class="ylwbgmid">End of Quarter</td> <td class="ylwbgmid">Trailing by 33</td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> </table> </td> <td> <table border="0" cellspacing="0" cellpadding="0" width="373"> <tr> <td rowspan="9" class="ylwbdr" style="width:1px"></td> <td colspan="3" class="ylwbdr" style="height:1px"></td> <td rowspan="9" class="ylwbdr" style="width:1px"></td> </tr> <tr> <td class="ylwbgmid" height="20" width="124"><b>North Melbourne</b></td> <td class="ylwbgmid" width="125"><b>Second Quarter</b></td> <td class="ylwbgmid" width="124"><b>Brisbane</b></td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> <tr> <td class="ylwbgmid">7.2 44</td> <td class="ylwbgmid">Score</td> <td class="ylwbgmid">3.4 22</td> </tr> <tr> <td class="ylwbgmid">9</td> <td class="ylwbgmid">Scoring Shots</td> <td class="ylwbgmid">7</td> </tr> <tr> <td class="ylwbgmid">77.8%</td> <td class="ylwbgmid">Conversion</td> <td class="ylwbgmid">42.9%</td> </tr> <tr> <td class="ylwbgmid">Won quarter by 22</td> <td class="ylwbgmid">Result</td> <td class="ylwbgmid">Lost quarter by 22</td> </tr> <tr> <td class="ylwbgmid">Leading by 55</td> <td class="ylwbgmid">Halftime</td> <td class="ylwbgmid">Trailing by 55</td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> </table> </td> </tr> <tr><td colspan="3" class="ylwbg2" style="height:4px"></td></tr> <tr> <td> <table border="0" cellspacing="0" cellpadding="0" width="373"> <tr> <td rowspan="9" class="ylwbdr" style="width:1px"></td> <td colspan="3" class="ylwbdr" style="height:1px"></td> <td rowspan="9" class="ylwbdr" style="width:1px"></td> </tr> <tr> <td class="ylwbgmid" height="20" width="124"><b>North Melbourne</b></td> <td class="ylwbgmid" width="125"><b>Third Quarter</b></td> <td class="ylwbgmid" width="124"><b>Brisbane</b></td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> <tr> <td class="ylwbgmid">4.5 29</td> <td class="ylwbgmid">Score</td> <td class="ylwbgmid">4.3 27</td> </tr> <tr> <td class="ylwbgmid">9</td> <td class="ylwbgmid">Scoring Shots</td> <td class="ylwbgmid">7</td> </tr> <tr> <td class="ylwbgmid">44.4%</td> <td class="ylwbgmid">Conversion</td> <td class="ylwbgmid">57.1%</td> </tr> <tr> <td class="ylwbgmid">Won quarter by 2</td> <td class="ylwbgmid">Result</td> <td class="ylwbgmid">Lost quarter by 2</td> </tr> <tr> <td class="ylwbgmid">Leading by 57</td> <td class="ylwbgmid">End of Quarter</td> <td class="ylwbgmid">Trailing by 57</td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> </table> </td> <td> <table border="0" cellspacing="0" cellpadding="0" width="373"> <tr> <td rowspan="9" class="ylwbdr" style="width:1px"></td> <td colspan="3" class="ylwbdr" style="height:1px"></td> <td rowspan="9" class="ylwbdr" style="width:1px"></td> </tr> <tr> <td class="ylwbgmid" height="20" width="124"><b>North Melbourne</b></td> <td class="ylwbgmid" width="125"><b>Final Quarter</b></td> <td class="ylwbgmid" width="124"><b>Brisbane</b></td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> <tr> <td class="ylwbgmid">5.1 31</td> <td class="ylwbgmid">Score</td> <td class="ylwbgmid">5.4 34</td> </tr> <tr> <td class="ylwbgmid">6</td> <td class="ylwbgmid">Scoring Shots</td> <td class="ylwbgmid">9</td> </tr> <tr> <td class="ylwbgmid">83.3%</td> <td class="ylwbgmid">Conversion</td> <td class="ylwbgmid">55.6%</td> </tr> <tr> <td class="ylwbgmid">Lost quarter by 3</td> <td class="ylwbgmid">Result</td> <td class="ylwbgmid">Won quarter by 3</td> </tr> <tr> <td class="ylwbgmid">Won game by 54</td> <td class="ylwbgmid">End of Game</td> <td class="ylwbgmid">Lost game by 54</td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> </table> </td> </tr> <tr><td colspan="3" class="ylwbg2" style="height:4px"></td></tr> <tr><td colspan="5" class="ylwbdr" style="height:1px"></td></tr> </table> </TD></TR> <tr><td colspan="1" class="norm" style="height:20px"></td></tr> <TR><TD> <table border="0" cellspacing="0" cellpadding="0" width="760"> <tr><td height="21" align="center" colspan="7" class="tbtitle">Scoring Breakdown For Each Half</td></tr> <tr> <td rowspan="4" class="ylwbdr" style="width:1px"></td> <td rowspan="3" class="ylwbg2" style="width:4px"></td> <td colspan="1" class="ylwbg2" style="height:4px"></td> <td rowspan="3" class="ylwbg2" style="width:4px"></td> <td colspan="1" class="ylwbg2" style="height:4px"></td> <td rowspan="3" class="ylwbg2" style="width:4px"></td> <td rowspan="4" class="ylwbdr" style="width:1px"></td> </tr> <tr> <td> <table border="0" cellspacing="0" cellpadding="0" width="373"> <tr> <td rowspan="9" class="ylwbdr" style="width:1px"></td> <td colspan="3" class="ylwbdr" style="height:1px"></td> <td rowspan="9" class="ylwbdr" style="width:1px"></td> </tr> <tr> <td class="ylwbgmid" height="20" width="124"><b>North Melbourne</b></td> <td class="ylwbgmid" width="125"><b>First Half</b></td> <td class="ylwbgmid" width="124"><b>Brisbane</b></td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> <tr> <td class="ylwbgmid">12.9 81</td> <td class="ylwbgmid">Score</td> <td class="ylwbgmid">3.8 26</td> </tr> <tr> <td class="ylwbgmid">21</td> <td class="ylwbgmid">Scoring Shots</td> <td class="ylwbgmid">11</td> </tr> <tr> <td class="ylwbgmid">57.1%</td> <td class="ylwbgmid">Conversion</td> <td class="ylwbgmid">27.3%</td> </tr> <tr> <td class="ylwbgmid">Won half by 55</td> <td class="ylwbgmid">Result</td> <td class="ylwbgmid">Lost half by 55</td> </tr> <tr> <td class="ylwbgmid">Leading by 55</td> <td class="ylwbgmid">Halftime</td> <td class="ylwbgmid">Trailing by 55</td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> </table> </td> <td> <table border="0" cellspacing="0" cellpadding="0" width="373"> <tr> <td rowspan="9" class="ylwbdr" style="width:1px"></td> <td colspan="3" class="ylwbdr" style="height:1px"></td> <td rowspan="9" class="ylwbdr" style="width:1px"></td> </tr> <tr> <td class="ylwbgmid" height="20" width="124"><b>North Melbourne</b></td> <td class="ylwbgmid" width="125"><b>Second Half</b></td> <td class="ylwbgmid" width="124"><b>Brisbane</b></td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> <tr> <td class="ylwbgmid">9.6 60</td> <td class="ylwbgmid">Score</td> <td class="ylwbgmid">9.7 61</td> </tr> <tr> <td class="ylwbgmid">15</td> <td class="ylwbgmid">Scoring Shots</td> <td class="ylwbgmid">16</td> </tr> <tr> <td class="ylwbgmid">60.0%</td> <td class="ylwbgmid">Conversion</td> <td class="ylwbgmid">56.2%</td> </tr> <tr> <td class="ylwbgmid">Lost half by 1</td> <td class="ylwbgmid">Result</td> <td class="ylwbgmid">Won half by 1</td> </tr> <tr> <td class="ylwbgmid">Won game by 54</td> <td class="ylwbgmid">End of Game</td> <td class="ylwbgmid">Lost game by 54</td> </tr> <tr><td colspan="3" class="ylwbdr" style="height:1px"></td></tr> </table> </td> </tr> <tr><td colspan="3" class="ylwbg2" style="height:4px"></td></tr> <tr><td colspan="5" class="ylwbdr" style="height:1px"></td></tr> </table> </TD></TR> </TABLE> </td></tr> </table></td> <td rowspan="3" bgcolor="#b7b7b7" style="width:1px"></td> </tr> <tr><td align="center" valign="middle" height="40"> </td></tr> <tr> <td colspan="1" bgcolor="#b7b7b7" style="height:1px"></td> </tr> <tr><td colspan="3" align="center" valign="middle" height="25"> <table id="footer"> <tr> <td id="footercopy">Footywire.com &copy; 2018</td> <td id="footerlinks"> <a href="/afl/footy/info?if=a">about</a> <a href="/afl/footy/info?if=t">terms</a> <a href="/afl/footy/info?if=p">privacy</a> <a target="_smaq" href="http://www.smaqtalk.com/">discussions</a> <a href="/afl/footy/contact_us">contact us</a> </td> </tr> </table> </td></tr> </table> </DIV> <table id="teammenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" >x</div></td></tr> <tr> <td colspan="3"><a class="submenuitem" href="/afl/footy/ft_teams">Compare Teams</a></td> </tr> <tr> <td colspan="3"><div class="submenutitle">Team Home Pages</div></td> </tr> <tr> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" class="submenuitem" href="/afl/footy/th-richmond-tigers">Tigers</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('teammenu')" onMouseUp="hideSubMenu('teammenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="playermenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" >x</div></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/ft_players">All Players</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/player_search">Player Search</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/past_players">Past Players</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/other_players">Other Players</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/ft_player_compare">Compare Players</a></td></tr> <tr> <td colspan="3"><div class="submenutitle">Team Playing Lists</div></td> </tr> <tr> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" class="submenuitem" href="/afl/footy/tp-richmond-tigers">Tigers</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('playermenu')" onMouseUp="hideSubMenu('playermenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="playerrankmenu"> <tr><td colspan="3" align="right"><div class="submenux" onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" >x</div></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/ft_player_rankings?rt=LA">League Averages</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/ft_player_rankings?rt=LT">League Totals</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/ft_player_rankings?rt=RA">Rising Star Averages</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/ft_player_rankings?rt=RT">Rising Star Totals</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/ft_goal_kickers">Season Goalkickers</a></td></tr> <tr> <td colspan="3"><div class="submenutitle">Player Rankings by Team</div></td> </tr> <tr> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" class="submenuitem" href="/afl/footy/tr-richmond-tigers">Tigers</a></td> </tr> <tr><td colspan="3" align="right"><div class="submenux" onClick="hideSubMenu('playerrankmenu')" onMouseUp="hideSubMenu('playerrankmenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="teamrankmenu"> <tr><td align="right"><div class="submenux" onClick="hideSubMenu('teamrankmenu')" onMouseUp="hideSubMenu('teamrankmenu')" >x</div></td></tr> <tr><td><a onClick="hideSubMenu('teamrankmenu')" onMouseUp="hideSubMenu('teamrankmenu')" class="submenuitem" href="/afl/footy/ft_team_rankings?type=TA">Team Averages</a></td></tr> <tr><td><a onClick="hideSubMenu('teamrankmenu')" onMouseUp="hideSubMenu('teamrankmenu')" class="submenuitem" href="/afl/footy/ft_team_rankings?type=TT">Team Totals</a></td></tr> <tr><td><a onClick="hideSubMenu('teamrankmenu')" onMouseUp="hideSubMenu('teamrankmenu')" class="submenuitem" href="/afl/footy/ft_team_rankings?type=OA">Opponent Averages</a></td></tr> <tr><td><a onClick="hideSubMenu('teamrankmenu')" onMouseUp="hideSubMenu('teamrankmenu')" class="submenuitem" href="/afl/footy/ft_team_rankings?type=OT">Opponent Totals</a></td></tr> <tr><td><a onClick="hideSubMenu('teamrankmenu')" onMouseUp="hideSubMenu('teamrankmenu')" class="submenuitem" href="/afl/footy/ft_team_rankings?type=DA">Team/Opponent Differential Averages</a></td></tr> <tr><td><a onClick="hideSubMenu('teamrankmenu')" onMouseUp="hideSubMenu('teamrankmenu')" class="submenuitem" href="/afl/footy/ft_team_rankings?type=DT">Team/Opponent Differential Totals</a></td></tr> <tr><td align="right"><div class="submenux" onClick="hideSubMenu('teamrankmenu')" onMouseUp="hideSubMenu('teamrankmenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="draftmenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" >x</div></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/ft_drafts">Full AFL Draft History</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/ft_team_draft_summaries">Draft Summary by Team</a></td></tr> <tr> <td colspan="3"><div class="submenutitle">AFL Draft History by Team</div></td> </tr> <tr> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" class="submenuitem" href="/afl/footy/td-richmond-tigers">Tigers</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('draftmenu')" onMouseUp="hideSubMenu('draftmenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="risingstarmenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" >x</div></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ft_rising_stars_round_performances">Rising Star Round by Round Performances</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/rising_star_nominations">Rising Star Nominees</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/rising_star_winners">Rising Star Winners</a></td></tr> <tr> <td colspan="3"><div class="submenutitle">Eligible Rising Stars by Team</div></td> </tr> <tr> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" class="submenuitem" href="/afl/footy/ty-richmond-tigers">Tigers</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('risingstarmenu')" onMouseUp="hideSubMenu('risingstarmenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="matchmenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" >x</div></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/ft_match_list">Full Season AFL Fixture</a></td></tr> <tr> <td colspan="3"><div class="submenutitle">Played and Scheduled Matches by Team</div></td> </tr> <tr> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" class="submenuitem" href="/afl/footy/tg-richmond-tigers">Tigers</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('matchmenu')" onMouseUp="hideSubMenu('matchmenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="laddermenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('laddermenu')" onMouseUp="hideSubMenu('laddermenu')" >x</div></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('laddermenu')" onMouseUp="hideSubMenu('laddermenu')" class="submenuitem" href="/afl/footy/ft_ladder">Full Season</a></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('laddermenu')" onMouseUp="hideSubMenu('laddermenu')" class="submenuitem" href="/afl/footy/live_ladder">Live Ladder</a></td></tr> <tr> <td colspan="3"><div class="submenutitle">Filter Ladder by</div></td> </tr> <tr> <td><a onClick="hideSubMenu('laddermenu')" onMouseUp="hideSubMenu('laddermenu')" class="submenuitem" href="/afl/footy/ft_ladder?pt=RD&st=01&sb=p">Round</a></td> <td><a onClick="hideSubMenu('laddermenu')" onMouseUp="hideSubMenu('laddermenu')" class="submenuitem" href="/afl/footy/ft_ladder?pt=PD&st=Q1&sb=p">Match Period</a></td> <td><a onClick="hideSubMenu('laddermenu')" onMouseUp="hideSubMenu('laddermenu')" class="submenuitem" href="/afl/footy/ft_ladder?pt=LC&st=LC&sb=p">Location</a></td> </tr> <tr> <td><a onClick="hideSubMenu('laddermenu')" onMouseUp="hideSubMenu('laddermenu')" class="submenuitem" href="/afl/footy/ft_ladder?pt=VN&st=10&sb=p">Venue</a></td> <td><a onClick="hideSubMenu('laddermenu')" onMouseUp="hideSubMenu('laddermenu')" class="submenuitem" href="/afl/footy/ft_ladder?pt=ST&st=disposals&sb=p">Stats</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('laddermenu')" onMouseUp="hideSubMenu('laddermenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="brownlowmenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" >x</div></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/brownlow_medal">Full Brownlow Medal Count</a></td></tr><tr> <tr><td colspan="3"><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/brownlow_medal_winners">Brownlow Medal Winners</a></td></tr><tr> <tr><td colspan="3"><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/team_brownlow_medal_summaries">Summary by Team</a></td></tr><tr> <tr> <td colspan="3"><div class="submenutitle">Brownlow Medal Vote Getters By Club</div></td> </tr> <tr> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" class="submenuitem" href="/afl/footy/tb-richmond-tigers">Tigers</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('brownlowmenu')" onMouseUp="hideSubMenu('brownlowmenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="attendancemenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" >x</div></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/attendances">AFL Crowds & Attendances</a></td></tr><tr> <tr> <td colspan="3"><div class="submenutitle">Historical Attendance by Team</div></td> </tr> <tr> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" class="submenuitem" href="/afl/footy/ta-richmond-tigers">Tigers</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('attendancemenu')" onMouseUp="hideSubMenu('attendancemenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="coachmenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" >x</div></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/afl_coaches">AFL Coaches</a></td></tr><tr> <tr> <td colspan="3"><div class="submenutitle">AFL Club Coaches</div></td> </tr> <tr> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" class="submenuitem" href="/afl/footy/tc-richmond-tigers">Tigers</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('coachmenu')" onMouseUp="hideSubMenu('coachmenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="highlightsmenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" >x</div></td></tr> <tr><td colspan="3"><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/afl_highlights">AFL Highlights</a></td></tr><tr> <tr> <td colspan="3"><div class="submenutitle">AFL Club Highlights</div></td> </tr> <tr> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" class="submenuitem" href="/afl/footy/tv-richmond-tigers">Tigers</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('highlightsmenu')" onMouseUp="hideSubMenu('highlightsmenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="supercoachmenu"> <tr><td align="right"><div class="submenux" onClick="hideSubMenu('supercoachmenu')" onMouseUp="hideSubMenu('supercoachmenu')" >x</div></td></tr> <tr><td><a onClick="hideSubMenu('supercoachmenu')" onMouseUp="hideSubMenu('supercoachmenu')" class="submenuitem" href="/afl/footy/supercoach_round">Round by Round Player Rankings</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('supercoachmenu')" onMouseUp="hideSubMenu('supercoachmenu')" class="submenuitem" href="/afl/footy/supercoach_season">Season Player Rankings</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('supercoachmenu')" onMouseUp="hideSubMenu('supercoachmenu')" class="submenuitem" href="/afl/footy/supercoach_breakevens">Supercoach Breakevens</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('supercoachmenu')" onMouseUp="hideSubMenu('supercoachmenu')" class="submenuitem" href="/afl/footy/supercoach_scores">Supercoach Scores</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('supercoachmenu')" onMouseUp="hideSubMenu('supercoachmenu')" class="submenuitem" href="/afl/footy/supercoach_prices">Supercoach Prices</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('supercoachmenu')" onMouseUp="hideSubMenu('supercoachmenu')" class="submenuitem" href="/afl/footy/custom_supercoach_latest_scores">Custom Supercoach Player List</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('supercoachmenu')" onMouseUp="hideSubMenu('supercoachmenu')" class="submenuitem" href="/afl/footy/pre_season_supercoach">Pre-Season Supercoach Stats</a></td></tr><tr> <tr><td align="right"><div class="submenux" onClick="hideSubMenu('supercoachmenu')" onMouseUp="hideSubMenu('supercoachmenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="dreamteammenu"> <tr><td align="right"><div class="submenux" onClick="hideSubMenu('dreamteammenu')" onMouseUp="hideSubMenu('dreamteammenu')" >x</div></td></tr> <tr><td><a onClick="hideSubMenu('dreamteammenu')" onMouseUp="hideSubMenu('dreamteammenu')" class="submenuitem" href="/afl/footy/dream_team_round">Round by Round Player Rankings</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('dreamteammenu')" onMouseUp="hideSubMenu('dreamteammenu')" class="submenuitem" href="/afl/footy/dream_team_season">Season Player Rankings</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('dreamteammenu')" onMouseUp="hideSubMenu('dreamteammenu')" class="submenuitem" href="/afl/footy/dream_team_breakevens">AFL Fantasy Breakevens</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('dreamteammenu')" onMouseUp="hideSubMenu('dreamteammenu')" class="submenuitem" href="/afl/footy/dream_team_scores">AFL Fantasy Scores</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('dreamteammenu')" onMouseUp="hideSubMenu('dreamteammenu')" class="submenuitem" href="/afl/footy/dream_team_prices">AFL Fantasy Prices</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('dreamteammenu')" onMouseUp="hideSubMenu('dreamteammenu')" class="submenuitem" href="/afl/footy/custom_dream_team_latest_scores">Custom AFL Fantasy Player List</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('dreamteammenu')" onMouseUp="hideSubMenu('dreamteammenu')" class="submenuitem" href="/afl/footy/pre_season_dream_team">Pre-Season AFL Fantasy Stats</a></td></tr><tr> <tr><td align="right"><div class="submenux" onClick="hideSubMenu('dreamteammenu')" onMouseUp="hideSubMenu('dreamteammenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="selectionsmenu"> <tr><td align="right"><div class="submenux" onClick="hideSubMenu('selectionsmenu')" onMouseUp="hideSubMenu('selectionsmenu')" >x</div></td></tr> <tr><td><a onClick="hideSubMenu('selectionsmenu')" onMouseUp="hideSubMenu('selectionsmenu')" class="submenuitem" href="/afl/footy/afl_team_selections">Latest Team Selections</a></td></tr><tr> <tr><td><a onClick="hideSubMenu('selectionsmenu')" onMouseUp="hideSubMenu('selectionsmenu')" class="submenuitem" href="/afl/footy/custom_all_team_selections">Custom Team Selections List</a></td></tr><tr> <tr><td align="right"><div class="submenux" onClick="hideSubMenu('selectionsmenu')" onMouseUp="hideSubMenu('selectionsmenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="pastplayermenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" >x</div></td></tr> <tr> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" class="submenuitem" href="/afl/footy/ti-richmond-tigers">Tigers</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('pastplayermenu')" onMouseUp="hideSubMenu('pastplayermenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <table id="contractsmenu"> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" >x</div></td></tr> <tr> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-carlton-blues">Blues</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-essendon-bombers">Bombers</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-western-bulldogs">Bulldogs</a></td> </tr> <tr> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-geelong-cats">Cats</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-adelaide-crows">Crows</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-melbourne-demons">Demons</a></td> </tr> <tr> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-fremantle-dockers">Dockers</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-west-coast-eagles">Eagles</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-greater-western-sydney-giants">Giants</a></td> </tr> <tr> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-hawthorn-hawks">Hawks</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-kangaroos">Kangaroos</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-brisbane-lions">Lions</a></td> </tr> <tr> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-collingwood-magpies">Magpies</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-port-adelaide-power">Power</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-st-kilda-saints">Saints</a></td> </tr> <tr> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-gold-coast-suns">Suns</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-sydney-swans">Swans</a></td> <td><a onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" class="submenuitem" href="/afl/footy/to-richmond-tigers">Tigers</a></td> </tr> <tr><td align="right" colspan="3"><div class="submenux" onClick="hideSubMenu('contractsmenu')" onMouseUp="hideSubMenu('contractsmenu')" style="padding-top:6px;">hide menu</div></td></tr> </table> <div id="membersbgdiv" onClick="closeMemberDivs();"></div> <div id="memberswhitediv"> <table border="0" cellspacing="0" cellpadding="0" align="center"> <tr><td height="30" align="right" valign="top"><span id="membersx" onClick="closeMemberDivs();">X</span></td></tr> <tr><td id="memberscontent" valign="top" align="center"> &nbsp; </td></tr> </table> </div> </BODY> </HTML>
/* * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the ec2-2014-06-15.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.EC2.Model { public partial class DeleteRouteTableResult : AmazonWebServiceResponse { } }
<?php namespace Bolt\Extension\IComeFromTheNet\BookMe\Model\Schedule\Handler; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\DBALException; use Bolt\Extension\IComeFromTheNet\BookMe\Model\Schedule\Command\StartScheduleCommand; use Bolt\Extension\IComeFromTheNet\BookMe\Model\Schedule\ScheduleException; /** * Used to create a schedule in the given calendar year. * * @author Lewis Dyer <getintouch@icomefromthenet.com> * @since 1.0 */ class StartScheduleHandler { /** * @var array a map internal table names to external names */ protected $aTableNames; /** * @var Doctrine\DBAL\Connection the database adpater */ protected $oDatabaseAdapter; public function __construct(array $aTableNames, Connection $oDatabaseAdapter) { $this->oDatabaseAdapter = $oDatabaseAdapter; $this->aTableNames = $aTableNames; } public function handle(StartScheduleCommand $oCommand) { $oDatabase = $this->oDatabaseAdapter; $sScheduleTableName = $this->aTableNames['bm_schedule']; $sScheduleSlotTableName = $this->aTableNames['bm_schedule_slot']; $sTimeSlotYearTableName = $this->aTableNames['bm_timeslot_year']; $sSlotTableName = $this->aTableNames['bm_timeslot_day']; $iScheduleId = null; $iCalendarYear = $oCommand->getCalendarYear(); $iMemberId = $oCommand->getMemberId(); $iTimeSlotId = $oCommand->getTimeSlotId(); $aSql = []; $a2Sql = []; # Step 1 Create The schedule $aSql[] = " INSERT INTO $sScheduleTableName (`schedule_id`,`timeslot_id`,`membership_id`,`calendar_year`,`registered_date`) "; $aSql[] = " VALUES (NULL, ?, ?, ?, NOW()) "; $sSql = implode(PHP_EOL,$aSql); # Step 2 create slots for this calender year $a2Sql[] = " INSERT INTO $sScheduleSlotTableName (`schedule_id`, `slot_open`, `slot_close`) "; $a2Sql[] = " SELECT ? , `c`.`opening_slot` as slot_open , `c`.`closing_slot` as slot_close "; $a2Sql[] = " FROM $sTimeSlotYearTableName c"; $a2Sql[] = " WHERE `c`.`y` = ? "; $a2Sql[] = " AND `c`.`timeslot_id` = ? "; $s2Sql = implode(PHP_EOL,$a2Sql); try { $oDateType = Type::getType(Type::DATE); $oIntType = Type::getType(Type::INTEGER); $oDatabase->executeUpdate($sSql, [$iTimeSlotId,$iMemberId,$iCalendarYear], [$oIntType,$oIntType,$oIntType]); $iScheduleId = $oDatabase->lastInsertId(); if(true == empty($iScheduleId)) { throw new DBALException('Could not Insert a new schedule'); } $oCommand->setScheduleId($iScheduleId); $iRowsAffected = $oDatabase->executeUpdate($s2Sql, [$iScheduleId,$iCalendarYear,$iTimeSlotId], [$oIntType,$oIntType,$oIntType]); if($iRowsAffected == 0) { throw new DBALException('Could not generate schedule slots'); } } catch(DBALException $e) { throw ScheduleException::hasFailedStartSchedule($oCommand, $e); } return true; } } /* End of File */
<?php /** * * * Copyright 2001, 2008 Thomas Belliard, Laurent Delineau, Edouard Hue, Eric Lebrun, Julien Jocal * * This file is part of GEPI. * * GEPI is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * GEPI is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GEPI; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* fichier pour visionner les EdT des salles */ echo ' <form action="index_edt.php" id="liste_salle" method="post"> <p> '; $tab_select = renvoie_liste("salle"); $indice_salle_select = -1; if(isset($login_edt)){ for($i=0; $i<count($tab_select); $i++) { if($login_edt == $tab_select[$i]["id_salle"]){ $indice_salle_select = $i; break; } } } //if(isset($login_edt)){ if($indice_salle_select != -1){ if($indice_salle_select != 0){ $precedent = $indice_salle_select - 1; echo " <span class=\"edt_suivant\"> <a href='index_edt.php?visioedt=salle1&amp;login_edt=".$tab_select[$precedent]["id_salle"]."&amp;type_edt_2=salle'>".PREVIOUS_CLASSROOM."</a> </span> "; } } echo ' <select name="login_edt" onchange=\'document.getElementById("liste_salle").submit();\'> <option value="rien">'.CHOOSE_CLASSROOM.'</option> '; for($i=0; $i<count($tab_select); $i++) { if(isset($login_edt)){ if($login_edt == $tab_select[$i]["id_salle"]){ $selected=" selected='selected'"; } else{ $selected=""; } } else{ $selected=""; } // On affiche ou non le nom de la salle if ($tab_select[$i]["nom_salle"] != "") { $aff_nom_salle = "(".$tab_select[$i]["nom_salle"].")"; } else { $aff_nom_salle = ""; } echo " <option value='".$tab_select[$i]["id_salle"]."'".$selected.">".$tab_select[$i]["numero_salle"]." ".$aff_nom_salle."</option> "; } echo ' </select> <input type="hidden" name="type_edt_2" value="salle" /> <input type="hidden" name="visioedt" value="salle1" /> '; if($indice_salle_select != count($tab_select)){ $suivant = $indice_salle_select + 1; if($suivant<count($tab_select)){ //$suivant=$indice_prof_select+1; echo " <span class=\"edt_suivant\"> <a href='index_edt.php?visioedt=salle1&amp;login_edt=".$tab_select[$suivant]["id_salle"]."&amp;type_edt_2=salle'>".NEXT_CLASSROOM."</a> </span> "; } } echo ' </p> </form> '; ?>
--- # DO NOT EDIT! # This file is automatically generated by get-members. If you change it, bad # things will happen. layout: default title: "Community Relations" --- {% include interests/community-relations.md %} ### Who is interested in Community Relations? * [Mr Khalid Mahmood]({{ site.baseurl }}/members/mr-khalid-mahmood.html)
/* asmlinkage long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn); */ #include "sanitise.h" struct syscallentry syscall_pciconfig_iobase = { .name = "pciconfig_iobase", .num_args = 3, .arg1name = "which", .arg2name = "bus", .arg3name = "devfn", };
#include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char *argv[]) { printf("hello world (pid:%d)\n", (int) getpid()); int rc = fork(); if (rc < 0) { // fork failed; exit fprintf(stderr, "fork failed\n"); exit(1); } else if (rc == 0) { // child (new process) printf("hello, I am child (pid:%d)\n", (int) getpid()); } else { printf("hello, I am parent of %d (pid:%d)\n", rc, (int) getpid()); } return 0; }
/* Target-dependent code for GDB, the GNU debugger. Copyright (C) 2000-2020 Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PPC_TDEP_H #define PPC_TDEP_H #include "gdbarch.h" struct gdbarch; struct frame_info; struct value; struct regcache; struct type; /* From ppc-sysv-tdep.c ... */ enum return_value_convention ppc_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf); enum return_value_convention ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf); CORE_ADDR ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, function_call_return_method return_method, CORE_ADDR struct_addr); CORE_ADDR ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, function_call_return_method return_method, CORE_ADDR struct_addr); enum return_value_convention ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf); /* From rs6000-tdep.c... */ int altivec_register_p (struct gdbarch *gdbarch, int regno); int vsx_register_p (struct gdbarch *gdbarch, int regno); int spe_register_p (struct gdbarch *gdbarch, int regno); /* Return non-zero if the architecture described by GDBARCH has floating-point registers (f0 --- f31 and fpscr). */ int ppc_floating_point_unit_p (struct gdbarch *gdbarch); /* Return non-zero if the architecture described by GDBARCH has Altivec registers (vr0 --- vr31, vrsave and vscr). */ int ppc_altivec_support_p (struct gdbarch *gdbarch); /* Return non-zero if the architecture described by GDBARCH has VSX registers (vsr0 --- vsr63). */ int vsx_support_p (struct gdbarch *gdbarch); std::vector<CORE_ADDR> ppc_deal_with_atomic_sequence (struct regcache *regcache); /* Register set description. */ struct ppc_reg_offsets { /* General-purpose registers. */ int r0_offset; int gpr_size; /* size for r0-31, pc, ps, lr, ctr. */ int xr_size; /* size for cr, xer, mq. */ int pc_offset; int ps_offset; int cr_offset; int lr_offset; int ctr_offset; int xer_offset; int mq_offset; /* Floating-point registers. */ int f0_offset; int fpscr_offset; int fpscr_size; }; extern void ppc_supply_reg (struct regcache *regcache, int regnum, const gdb_byte *regs, size_t offset, int regsize); extern void ppc_collect_reg (const struct regcache *regcache, int regnum, gdb_byte *regs, size_t offset, int regsize); /* Supply register REGNUM in the general-purpose register set REGSET from the buffer specified by GREGS and LEN to register cache REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ extern void ppc_supply_gregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs, size_t len); /* Supply register REGNUM in the floating-point register set REGSET from the buffer specified by FPREGS and LEN to register cache REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ extern void ppc_supply_fpregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *fpregs, size_t len); /* Supply register REGNUM in the Altivec register set REGSET from the buffer specified by VRREGS and LEN to register cache REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ extern void ppc_supply_vrregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *vrregs, size_t len); /* Supply register REGNUM in the VSX register set REGSET from the buffer specified by VSXREGS and LEN to register cache REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ extern void ppc_supply_vsxregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *vsxregs, size_t len); /* Collect register REGNUM in the general-purpose register set REGSET, from register cache REGCACHE into the buffer specified by GREGS and LEN. If REGNUM is -1, do this for all registers in REGSET. */ extern void ppc_collect_gregset (const struct regset *regset, const struct regcache *regcache, int regnum, void *gregs, size_t len); /* Collect register REGNUM in the floating-point register set REGSET, from register cache REGCACHE into the buffer specified by FPREGS and LEN. If REGNUM is -1, do this for all registers in REGSET. */ extern void ppc_collect_fpregset (const struct regset *regset, const struct regcache *regcache, int regnum, void *fpregs, size_t len); /* Collect register REGNUM in the Altivec register set REGSET from register cache REGCACHE into the buffer specified by VRREGS and LEN. If REGNUM is -1, do this for all registers in REGSET. */ extern void ppc_collect_vrregset (const struct regset *regset, const struct regcache *regcache, int regnum, void *vrregs, size_t len); /* Collect register REGNUM in the VSX register set REGSET from register cache REGCACHE into the buffer specified by VSXREGS and LEN. If REGNUM is -1, do this for all registers in REGSET. */ extern void ppc_collect_vsxregset (const struct regset *regset, const struct regcache *regcache, int regnum, void *vsxregs, size_t len); /* Private data that this module attaches to struct gdbarch. */ /* ELF ABI version used by the inferior. */ enum powerpc_elf_abi { POWERPC_ELF_AUTO, POWERPC_ELF_V1, POWERPC_ELF_V2, POWERPC_ELF_LAST }; /* Vector ABI used by the inferior. */ enum powerpc_vector_abi { POWERPC_VEC_AUTO, POWERPC_VEC_GENERIC, POWERPC_VEC_ALTIVEC, POWERPC_VEC_SPE, POWERPC_VEC_LAST }; /* long double ABI version used by the inferior. */ enum powerpc_long_double_abi { POWERPC_LONG_DOUBLE_AUTO, POWERPC_LONG_DOUBLE_IBM128, POWERPC_LONG_DOUBLE_IEEE128, POWERPC_LONG_DOUBLE_LAST }; struct gdbarch_tdep { int wordsize; /* Size in bytes of fixed-point word. */ int soft_float; /* Avoid FP registers for arguments? */ enum powerpc_elf_abi elf_abi; /* ELF ABI version. */ /* Format to use for the "long double" data type. */ enum powerpc_long_double_abi long_double_abi; /* How to pass vector arguments. Never set to AUTO or LAST. */ enum powerpc_vector_abi vector_abi; int ppc_gp0_regnum; /* GPR register 0 */ int ppc_toc_regnum; /* TOC register */ int ppc_ps_regnum; /* Processor (or machine) status (%msr) */ int ppc_cr_regnum; /* Condition register */ int ppc_lr_regnum; /* Link register */ int ppc_ctr_regnum; /* Count register */ int ppc_xer_regnum; /* Integer exception register */ /* Not all PPC and RS6000 variants will have the registers represented below. A -1 is used to indicate that the register is not present in this variant. */ /* Floating-point registers. */ int ppc_fp0_regnum; /* Floating-point register 0. */ int ppc_fpscr_regnum; /* fp status and condition register. */ /* Multiplier-Quotient Register (older POWER architectures only). */ int ppc_mq_regnum; /* POWER7 VSX registers. */ int ppc_vsr0_regnum; /* First VSX register. */ int ppc_vsr0_upper_regnum; /* First right most dword vsx register. */ int ppc_efpr0_regnum; /* First Extended FP register. */ /* Altivec registers. */ int ppc_vr0_regnum; /* First AltiVec register. */ int ppc_vrsave_regnum; /* Last AltiVec register. */ /* Altivec pseudo-register vX aliases for the raw vrX registers. */ int ppc_v0_alias_regnum; /* SPE registers. */ int ppc_ev0_upper_regnum; /* First GPR upper half register. */ int ppc_ev0_regnum; /* First ev register. */ int ppc_acc_regnum; /* SPE 'acc' register. */ int ppc_spefscr_regnum; /* SPE 'spefscr' register. */ /* Program Priority Register. */ int ppc_ppr_regnum; /* Data Stream Control Register. */ int ppc_dscr_regnum; /* Target Address Register. */ int ppc_tar_regnum; /* Decimal 128 registers. */ int ppc_dl0_regnum; /* First Decimal128 argument register pair. */ int have_ebb; /* PMU registers. */ int ppc_mmcr0_regnum; int ppc_mmcr2_regnum; int ppc_siar_regnum; int ppc_sdar_regnum; int ppc_sier_regnum; /* Hardware Transactional Memory registers. */ int have_htm_spr; int have_htm_core; int have_htm_fpu; int have_htm_altivec; int have_htm_vsx; int ppc_cppr_regnum; int ppc_cdscr_regnum; int ppc_ctar_regnum; /* HTM pseudo registers. */ int ppc_cdl0_regnum; int ppc_cvsr0_regnum; int ppc_cefpr0_regnum; /* Offset to ABI specific location where link register is saved. */ int lr_frame_offset; /* An array of integers, such that sim_regno[I] is the simulator register number for GDB register number I, or -1 if the simulator does not implement that register. */ int *sim_regno; /* ISA-specific types. */ struct type *ppc_builtin_type_vec64; struct type *ppc_builtin_type_vec128; int (*ppc_syscall_record) (struct regcache *regcache); }; /* Constants for register set sizes. */ enum { ppc_num_gprs = 32, /* 32 general-purpose registers. */ ppc_num_fprs = 32, /* 32 floating-point registers. */ ppc_num_srs = 16, /* 16 segment registers. */ ppc_num_vrs = 32, /* 32 Altivec vector registers. */ ppc_num_vshrs = 32, /* 32 doublewords (dword 1 of vs0~vs31). */ ppc_num_vsrs = 64, /* 64 VSX vector registers. */ ppc_num_efprs = 32 /* 32 Extended FP registers. */ }; /* Register number constants. These are GDB internal register numbers; they are not used for the simulator or remote targets. Extra SPRs (those other than MQ, CTR, LR, XER, SPEFSCR) are given numbers above PPC_NUM_REGS. So are segment registers and other target-defined registers. */ enum { PPC_R0_REGNUM = 0, PPC_F0_REGNUM = 32, PPC_PC_REGNUM = 64, PPC_MSR_REGNUM = 65, PPC_CR_REGNUM = 66, PPC_LR_REGNUM = 67, PPC_CTR_REGNUM = 68, PPC_XER_REGNUM = 69, PPC_FPSCR_REGNUM = 70, PPC_MQ_REGNUM = 71, PPC_SPE_UPPER_GP0_REGNUM = 72, PPC_SPE_ACC_REGNUM = 104, PPC_SPE_FSCR_REGNUM = 105, PPC_VR0_REGNUM = 106, PPC_VSCR_REGNUM = 138, PPC_VRSAVE_REGNUM = 139, PPC_VSR0_UPPER_REGNUM = 140, PPC_VSR31_UPPER_REGNUM = 171, PPC_PPR_REGNUM = 172, PPC_DSCR_REGNUM = 173, PPC_TAR_REGNUM = 174, /* EBB registers. */ PPC_BESCR_REGNUM = 175, PPC_EBBHR_REGNUM = 176, PPC_EBBRR_REGNUM = 177, /* PMU registers. */ PPC_MMCR0_REGNUM = 178, PPC_MMCR2_REGNUM = 179, PPC_SIAR_REGNUM = 180, PPC_SDAR_REGNUM = 181, PPC_SIER_REGNUM = 182, /* Hardware transactional memory registers. */ PPC_TFHAR_REGNUM = 183, PPC_TEXASR_REGNUM = 184, PPC_TFIAR_REGNUM = 185, PPC_CR0_REGNUM = 186, PPC_CCR_REGNUM = 218, PPC_CXER_REGNUM = 219, PPC_CLR_REGNUM = 220, PPC_CCTR_REGNUM = 221, PPC_CF0_REGNUM = 222, PPC_CFPSCR_REGNUM = 254, PPC_CVR0_REGNUM = 255, PPC_CVSCR_REGNUM = 287, PPC_CVRSAVE_REGNUM = 288, PPC_CVSR0_UPPER_REGNUM = 289, PPC_CPPR_REGNUM = 321, PPC_CDSCR_REGNUM = 322, PPC_CTAR_REGNUM = 323, PPC_NUM_REGS }; /* Big enough to hold the size of the largest register in bytes. */ #define PPC_MAX_REGISTER_SIZE 64 #define PPC_IS_EBB_REGNUM(i) \ ((i) >= PPC_BESCR_REGNUM && (i) <= PPC_EBBRR_REGNUM) #define PPC_IS_PMU_REGNUM(i) \ ((i) >= PPC_MMCR0_REGNUM && (i) <= PPC_SIER_REGNUM) #define PPC_IS_TMSPR_REGNUM(i) \ ((i) >= PPC_TFHAR_REGNUM && (i) <= PPC_TFIAR_REGNUM) #define PPC_IS_CKPTGP_REGNUM(i) \ ((i) >= PPC_CR0_REGNUM && (i) <= PPC_CCTR_REGNUM) #define PPC_IS_CKPTFP_REGNUM(i) \ ((i) >= PPC_CF0_REGNUM && (i) <= PPC_CFPSCR_REGNUM) #define PPC_IS_CKPTVMX_REGNUM(i) \ ((i) >= PPC_CVR0_REGNUM && (i) <= PPC_CVRSAVE_REGNUM) #define PPC_IS_CKPTVSX_REGNUM(i) \ ((i) >= PPC_CVSR0_UPPER_REGNUM && (i) < (PPC_CVSR0_UPPER_REGNUM + 32)) /* An instruction to match. */ struct ppc_insn_pattern { unsigned int mask; /* mask the insn with this... */ unsigned int data; /* ...and see if it matches this. */ int optional; /* If non-zero, this insn may be absent. */ }; extern int ppc_insns_match_pattern (struct frame_info *frame, CORE_ADDR pc, const struct ppc_insn_pattern *pattern, unsigned int *insns); extern CORE_ADDR ppc_insn_d_field (unsigned int insn); extern CORE_ADDR ppc_insn_ds_field (unsigned int insn); extern int ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr); /* Instruction size. */ #define PPC_INSN_SIZE 4 /* Estimate for the maximum number of instructions in a function epilogue. */ #define PPC_MAX_EPILOGUE_INSTRUCTIONS 52 #endif /* ppc-tdep.h */
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("hbotService")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("hbotService")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2e8cfaa1-3743-49ef-9e21-2926ca18c058")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
<?php /** * The template for displaying archive pages * * @link https://codex.wordpress.org/Template_Hierarchy * * @package WP_playground */ get_header(); ?> <div id="primary" class="content-area"> <main id="main" class="site-main"> <?php if ( have_posts() ) : ?> <header class="page-header"> <?php the_archive_title( '<h1 class="page-title">', '</h1>' ); the_archive_description( '<div class="archive-description">', '</div>' ); ?> </header><!-- .page-header --> <?php /* Start the Loop */ while ( have_posts() ) : the_post(); /* * Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'template-parts/content', get_post_format() ); endwhile; the_posts_navigation(); else : get_template_part( 'template-parts/content', 'none' ); endif; ?> </main><!-- #main --> </div><!-- #primary --> <?php get_sidebar(); get_footer();
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # * Neither the name of pyglet nor the names of its # contributors may be used to endorse or promote products # derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # ---------------------------------------------------------------------------- ''' ''' __docformat__ = 'restructuredtext' __version__ = '$Id: pil.py 163 2006-11-13 04:15:46Z Alex.Holkner $' from ctypes import * from pyglet.com import IUnknown from pyglet.gl import * from pyglet.image import * from pyglet.image.codecs import * from pyglet.libs.win32.constants import * from pyglet.libs.win32.types import * ole32 = windll.ole32 kernel32 = windll.kernel32 gdiplus = windll.gdiplus LPSTREAM = c_void_p REAL = c_float PixelFormat1bppIndexed = 196865 PixelFormat4bppIndexed = 197634 PixelFormat8bppIndexed = 198659 PixelFormat16bppGrayScale = 1052676 PixelFormat16bppRGB555 = 135173 PixelFormat16bppRGB565 = 135174 PixelFormat16bppARGB1555 = 397319 PixelFormat24bppRGB = 137224 PixelFormat32bppRGB = 139273 PixelFormat32bppARGB = 2498570 PixelFormat32bppPARGB = 925707 PixelFormat48bppRGB = 1060876 PixelFormat64bppARGB = 3424269 PixelFormat64bppPARGB = 29622286 PixelFormatMax = 15 ImageLockModeRead = 1 ImageLockModeWrite = 2 ImageLockModeUserInputBuf = 4 class GdiplusStartupInput(Structure): _fields_ = [ ('GdiplusVersion', c_uint32), ('DebugEventCallback', c_void_p), ('SuppressBackgroundThread', BOOL), ('SuppressExternalCodecs', BOOL) ] class GdiplusStartupOutput(Structure): _fields = [ ('NotificationHookProc', c_void_p), ('NotificationUnhookProc', c_void_p) ] class BitmapData(Structure): _fields_ = [ ('Width', c_uint), ('Height', c_uint), ('Stride', c_int), ('PixelFormat', c_int), ('Scan0', POINTER(c_byte)), ('Reserved', POINTER(c_uint)) ] class Rect(Structure): _fields_ = [ ('X', c_int), ('Y', c_int), ('Width', c_int), ('Height', c_int) ] kernel32.GlobalAlloc.restype = HGLOBAL kernel32.GlobalLock.restype = c_void_p PropertyTagFrameDelay = 0x5100 class PropertyItem(Structure): _fields_ = [ ('id', c_uint), ('length', c_ulong), ('type', c_short), ('value', c_void_p) ] class GDIPlusDecoder(ImageDecoder): def get_file_extensions(self): return ['.bmp', '.gif', '.jpg', '.jpeg', '.exif', '.png', '.tif', '.tiff'] def get_animation_file_extensions(self): # TIFF also supported as a multi-page image; but that's not really an # animation, is it? return ['.gif'] def _load_bitmap(self, file, filename): data = file.read() # Create a HGLOBAL with image data hglob = kernel32.GlobalAlloc(GMEM_MOVEABLE, len(data)) ptr = kernel32.GlobalLock(hglob) memmove(ptr, data, len(data)) kernel32.GlobalUnlock(hglob) # Create IStream for the HGLOBAL self.stream = IUnknown() ole32.CreateStreamOnHGlobal(hglob, True, byref(self.stream)) # Load image from stream bitmap = c_void_p() status = gdiplus.GdipCreateBitmapFromStream(self.stream, byref(bitmap)) if status != 0: self.stream.Release() raise ImageDecodeException( 'GDI+ cannot load %r' % (filename or file)) return bitmap def _get_image(self, bitmap): # Get size of image (Bitmap subclasses Image) width = REAL() height = REAL() gdiplus.GdipGetImageDimension(bitmap, byref(width), byref(height)) width = int(width.value) height = int(height.value) # Get image pixel format pf = c_int() gdiplus.GdipGetImagePixelFormat(bitmap, byref(pf)) pf = pf.value # Reverse from what's documented because of Intel little-endianness. format = 'BGRA' if pf == PixelFormat24bppRGB: format = 'BGR' elif pf == PixelFormat32bppRGB: pass elif pf == PixelFormat32bppARGB: pass elif pf in (PixelFormat16bppARGB1555, PixelFormat32bppPARGB, PixelFormat64bppARGB, PixelFormat64bppPARGB): pf = PixelFormat32bppARGB else: format = 'BGR' pf = PixelFormat24bppRGB # Lock pixel data in best format rect = Rect() rect.X = 0 rect.Y = 0 rect.Width = width rect.Height = height bitmap_data = BitmapData() gdiplus.GdipBitmapLockBits(bitmap, byref(rect), ImageLockModeRead, pf, byref(bitmap_data)) # Create buffer for RawImage buffer = create_string_buffer(bitmap_data.Stride * height) memmove(buffer, bitmap_data.Scan0, len(buffer)) # Unlock data gdiplus.GdipBitmapUnlockBits(bitmap, byref(bitmap_data)) return ImageData(width, height, format, buffer, -bitmap_data.Stride) def _delete_bitmap(self, bitmap): # Release image and stream gdiplus.GdipDisposeImage(bitmap) self.stream.Release() def decode(self, file, filename): bitmap = self._load_bitmap(file, filename) image = self._get_image(bitmap) self._delete_bitmap(bitmap) return image def decode_animation(self, file, filename): bitmap = self._load_bitmap(file, filename) dimension_count = c_uint() gdiplus.GdipImageGetFrameDimensionsCount(bitmap, byref(dimension_count)) if dimension_count.value < 1: self._delete_bitmap(bitmap) raise ImageDecodeException('Image has no frame dimensions') # XXX Make sure this dimension is time? dimensions = (c_void_p * dimension_count.value)() gdiplus.GdipImageGetFrameDimensionsList(bitmap, dimensions, dimension_count.value) frame_count = c_uint() gdiplus.GdipImageGetFrameCount(bitmap, dimensions, byref(frame_count)) prop_id = PropertyTagFrameDelay prop_size = c_uint() gdiplus.GdipGetPropertyItemSize(bitmap, prop_id, byref(prop_size)) prop_buffer = c_buffer(prop_size.value) prop_item = cast(prop_buffer, POINTER(PropertyItem)).contents gdiplus.GdipGetPropertyItem(bitmap, prop_id, prop_size.value, prop_buffer) # XXX Sure it's long? n_delays = prop_item.length / sizeof(c_long) delays = cast(prop_item.value, POINTER(c_long * n_delays)).contents frames = [] for i in range(frame_count.value): gdiplus.GdipImageSelectActiveFrame(bitmap, dimensions, i) image = self._get_image(bitmap) delay = delays[i] if delay <= 1: delay = 10 frames.append(AnimationFrame(image, delay/100.)) self._delete_bitmap(bitmap) return Animation(frames) def get_decoders(): return [GDIPlusDecoder()] def get_encoders(): return [] def init(): token = c_ulong() startup_in = GdiplusStartupInput() startup_in.GdiplusVersion = 1 startup_out = GdiplusStartupOutput() gdiplus.GdiplusStartup(byref(token), byref(startup_in), byref(startup_out)) # Shutdown later? # gdiplus.GdiplusShutdown(token) init()
# SPDX-License-Identifier: GPL-2.0 # # Makefile for the PowerPC 8xx linux kernel. # obj-y += m8xx_setup.o machine_check.o pic.o obj-$(CONFIG_MPC885ADS) += mpc885ads_setup.o obj-$(CONFIG_MPC86XADS) += mpc86xads_setup.o obj-$(CONFIG_PPC_EP88XC) += ep88xc.o obj-$(CONFIG_PPC_ADDER875) += adder875.o obj-$(CONFIG_TQM8XX) += tqm8xx_setup.o
#!/usr/bin/env python import sys from cx_Freeze import setup, Executable setup( name="CryptoUnLocker", version="1.0", Description="Detection and Decryption tool for CryptoLocker files", executables= [Executable("CryptoUnLocker.py")] )
package com.badlogic.gdx.math; import com.badlogic.gdx.utils.Array; /** This class represents a cumulative distribution. * It can be used in scenarios where there are values with different probabilities * and it's required to pick one of those respecting the probability. * For example one could represent the frequency of the alphabet letters using a cumulative distribution * and use it to randomly pick a letter respecting their probabilities (useful when generating random words). * Another example could be point generation on a mesh surface: one could generate a cumulative distribution using * triangles areas as interval size, in this way triangles with a large area will be picked more often than triangles with a smaller one. * See <a href="http://en.wikipedia.org/wiki/Cumulative_distribution_function">Wikipedia</a> for a detailed explanation. * @author Inferno */ public class CumulativeDistribution <T>{ public class CumulativeValue{ public T value; public float frequency; public float interval; public CumulativeValue(T value, float frequency, float interval){ this.value = value; this.frequency = frequency; this.interval = interval; } } private Array<CumulativeValue> values; public CumulativeDistribution(){ values = new Array<CumulativeValue>(false, 10, CumulativeValue.class); } /** Adds a value with a given interval size to the distribution */ public void add(T value, float intervalSize){ values.add(new CumulativeValue(value, 0, intervalSize)); } /** Adds a value with interval size equal to zero to the distribution*/ public void add(T value){ values.add(new CumulativeValue(value, 0, 0)); } /** Generate the cumulative distribution */ public void generate(){ float sum = 0; for(int i=0; i < values.size; ++i){ sum += values.items[i].interval; values.items[i].frequency = sum; } } /** Generate the cumulative distribution in [0,1] where each interval will get a frequency between [0,1] */ public void generateNormalized(){ float sum = 0; for(int i=0; i < values.size; ++i){ sum += values.items[i].interval; } float intervalSum = 0; for(int i=0; i < values.size; ++i){ intervalSum += values.items[i].interval/sum; values.items[i].frequency = intervalSum; } } /** Generate the cumulative distribution in [0,1] where each value will have the same frequency and interval size*/ public void generateUniform(){ float freq = 1f/values.size; for(int i=0; i < values.size; ++i){ //reset the interval to the normalized frequency values.items[i].interval = freq; values.items[i].frequency=(i+1)*freq; } } /** Finds the value whose interval contains the given probability * Binary search algorithm is used to find the value. * @param probability * @return the value whose interval contains the probability */ public T value(float probability){ CumulativeValue value = null; int imax = values.size-1, imin = 0, imid; while (imin <= imax){ imid = imin + ((imax - imin) / 2); value = values.items[imid]; if(probability < value.frequency) imax = imid -1; else if(probability > value.frequency) imin = imid +1; else break; } return value.value; } /** @return the value whose interval contains a random probability in [0,1] */ public T value(){ return value(MathUtils.random()); } /** @return the amount of values */ public int size(){ return values.size; } /**@return the interval size for the value at the given position */ public float getInterval(int index){ return values.items[index].interval; } /**@return the value at the given position */ public T getValue(int index){ return values.items[index].value; } /** Set the interval size on the passed in object. * The object must be present in the distribution. */ public void setInterval(T obj, float intervalSize){ for(CumulativeValue value : values) if(value.value == obj){ value.interval = intervalSize; return; } } /** Sets the interval size for the value at the given index */ public void setInterval(int index, float intervalSize){ values.items[index].interval = intervalSize; } /** Removes all the values from the distribution */ public void clear(){ values.clear(); } }
package org.eclipse.jetty.servlets; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.net.Socket; import javax.servlet.Filter; import javax.servlet.Servlet; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.http.HttpURI; import org.eclipse.jetty.servlet.FilterHolder; import org.eclipse.jetty.testing.ServletTester; import org.eclipse.jetty.util.IO; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; /** * @version $Revision$ $Date$ */ public abstract class AbstractDoSFilterTest { private static ServletTester _tester; private static String _host; private static int _port; private static long _requestMaxTime = 200; private static FilterHolder _dosFilter; private static FilterHolder _timeoutFilter; public static void startServer(Class<? extends Filter> filter) throws Exception { _tester = new ServletTester(); HttpURI uri = new HttpURI(_tester.createChannelConnector(true)); _host = uri.getHost(); _port = uri.getPort(); _tester.setContextPath("/ctx"); _tester.addServlet(TestServlet.class, "/*"); _dosFilter = _tester.addFilter(filter, "/dos/*", 0); _dosFilter.setInitParameter("maxRequestsPerSec", "4"); _dosFilter.setInitParameter("delayMs", "200"); _dosFilter.setInitParameter("throttledRequests", "1"); _dosFilter.setInitParameter("waitMs", "10"); _dosFilter.setInitParameter("throttleMs", "4000"); _dosFilter.setInitParameter("remotePort", "false"); _dosFilter.setInitParameter("insertHeaders", "true"); _timeoutFilter = _tester.addFilter(filter, "/timeout/*", 0); _timeoutFilter.setInitParameter("maxRequestsPerSec", "4"); _timeoutFilter.setInitParameter("delayMs", "200"); _timeoutFilter.setInitParameter("throttledRequests", "1"); _timeoutFilter.setInitParameter("waitMs", "10"); _timeoutFilter.setInitParameter("throttleMs", "4000"); _timeoutFilter.setInitParameter("remotePort", "false"); _timeoutFilter.setInitParameter("insertHeaders", "true"); _timeoutFilter.setInitParameter("maxRequestMs", _requestMaxTime + ""); _tester.start(); } @AfterClass public static void stopServer() throws Exception { _tester.stop(); } @Before public void startFilters() throws Exception { _dosFilter.start(); _timeoutFilter.start(); } @After public void stopFilters() throws Exception { _timeoutFilter.stop(); _dosFilter.stop(); } private String doRequests(String requests, int loops, long pause0, long pause1, String request) throws Exception { Socket socket = new Socket(_host, _port); socket.setSoTimeout(30000); for (int i=loops;i-->0;) { socket.getOutputStream().write(requests.getBytes("UTF-8")); socket.getOutputStream().flush(); if (i>0 && pause0>0) Thread.sleep(pause0); } if (pause1>0) Thread.sleep(pause1); socket.getOutputStream().write(request.getBytes("UTF-8")); socket.getOutputStream().flush(); String response; if (requests.contains("/unresponsive")) { // don't read in anything, forcing the request to time out Thread.sleep(_requestMaxTime * 2); response = IO.toString(socket.getInputStream(),"UTF-8"); } else { response = IO.toString(socket.getInputStream(),"UTF-8"); } socket.close(); return response; } private int count(String responses,String substring) { int count=0; int i=responses.indexOf(substring); while (i>=0) { count++; i=responses.indexOf(substring,i+substring.length()); } return count; } @Test public void testEvenLowRateIP() throws Exception { String request="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\n\r\n"; String last="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n"; String responses = doRequests(request,11,300,300,last); assertEquals(12,count(responses,"HTTP/1.1 200 OK")); assertEquals(0,count(responses,"DoSFilter:")); } @Test public void testBurstLowRateIP() throws Exception { String request="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\n\r\n"; String last="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n"; String responses = doRequests(request+request+request+request,2,1100,1100,last); assertEquals(9,count(responses,"HTTP/1.1 200 OK")); assertEquals(0,count(responses,"DoSFilter:")); } @Test public void testDelayedIP() throws Exception { String request="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\n\r\n"; String last="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n"; String responses = doRequests(request+request+request+request+request,2,1100,1100,last); assertEquals(11,count(responses,"HTTP/1.1 200 OK")); assertEquals(2,count(responses,"DoSFilter: delayed")); } @Test public void testThrottledIP() throws Exception { Thread other = new Thread() { @Override public void run() { try { // Cause a delay, then sleep while holding pass String request="GET /ctx/dos/sleeper HTTP/1.1\r\nHost: localhost\r\n\r\n"; String last="GET /ctx/dos/sleeper?sleep=2000 HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n"; String responses = doRequests(request+request+request+request,1,0,0,last); } catch(Exception e) { e.printStackTrace(); } } }; other.start(); Thread.sleep(1500); String request="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\n\r\n"; String last="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n"; String responses = doRequests(request+request+request+request,1,0,0,last); //System.out.println("responses are " + responses); assertEquals("200 OK responses", 5,count(responses,"HTTP/1.1 200 OK")); assertEquals("delayed responses", 1,count(responses,"DoSFilter: delayed")); assertEquals("throttled responses", 1,count(responses,"DoSFilter: throttled")); assertEquals("unavailable responses", 0,count(responses,"DoSFilter: unavailable")); other.join(); } @Test public void testUnavailableIP() throws Exception { Thread other = new Thread() { @Override public void run() { try { // Cause a delay, then sleep while holding pass String request="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\n\r\n"; String last="GET /ctx/dos/test?sleep=5000 HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n"; String responses = doRequests(request+request+request+request,1,0,0,last); } catch(Exception e) { e.printStackTrace(); } } }; other.start(); Thread.sleep(500); String request="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\n\r\n"; String last="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n"; String responses = doRequests(request+request+request+request,1,0,0,last); assertEquals(4,count(responses,"HTTP/1.1 200 OK")); assertEquals(1,count(responses,"HTTP/1.1 503")); assertEquals(1,count(responses,"DoSFilter: delayed")); assertEquals(1,count(responses,"DoSFilter: throttled")); assertEquals(1,count(responses,"DoSFilter: unavailable")); other.join(); } @Test public void testSessionTracking() throws Exception { // get a session, first String requestSession="GET /ctx/dos/test?session=true HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n"; String response=doRequests("",1,0,0,requestSession); String sessionId=response.substring(response.indexOf("Set-Cookie: ")+12, response.indexOf(";")); // all other requests use this session String request="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\nCookie: " + sessionId + "\r\n\r\n"; String last="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\nCookie: " + sessionId + "\r\n\r\n"; String responses = doRequests(request+request+request+request+request,2,1100,1100,last); assertEquals(11,count(responses,"HTTP/1.1 200 OK")); assertEquals(2,count(responses,"DoSFilter: delayed")); } @Test public void testMultipleSessionTracking() throws Exception { // get some session ids, first String requestSession="GET /ctx/dos/test?session=true HTTP/1.1\r\nHost: localhost\r\n\r\n"; String closeRequest="GET /ctx/dos/test?session=true HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n"; String response=doRequests(requestSession+requestSession,1,0,0,closeRequest); String[] sessions = response.split("\r\n\r\n"); String sessionId1=sessions[0].substring(sessions[0].indexOf("Set-Cookie: ")+12, sessions[0].indexOf(";")); String sessionId2=sessions[1].substring(sessions[1].indexOf("Set-Cookie: ")+12, sessions[1].indexOf(";")); // alternate between sessions String request1="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\nCookie: " + sessionId1 + "\r\n\r\n"; String request2="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\nCookie: " + sessionId2 + "\r\n\r\n"; String last="GET /ctx/dos/test HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\nCookie: " + sessionId2 + "\r\n\r\n"; // ensure the sessions are new String responses = doRequests(request1+request2,1,1100,1100,last); Thread.sleep(1000); responses = doRequests(request1+request2+request1+request2+request1,2,1100,1100,last); assertEquals(11,count(responses,"HTTP/1.1 200 OK")); assertEquals(0,count(responses,"DoSFilter: delayed")); // alternate between sessions responses = doRequests(request1+request2+request1+request2+request1,2,350,550,last); assertEquals(11,count(responses,"HTTP/1.1 200 OK")); int delayedRequests = count(responses,"DoSFilter: delayed"); assertTrue("delayedRequests: " + delayedRequests + " is not between 2 and 3",delayedRequests >= 2 && delayedRequests <= 3); } @Test public void testUnresponsiveClient() throws Exception { int numRequests = 1000; String last="GET /ctx/timeout/unresponsive?lines="+numRequests+" HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n"; String responses = doRequests("",0,0,0,last); // was expired, and stopped before reaching the end of the requests int responseLines = count(responses, "Line:"); assertTrue(responses.contains("DoSFilter: timeout")); assertTrue(responseLines > 0 && responseLines < numRequests); } public static class TestServlet extends HttpServlet implements Servlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (request.getParameter("session")!=null) request.getSession(true); if (request.getParameter("sleep")!=null) { try { Thread.sleep(Long.parseLong(request.getParameter("sleep"))); } catch(InterruptedException e) { } } if (request.getParameter("lines")!=null) { int count = Integer.parseInt(request.getParameter("lines")); for(int i = 0; i < count; ++i) { response.getWriter().append("Line: " + i+"\n"); response.flushBuffer(); try { Thread.sleep(10); } catch(InterruptedException e) { } } } response.setContentType("text/plain"); } } }
<!DOCTYPE html> <html class="theme-next mist use-motion" lang="zh-Hans"> <head> <meta charset="UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> <meta name="theme-color" content="#222"> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" /> <link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" /> <link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" /> <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4"> <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4"> <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4"> <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222"> <meta name="keywords" content="Hexo, NexT" /> <meta name="description" content="stay hungry, stay foolish"> <meta property="og:type" content="website"> <meta property="og:title" content="孟跃平的技术博客"> <meta property="og:url" content="http://www.mengyueping.com/tags/UDID/index.html"> <meta property="og:site_name" content="孟跃平的技术博客"> <meta property="og:description" content="stay hungry, stay foolish"> <meta property="og:locale" content="zh-Hans"> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="孟跃平的技术博客"> <meta name="twitter:description" content="stay hungry, stay foolish"> <script type="text/javascript" id="hexo.configurations"> var NexT = window.NexT || {}; var CONFIG = { root: '/', scheme: 'Mist', version: '5.1.4', sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false}, fancybox: true, tabs: true, motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}, duoshuo: { userId: '0', author: '博主' }, algolia: { applicationID: '', apiKey: '', indexName: '', hits: {"per_page":10}, labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"} } }; </script> <link rel="canonical" href="http://www.mengyueping.com/tags/UDID/"/> <title>标签: UDID | 孟跃平的技术博客</title> <script type="text/javascript"> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?deacc15534ffb9510cfb94bae354ea45"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </head> <body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans"> <div class="container sidebar-position-left "> <div class="headband"></div> <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader"> <div class="header-inner"><div class="site-brand-wrapper"> <div class="site-meta "> <div class="custom-logo-site-title"> <a href="/" class="brand" rel="start"> <span class="logo-line-before"><i></i></span> <span class="site-title">孟跃平的技术博客</span> <span class="logo-line-after"><i></i></span> </a> </div> <p class="site-subtitle"></p> </div> <div class="site-nav-toggle"> <button> <span class="btn-bar"></span> <span class="btn-bar"></span> <span class="btn-bar"></span> </button> </div> </div> <nav class="site-nav"> <ul id="menu" class="menu"> <li class="menu-item menu-item-home"> <a href="/" rel="section"> <i class="menu-item-icon fa fa-fw fa-home"></i> <br /> 首页 </a> </li> <li class="menu-item menu-item-tags"> <a href="/tags/" rel="section"> <i class="menu-item-icon fa fa-fw fa-tags"></i> <br /> 标签 </a> </li> <li class="menu-item menu-item-categories"> <a href="/categories/" rel="section"> <i class="menu-item-icon fa fa-fw fa-th"></i> <br /> 分类 </a> </li> <li class="menu-item menu-item-archives"> <a href="/archives/" rel="section"> <i class="menu-item-icon fa fa-fw fa-archive"></i> <br /> 归档 </a> </li> <li class="menu-item menu-item-about"> <a href="/about/" rel="section"> <i class="menu-item-icon fa fa-fw fa-user"></i> <br /> 关于 </a> </li> </ul> </nav> </div> </header> <main id="main" class="main"> <div class="main-inner"> <div class="content-wrap"> <div id="content" class="content"> <div class="post-block tag"> <div id="posts" class="posts-collapse"> <div class="collection-title"> <h1>UDID<small>标签</small> </h1> </div> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2017/07/12/iOS-keyChain-IDFV/" itemprop="url"> <span itemprop="name">iOS开发中使用到的设备ID及存储方案</span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2017-07-12T00:00:00+08:00" content="2017-07-12" > 07-12 </time> </div> </header> </article> </div> </div> </div> </div> <div class="sidebar-toggle"> <div class="sidebar-toggle-line-wrap"> <span class="sidebar-toggle-line sidebar-toggle-line-first"></span> <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span> <span class="sidebar-toggle-line sidebar-toggle-line-last"></span> </div> </div> <aside id="sidebar" class="sidebar"> <div class="sidebar-inner"> <section class="site-overview-wrap sidebar-panel sidebar-panel-active"> <div class="site-overview"> <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person"> <img class="site-author-image" itemprop="image" src="/uploads/avatar.png" alt="孟跃平" /> <p class="site-author-name" itemprop="name">孟跃平</p> <p class="site-description motion-element" itemprop="description">stay hungry, stay foolish</p> </div> <nav class="site-state motion-element"> <div class="site-state-item site-state-posts"> <a href="/archives/"> <span class="site-state-item-count">16</span> <span class="site-state-item-name">日志</span> </a> </div> <div class="site-state-item site-state-categories"> <a href="/categories/index.html"> <span class="site-state-item-count">11</span> <span class="site-state-item-name">分类</span> </a> </div> <div class="site-state-item site-state-tags"> <a href="/tags/index.html"> <span class="site-state-item-count">48</span> <span class="site-state-item-name">标签</span> </a> </div> </nav> <div class="links-of-author motion-element"> <span class="links-of-author-item"> <a href="https://github.com/MengYP" target="_blank" title="GitHub"> <i class="fa fa-fw fa-github"></i>GitHub</a> </span> <span class="links-of-author-item"> <a href="mailto:mengcoder@gmail.com" target="_blank" title="E-Mail"> <i class="fa fa-fw fa-envelope"></i>E-Mail</a> </span> </div> </div> </section> </div> </aside> </div> </main> <footer id="footer" class="footer"> <div class="footer-inner"> <div class="copyright">&copy; 2015 &mdash; <span itemprop="copyrightYear">2018</span> <span class="with-love"> <i class="fa fa-user"></i> </span> <span class="author" itemprop="copyrightHolder">孟跃平</span> </div> </div> </footer> <div class="back-to-top"> <i class="fa fa-arrow-up"></i> </div> </div> <script type="text/javascript"> if (Object.prototype.toString.call(window.Promise) !== '[object Function]') { window.Promise = null; } </script> <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script> <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script> <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script> <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script> <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script> <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script> <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script> <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script> <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script> <script id="dsq-count-scr" src="https://.disqus.com/count.js" async></script> <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script> <script>AV.initialize("bSSS0Dg4QVv1p0FAHGaWv8Ei-gzGzoHsz", "UcKuDEryAx1QLVWeFLQHrUns");</script> <script> function showTime(Counter) { var query = new AV.Query(Counter); var entries = []; var $visitors = $(".leancloud_visitors"); $visitors.each(function () { entries.push( $(this).attr("id").trim() ); }); query.containedIn('url', entries); query.find() .done(function (results) { var COUNT_CONTAINER_REF = '.leancloud-visitors-count'; if (results.length === 0) { $visitors.find(COUNT_CONTAINER_REF).text(0); return; } for (var i = 0; i < results.length; i++) { var item = results[i]; var url = item.get('url'); var time = item.get('time'); var element = document.getElementById(url); $(element).find(COUNT_CONTAINER_REF).text(time); } for(var i = 0; i < entries.length; i++) { var url = entries[i]; var element = document.getElementById(url); var countSpan = $(element).find(COUNT_CONTAINER_REF); if( countSpan.text() == '') { countSpan.text(0); } } }) .fail(function (object, error) { console.log("Error: " + error.code + " " + error.message); }); } function addCount(Counter) { var $visitors = $(".leancloud_visitors"); var url = $visitors.attr('id').trim(); var title = $visitors.attr('data-flag-title').trim(); var query = new AV.Query(Counter); query.equalTo("url", url); query.find({ success: function(results) { if (results.length > 0) { var counter = results[0]; counter.fetchWhenSave(true); counter.increment("time"); counter.save(null, { success: function(counter) { var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text(counter.get('time')); }, error: function(counter, error) { console.log('Failed to save Visitor num, with error message: ' + error.message); } }); } else { var newcounter = new Counter(); /* Set ACL */ var acl = new AV.ACL(); acl.setPublicReadAccess(true); acl.setPublicWriteAccess(true); newcounter.setACL(acl); /* End Set ACL */ newcounter.set("title", title); newcounter.set("url", url); newcounter.set("time", 1); newcounter.save(null, { success: function(newcounter) { var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text(newcounter.get('time')); }, error: function(newcounter, error) { console.log('Failed to create'); } }); } }, error: function(error) { console.log('Error:' + error.code + " " + error.message); } }); } $(function() { var Counter = AV.Object.extend("Counter"); if ($('.leancloud_visitors').length == 1) { addCount(Counter); } else if ($('.post-title-link').length > 1) { showTime(Counter); } }); </script> </body> </html>
<?php /* * This file is part of the PHPUnit_MockObject package. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * @since File available since Release 1.0.0 */ class Framework_MockBuilderTest extends PHPUnit_Framework_TestCase { public function testMockBuilderRequiresClassName() { $spec = $this->getMockBuilder('Mockable'); $mock = $spec->getMock(); $this->assertTrue($mock instanceof Mockable); } public function testByDefaultMocksAllMethods() { $spec = $this->getMockBuilder('Mockable'); $mock = $spec->getMock(); $this->assertNull($mock->mockableMethod()); $this->assertNull($mock->anotherMockableMethod()); } public function testMethodsToMockCanBeSpecified() { $spec = $this->getMockBuilder('Mockable'); $spec->setMethods(array('mockableMethod')); $mock = $spec->getMock(); $this->assertNull($mock->mockableMethod()); $this->assertTrue($mock->anotherMockableMethod()); } public function testByDefaultDoesNotPassArgumentsToTheConstructor() { $spec = $this->getMockBuilder('Mockable'); $mock = $spec->getMock(); $this->assertEquals(array(null, null), $mock->constructorArgs); } public function testMockClassNameCanBeSpecified() { $spec = $this->getMockBuilder('Mockable'); $spec->setMockClassName('ACustomClassName'); $mock = $spec->getMock(); $this->assertTrue($mock instanceof ACustomClassName); } public function testConstructorArgumentsCanBeSpecified() { $spec = $this->getMockBuilder('Mockable'); $spec->setConstructorArgs($expected = array(23, 42)); $mock = $spec->getMock(); $this->assertEquals($expected, $mock->constructorArgs); } public function testOriginalConstructorCanBeDisabled() { $spec = $this->getMockBuilder('Mockable'); $spec->disableOriginalConstructor(); $mock = $spec->getMock(); $this->assertNull($mock->constructorArgs); } public function testByDefaultOriginalCloneIsPreserved() { $spec = $this->getMockBuilder('Mockable'); $mock = $spec->getMock(); $cloned = clone $mock; $this->assertTrue($cloned->cloned); } public function testOriginalCloneCanBeDisabled() { $spec = $this->getMockBuilder('Mockable'); $spec->disableOriginalClone(); $mock = $spec->getMock(); $mock->cloned = false; $cloned = clone $mock; $this->assertFalse($cloned->cloned); } public function testCallingAutoloadCanBeDisabled() { // it is not clear to me how to test this nor the difference // between calling it or not $this->markTestIncomplete(); } public function testProvidesAFluentInterface() { $spec = $this->getMockBuilder('Mockable') ->setMethods(array('mockableMethod')) ->setConstructorArgs(array()) ->setMockClassName('DummyClassName') ->disableOriginalConstructor() ->disableOriginalClone() ->disableAutoload(); $this->assertTrue($spec instanceof PHPUnit_Framework_MockObject_MockBuilder); } }